# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=468

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 469

---

## [DataFrame column names into GLM as variable names](https://discourse.julialang.org/t/dataframe-column-names-into-glm-as-variable-names/78422)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 10:43pm UTC](https://discourse.julialang.org/t/dataframe-column-names-into-glm-as-variable-names/78422 "2022-03-24T22:43:38Z")

</div>

I would like to use GLM to estimate 500 regressions like beta\[1\] = coef(lm(@formula(AAPL ~ SP500), Stocks))\[2\] beta\[2\] = coef(lm(@formula(AMGN ~ SP500), Stocks))\[2\] … beta\[i\] = coef(lm(@formula(col\_i ~ SP500), Stocks…

---

## [Another slowdown when using \`Threads.@threads\`?](https://discourse.julialang.org/t/another-slowdown-when-using-threads-threads/78009)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 11\
**Last updated:** [March 24, 2022, 8:12pm UTC](https://discourse.julialang.org/t/another-slowdown-when-using-threads-threads/78009 "2022-03-24T20:12:06Z")

</div>

The MWE using LinearAlgebra using Random using BenchmarkTools function distance(x, y, p::Real = 2) norm((x\[1\] - y\[1\], x\[2\] - y\[2\]), p) end function jfa\_serial!(grid, sites, p::Real=2) for (color, (x, y)) in en…

---

## [How to avoid function name conflict without using the package identifier every time](https://discourse.julialang.org/t/how-to-avoid-function-name-conflict-without-using-the-package-identifier-every-time/78186)

<div class="topic-metadata">

**Author:** [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Replies:** 10\
**Last updated:** [March 24, 2022, 5:32pm UTC](https://discourse.julialang.org/t/how-to-avoid-function-name-conflict-without-using-the-package-identifier-every-time/78186 "2022-03-24T17:32:14Z")

</div>

Hello everyone, I was wondering if there was a way to avoid conflicts with a function name between packages without using the package identifier every time. To explain what I mean, when I write the following: using Dat…

---

## [Evaluating a local function within the global namespace](https://discourse.julialang.org/t/evaluating-a-local-function-within-the-global-namespace/78403)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 5\
**Last updated:** [March 24, 2022, 4:59pm UTC](https://discourse.julialang.org/t/evaluating-a-local-function-within-the-global-namespace/78403 "2022-03-24T16:59:39Z")

</div>

Hi. I’ve written a tutoral program in which students submit an answer ans to an exercise using the format reply(ans). reply then passes ans deeper into a module within which ans is tested for correctness. The thing is, t…

---

## [A function for iterables like Clojure's reductions](https://discourse.julialang.org/t/a-function-for-iterables-like-clojures-reductions/78407)

<div class="topic-metadata">

**Author:** [@bwanab](https://discourse.julialang.org/u/bwanab)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 4:23pm UTC](https://discourse.julialang.org/t/a-function-for-iterables-like-clojures-reductions/78407 "2022-03-24T16:23:12Z")

</div>

I’ve searched, believe me, but every language calls it something different. In Clojure, it’s reductions, in APL it’s . It works like reduce, but where reduce reduces to one value, it returns all the intermediate values l…

---

## [Differentialequations.jl - modify \`u\` in \`f\` possible without callback?](https://discourse.julialang.org/t/differentialequations-jl-modify-u-in-f-possible-without-callback/78335)

<div class="topic-metadata">

**Author:** [@fabern](https://discourse.julialang.org/u/fabern)\
**Replies:** 4\
**Last updated:** [March 24, 2022, 3:19pm UTC](https://discourse.julialang.org/t/differentialequations-jl-modify-u-in-f-possible-without-callback/78335 "2022-03-24T15:19:52Z")

</div>

Dear all, I’m wondering if it is possible to set the value of some states to a known value from within the rhs-function f? E.g. by setting u to the desired value and du to 0. Without modfication of u it seems difficult …

---

## [Compatibility specification with version number and package location?](https://discourse.julialang.org/t/compatibility-specification-with-version-number-and-package-location/78343)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 7\
**Last updated:** [March 24, 2022, 2:57pm UTC](https://discourse.julialang.org/t/compatibility-specification-with-version-number-and-package-location/78343 "2022-03-24T14:57:15Z")

</div>

If I’m developing PkgA and have a dependency to a package that I’ve forked from github (and exists in the general registry) and I add this package to my Project.toml with pkg\>add http://github.com/ForkedPackage.jl How …

---

## [How to save a structure instance (inside module) in JLD2, to load it later correctly?](https://discourse.julialang.org/t/how-to-save-a-structure-instance-inside-module-in-jld2-to-load-it-later-correctly/78339)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 10\
**Last updated:** [March 24, 2022, 2:11pm UTC](https://discourse.julialang.org/t/how-to-save-a-structure-instance-inside-module-in-jld2-to-load-it-later-correctly/78339 "2022-03-24T14:11:19Z")

</div>

What should I add in initilizeFile.jl to make readingFile.jl gives the type of Sim as Simulation not JLD2.ReconstructedTypes.var"##Main.readApp.Simulation#292"(2.0, 4.0) with warning? initilizeFile.jl is: module readAp…

---

## [What is the better way to make a countplot?](https://discourse.julialang.org/t/what-is-the-better-way-to-make-a-countplot/78364)

<div class="topic-metadata">

**Author:** [@folleyz](https://discourse.julialang.org/u/folleyz)\
**Replies:** 4\
**Last updated:** [March 24, 2022, 11:10am UTC](https://discourse.julialang.org/t/what-is-the-better-way-to-make-a-countplot/78364 "2022-03-24T11:10:58Z")

</div>

Hi everybody! I’m trying to make a countplot with StatsPlots, and i’m using the code below, that works, but i want to know if have a simplest or clever way to achieve this. begin @df df Plots.bar(unique(df.Gender), \[c…

---

## [MLDatasets.jl make GitHub CI failing](https://discourse.julialang.org/t/mldatasets-jl-make-github-ci-failing/78356)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [March 24, 2022, 10:28am UTC](https://discourse.julialang.org/t/mldatasets-jl-make-github-ci-failing/78356 "2022-03-24T10:28:34Z")

</div>

Hello, my call to MLDatasets.MNIST.traindata() make my CI action to fail because of the interactive part. Isn’t there any option to get a non-interactive version?

---

## [Eltype and dimensions from function definition](https://discourse.julialang.org/t/eltype-and-dimensions-from-function-definition/78374)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 6\
**Last updated:** [March 24, 2022, 9:52am UTC](https://discourse.julialang.org/t/eltype-and-dimensions-from-function-definition/78374 "2022-03-24T09:52:50Z")

</div>

I would like to use a matrix function as basis for defining more complex structures. For this, I need to determine cheaply the eltype of the result and the dimensions. To be concrete, I have a matrix function defined as …

---

## [Removing duplicate legend items](https://discourse.julialang.org/t/removing-duplicate-legend-items/78348)

<div class="topic-metadata">

**Author:** [@b-fg](https://discourse.julialang.org/u/b-fg)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 8:28am UTC](https://discourse.julialang.org/t/removing-duplicate-legend-items/78348 "2022-03-24T08:28:04Z")

</div>

In Plots.jl, is it possible to scan the Plot object legend items so I can remove the ones that are duplicated? Thanks!

---

## [Can I syntax-highlight matlab code block with Documenter.jl](https://discourse.julialang.org/t/can-i-syntax-highlight-matlab-code-block-with-documenter-jl/78373)

<div class="topic-metadata">

**Author:** [@jorgepz](https://discourse.julialang.org/u/jorgepz)\
**Replies:** 0\
**Last updated:** [March 24, 2022, 8:25am UTC](https://discourse.julialang.org/t/can-i-syntax-highlight-matlab-code-block-with-documenter-jl/78373 "2022-03-24T08:25:13Z")

</div>

Me and some colleagues are using Documenter.jl to document a Matlab/Octave package (which will be migrated to Julia in some near future) and the result has been excellent Home · ONSAS.m I was wondering if would it be po…

---

## [Avoid runtime dispatch when overloading \`isless()\`](https://discourse.julialang.org/t/avoid-runtime-dispatch-when-overloading-isless/78366)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 2\
**Last updated:** [March 24, 2022, 8:22am UTC](https://discourse.julialang.org/t/avoid-runtime-dispatch-when-overloading-isless/78366 "2022-03-24T08:22:28Z")

</div>

I have been learning to use JET.jl to improve the performance of my code. I am still getting familiar with its output. I would appreciate some help understanding why the function below produces a runtime dispatch warning…

---

## [Windows Visual Studio c++ data live plotting onto Julia](https://discourse.julialang.org/t/windows-visual-studio-c-data-live-plotting-onto-julia/78371)

<div class="topic-metadata">

**Author:** [@particlereddy](https://discourse.julialang.org/u/particlereddy)\
**Replies:** 0\
**Last updated:** [March 24, 2022, 2:23am UTC](https://discourse.julialang.org/t/windows-visual-studio-c-data-live-plotting-onto-julia/78371 "2022-03-24T02:23:53Z")

</div>

Hi, New to Julia. project: visual studio c++ code OS: windows 64-bit \[1\] I have around 136 data variables and wanted to plot them real-time \[in series\]. \[2\] updation rate of each variable is 100millisecond. Is ther…

---

## [Expectation(mean) of a discrete random variable](https://discourse.julialang.org/t/expectation-mean-of-a-discrete-random-variable/78359)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 5\
**Last updated:** [March 24, 2022, 12:25am UTC](https://discourse.julialang.org/t/expectation-mean-of-a-discrete-random-variable/78359 "2022-03-24T00:25:08Z")

</div>

Hello, good evening. I’am reading a book about statistics and got the equation the expectation or mean of a discrete random variable as: by the book the result is 1.25 But in package Statistics or Distributions, the…

---

## [How to plot histogram subplots of a DataFrame?](https://discourse.julialang.org/t/how-to-plot-histogram-subplots-of-a-dataframe/78355)

<div class="topic-metadata">

**Author:** [@folleyz](https://discourse.julialang.org/u/folleyz)\
**Replies:** 11\
**Last updated:** [March 23, 2022, 11:40pm UTC](https://discourse.julialang.org/t/how-to-plot-histogram-subplots-of-a-dataframe/78355 "2022-03-23T23:40:54Z")

</div>

Hello Everybody! I have a question, i’m refatoring my old python projects to Julia and i have a doubt in a situation. Looks how i plot using python matplotlib: df.hist(figsize=(12,10)); And now using Julia StatsP…

---

## [Optional Keyword arguments](https://discourse.julialang.org/t/optional-keyword-arguments/78353)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [March 23, 2022, 9:40pm UTC](https://discourse.julialang.org/t/optional-keyword-arguments/78353 "2022-03-23T21:40:33Z")

</div>

I am exploring how to use optional keyword arguments. I understand the syntax of giving the argument a default value in the function call statement. However, it must be possible to give default values without putting t…

---

## [Generic interface to iterate over stored elements of array?](https://discourse.julialang.org/t/generic-interface-to-iterate-over-stored-elements-of-array/77867)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [March 23, 2022, 8:26pm UTC](https://discourse.julialang.org/t/generic-interface-to-iterate-over-stored-elements-of-array/77867 "2022-03-23T20:26:41Z")

</div>

I’m playing with making a simple optimization package generic to any type of input. It is already generic to inputs in the form vectors, matrices, number types (precision), units, etc. But I could not yet make it generi…

---

## [Solving block matrix system with factorized blocks](https://discourse.julialang.org/t/solving-block-matrix-system-with-factorized-blocks/78351)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 0\
**Last updated:** [March 23, 2022, 8:14pm UTC](https://discourse.julialang.org/t/solving-block-matrix-system-with-factorized-blocks/78351 "2022-03-23T20:14:31Z")

</div>

Is there are package that can construct a block matrix A with pre-factorized blocks, and make use of the factorization to solve Ax=b? BlockArrays.jl seems able to use \\ but not factorized blocks, BlockFactorizations.jl …

---

## [Trying to sample my Gaussian Process with MCMC](https://discourse.julialang.org/t/trying-to-sample-my-gaussian-process-with-mcmc/78342)

<div class="topic-metadata">

**Author:** [@mirror63](https://discourse.julialang.org/u/mirror63)\
**Replies:** 1\
**Last updated:** [March 23, 2022, 7:02pm UTC](https://discourse.julialang.org/t/trying-to-sample-my-gaussian-process-with-mcmc/78342 "2022-03-23T19:02:36Z")

</div>

Hello I am using GuassianProcessess.jl, I have been looking at their tutorial (Simple GP Regression · GaussianProcesses.jl) and implement it. Likewise, I want to implement a kernel with summing its value. Now I would lik…

---

## [Package change registered web address](https://discourse.julialang.org/t/package-change-registered-web-address/78338)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 2\
**Last updated:** [March 23, 2022, 5:57pm UTC](https://discourse.julialang.org/t/package-change-registered-web-address/78338 "2022-03-23T17:57:25Z")

</div>

I have a package thatt is already registered. It is located on github. However, I want to change github web address to point to a different organization. I want to move CanDecomp.jl from https://github.com/TensorDecomp…

---

## [Warning: type does not exist in workspace; reconstructing](https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 1\
**Last updated:** [March 22, 2022, 8:11am UTC](https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232 "2022-03-22T08:11:22Z")

</div>

I was using the below code to create .jld2 file containing an instance Sim of structure Simulation include("./SimulationStructure.jl"); function appFunction() Sim = Simulation(); io = open("$(@\_\_DIR\_\_)/generatedElements…

---

## [Choose different behavior depending on possible arguments of user-defined function](https://discourse.julialang.org/t/choose-different-behavior-depending-on-possible-arguments-of-user-defined-function/78321)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 6\
**Last updated:** [March 23, 2022, 4:39pm UTC](https://discourse.julialang.org/t/choose-different-behavior-depending-on-possible-arguments-of-user-defined-function/78321 "2022-03-23T16:39:38Z")

</div>

A pattern I encounter every once in a while is that I want a user to be able to pass a function to one of my package’s functions. Then I’d like to do different things with this function depending on what arguments it can…

---

## [Differentialequations.jl - Solving ODE with time dependent parameter allocation friendly](https://discourse.julialang.org/t/differentialequations-jl-solving-ode-with-time-dependent-parameter-allocation-friendly/78284)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 2\
**Last updated:** [March 23, 2022, 4:08pm UTC](https://discourse.julialang.org/t/differentialequations-jl-solving-ode-with-time-dependent-parameter-allocation-friendly/78284 "2022-03-23T16:08:14Z")

</div>

Dear all, I am using DifferentialEquations.jl to solve a standard SEIR Model. The ODE looks like this: using DifferentialEquations using BenchmarkTools, UnPack function seir\_ode!(du,u,p,t) (S,E,I,R,C) = u (β,γ…

---

## [RAM needed to initialise large matrices](https://discourse.julialang.org/t/ram-needed-to-initialise-large-matrices/78302)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 31\
**Last updated:** [March 23, 2022, 1:50pm UTC](https://discourse.julialang.org/t/ram-needed-to-initialise-large-matrices/78302 "2022-03-23T13:50:00Z")

</div>

Hi, I have a basic doubt on memory management. I am currently working on a high-dimensional problem in which I would need to use a handful of matrices with size 500,000 x 500,000. I was wondering how much ram is needed t…

---

## [Updated CSV reader benchmarks?](https://discourse.julialang.org/t/updated-csv-reader-benchmarks/78331)

<div class="topic-metadata">

**Author:** [@Philogicatician](https://discourse.julialang.org/u/Philogicatician)\
**Replies:** 4\
**Last updated:** [March 23, 2022, 1:32pm UTC](https://discourse.julialang.org/t/updated-csv-reader-benchmarks/78331 "2022-03-23T13:32:30Z")

</div>

An update for Julia 1.7.2 on Jupyter notebooks:

---

## [CSV Reader Benchmarks: Julia Reads CSVs 10-20x Faster than Python and R](https://discourse.julialang.org/t/csv-reader-benchmarks-julia-reads-csvs-10-20x-faster-than-python-and-r/41974)

<div class="topic-metadata">

**Author:** [@oheil](https://discourse.julialang.org/u/oheil)\
**Replies:** 67\
**Last updated:** [December 2, 2020, 3:51pm UTC](https://discourse.julialang.org/t/csv-reader-benchmarks-julia-reads-csvs-10-20x-faster-than-python-and-r/41974 "2020-12-02T15:51:24Z")

</div>

This is huge! For non germans it is about recent performance boosts in Julia 1.4 and refers mainly to the following Blog CSV Reader Benchmarks: Julia Reads CSVs 10-20x Faster than Python and R - JuliaHub (blog url up…

---

## [Help with understanding Mutating arrays error in a Flux model](https://discourse.julialang.org/t/help-with-understanding-mutating-arrays-error-in-a-flux-model/78295)

<div class="topic-metadata">

**Author:** [@linkz](https://discourse.julialang.org/u/linkz)\
**Replies:** 3\
**Last updated:** [March 23, 2022, 11:17am UTC](https://discourse.julialang.org/t/help-with-understanding-mutating-arrays-error-in-a-flux-model/78295 "2022-03-23T11:17:59Z")

</div>

I am trying to train a custom DiffEqFlux neural ODE model and wanting to use parts of the solution in a regularization term. I wrote the following brief function: function gen\_penalty(arr, similarity) …

---

## [Faster zeros with calloc](https://discourse.julialang.org/t/faster-zeros-with-calloc/69860)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 26\
**Last updated:** [March 23, 2022, 9:47am UTC](https://discourse.julialang.org/t/faster-zeros-with-calloc/69860 "2022-03-23T09:47:20Z")

</div>

Abstract TL; DR zeros\_via\_calloc is a potentially faster version of zeros that is comparable to Array{T}(undef, ...) and numpy.zeros. function zeros\_via\_calloc(::Type{T}, dims::Integer...) where T ptr = Ptr{T}(Libc.c…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=467)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=469)
