# General Usage

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

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

**Page:** 664

---

## [Issues in using Econometrics package](https://discourse.julialang.org/t/issues-in-using-econometrics-package/52372)

<div class="topic-metadata">

**Author:** [@j\_mtuba](https://discourse.julialang.org/u/j_mtuba)\
**Replies:** 3\
**Last updated:** [December 25, 2020, 9:20pm UTC](https://discourse.julialang.org/t/issues-in-using-econometrics-package/52372 "2020-12-25T21:20:40Z")

</div>

I just started using julia-1.5.3 on my Linux machine (Pop!\_OS 20.10). I cloned https://github.com/mcreel/Econometrics in order to add the package to Julia. Afterwards I did “using Econometrics” to use the package. I got …

---

## [Sort rows and columns of NamedArray](https://discourse.julialang.org/t/sort-rows-and-columns-of-namedarray/52374)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 5\
**Last updated:** [December 25, 2020, 7:38pm UTC](https://discourse.julialang.org/t/sort-rows-and-columns-of-namedarray/52374 "2020-12-25T19:38:14Z")

</div>

I am working with a frequency table that is based on a NamedArray. I am having trouble reverse sorting the dimensions. Here is an example: n = NamedArray(\[1 3; 2 4\], ( \["a", "b"\], \["c", "d"\] ), ("Rows", "Cols")) Result…

---

## [Include programmatically generated julia file](https://discourse.julialang.org/t/include-programmatically-generated-julia-file/52373)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 3\
**Last updated:** [December 25, 2020, 3:47pm UTC](https://discourse.julialang.org/t/include-programmatically-generated-julia-file/52373 "2020-12-25T15:47:51Z")

</div>

Hi! My question is about a good way to include programmatically generated julia file . The example is the following: I have a pkg X which generates julia models (functions or DSL-macros) from some external source file…

---

## [A data struct is required almost all sub functions](https://discourse.julialang.org/t/a-data-struct-is-required-almost-all-sub-functions/52360)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 3\
**Last updated:** [December 25, 2020, 11:06am UTC](https://discourse.julialang.org/t/a-data-struct-is-required-almost-all-sub-functions/52360 "2020-12-25T11:06:25Z")

</div>

Merry Christmas, everyone. I have a struct containing all data required for running an algorithm to solve the problem, say: struct ProblemData x :: Float64 y :: Vector{Float64} z :: Matrix{Float64} end Thi…

---

## [Why does shuffling rows change the estimates?](https://discourse.julialang.org/t/why-does-shuffling-rows-change-the-estimates/52305)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [December 25, 2020, 7:15am UTC](https://discourse.julialang.org/t/why-does-shuffling-rows-change-the-estimates/52305 "2020-12-25T07:15:44Z")

</div>

This is a small model with fake data in a linear regression. Unexpectedly, shuffling the rows of the dataframe changes the estimates. import Random using DataFrames using Pipe: @pipe using StatsBase: StatsBase, mad, med…

---

## [Two almost identical image convolve function different results](https://discourse.julialang.org/t/two-almost-identical-image-convolve-function-different-results/52353)

<div class="topic-metadata">

**Author:** [@zshen0x](https://discourse.julialang.org/u/zshen0x)\
**Replies:** 0\
**Last updated:** [December 24, 2020, 11:49pm UTC](https://discourse.julialang.org/t/two-almost-identical-image-convolve-function-different-results/52353 "2020-12-24T23:49:22Z")

</div>

I think I have these two identical function (the difference is using acc inside a loop or not) function convolve\_image\_bad(M::AbstractMatrix, K::AbstractMatrix) M′ = zero(M) nrow, ncol = size(M) lr, lc = size(K) .÷ 2…

---

## [How to adjust file modification times?](https://discourse.julialang.org/t/how-to-adjust-file-modification-times/52337)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 3\
**Last updated:** [December 24, 2020, 9:00pm UTC](https://discourse.julialang.org/t/how-to-adjust-file-modification-times/52337 "2020-12-24T21:00:58Z")

</div>

How do I change the modification time of a file to a prespecified time other than by going something like run(touch ....) ? I know there is a touch command in Julia, but it only sets it to the current time.

---

## [Array of heterogeneous named tuples to DataFrame](https://discourse.julialang.org/t/array-of-heterogeneous-named-tuples-to-dataframe/52339)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [December 24, 2020, 8:45pm UTC](https://discourse.julialang.org/t/array-of-heterogeneous-named-tuples-to-dataframe/52339 "2020-12-24T20:45:18Z")

</div>

Hi all- I would like to convert an array of named tuples to a dataframe. This can be achieved with the DataFrame constructor when the named tuples have the same keys. However, in my case, the named tuples do not necessa…

---

## [Save figure in eps or pdf using Plots pyplot() or gr()](https://discourse.julialang.org/t/save-figure-in-eps-or-pdf-using-plots-pyplot-or-gr/52330)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 1\
**Last updated:** [December 24, 2020, 5:16pm UTC](https://discourse.julialang.org/t/save-figure-in-eps-or-pdf-using-plots-pyplot-or-gr/52330 "2020-12-24T17:16:20Z")

</div>

I am trying to save a plot with scatter,marketcolors, etc etc… in either pdf or eps, but I can only save in png. If the extension is pdf or eps the code crashes with pyplot() or it fails at plotting the minus sign in fr…

---

## [Anything like C++ std::includes?](https://discourse.julialang.org/t/anything-like-c-std-includes/52288)

<div class="topic-metadata">

**Author:** [@phendric](https://discourse.julialang.org/u/phendric)\
**Replies:** 15\
**Last updated:** [December 24, 2020, 5:03pm UTC](https://discourse.julialang.org/t/anything-like-c-std-includes/52288 "2020-12-24T17:03:44Z")

</div>

Question: does Julia have an analog to C++'s std::includes? issubset doesn’t do what I’m looking for (I want following to return false, as the first array isn’t a sub-array of the 2nd): julia\> issubset(\[4,4,1\],\[1,4,2\])…

---

## [Trouble with macro expression escaping](https://discourse.julialang.org/t/trouble-with-macro-expression-escaping/52312)

<div class="topic-metadata">

**Author:** [@Volker\_Weissmann](https://discourse.julialang.org/u/Volker_Weissmann)\
**Replies:** 3\
**Last updated:** [December 24, 2020, 4:32pm UTC](https://discourse.julialang.org/t/trouble-with-macro-expression-escaping/52312 "2020-12-24T16:32:35Z")

</div>

This code: macro mymacro(ast) println("ast outside = ", ast, "---\\n") :(function generated() println("ast inside = ", $ast, "---\\n") end ) end @mymacro function func() return 123 end genera…

---

## [Converting QRCompactWY.Q to Array changes its size](https://discourse.julialang.org/t/converting-qrcompactwy-q-to-array-changes-its-size/52291)

<div class="topic-metadata">

**Author:** [@dstahlke](https://discourse.julialang.org/u/dstahlke)\
**Replies:** 6\
**Last updated:** [December 24, 2020, 4:21pm UTC](https://discourse.julialang.org/t/converting-qrcompactwy-q-to-array-changes-its-size/52291 "2020-12-24T16:21:30Z")

</div>

I’m trying to convert the Q matrix from a QR transform into an Array. But it changes size. Is this a bug or am I doing it wrong? julia\> size(qr(ones(9,5)).Q) (9, 9) julia\> size(Array(qr(ones(9,5)).Q)) (9, 5) Motivat…

---

## [Need to plot high resolution time series data](https://discourse.julialang.org/t/need-to-plot-high-resolution-time-series-data/52316)

<div class="topic-metadata">

**Author:** [@Zaim\_Awang](https://discourse.julialang.org/u/Zaim_Awang)\
**Replies:** 11\
**Last updated:** [December 24, 2020, 3:35pm UTC](https://discourse.julialang.org/t/need-to-plot-high-resolution-time-series-data/52316 "2020-12-24T15:35:48Z")

</div>

I have successfully created a time series plot using timeseries.jl, with Version 1.5.3 (2020-11-09), in Juno, installed with JuliaPro, with the following code ATTEMPT 1: using IterableTables using DataFrames using CSV …

---

## [LightGraphs for Luby's algorithm](https://discourse.julialang.org/t/lightgraphs-for-lubys-algorithm/52306)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 1\
**Last updated:** [December 24, 2020, 12:12pm UTC](https://discourse.julialang.org/t/lightgraphs-for-lubys-algorithm/52306 "2020-12-24T12:12:46Z")

</div>

I am trying to use the LightGraphs and associated packages to implement Maximal-Independent-Set algorithms: Luby, Blelloch Both algorithms work by iterating over vertices and based on a relation between a vertex and its…

---

## [NLsolve not able to render solution](https://discourse.julialang.org/t/nlsolve-not-able-to-render-solution/52319)

<div class="topic-metadata">

**Author:** [@bhaveshshrimali](https://discourse.julialang.org/u/bhaveshshrimali)\
**Replies:** 2\
**Last updated:** [December 24, 2020, 7:41am UTC](https://discourse.julialang.org/t/nlsolve-not-able-to-render-solution/52319 "2020-12-24T07:41:37Z")

</div>

Hi everyone, I am trying to use NLsolve to solve a nonlinear equation and trying to compare it with scipy.optimize.root. However, as usual, the solver isn’t rendering the solution and my guess is that I am not using it …

---

## [Addressing raw string syntax and semantics for Julia 2.0?](https://discourse.julialang.org/t/addressing-raw-string-syntax-and-semantics-for-julia-2-0/51343)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 58\
**Last updated:** [December 23, 2020, 11:16pm UTC](https://discourse.julialang.org/t/addressing-raw-string-syntax-and-semantics-for-julia-2-0/51343 "2020-12-23T23:16:45Z")

</div>

This discussion (as of December 17th) is now arguing a paired delimiter (such as double-angle brackets ⟪...⟫) could offer improved semantics for raw strings, used by regular expressions and other string notations, by neg…

---

## [Working setup for emacs org-mode](https://discourse.julialang.org/t/working-setup-for-emacs-org-mode/41574)

<div class="topic-metadata">

**Author:** [@Chen](https://discourse.julialang.org/u/Chen)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 11:07pm UTC](https://discourse.julialang.org/t/working-setup-for-emacs-org-mode/41574 "2020-12-23T23:07:33Z")

</div>

I am confused when reading posts that used ob-emacs or ESS. Could someone post a .emacs setup that works? The idea is to write Julia codes in emacs org-mode and run the codes there. Thanks!

---

## [Change array type in mutating function?](https://discourse.julialang.org/t/change-array-type-in-mutating-function/52284)

<div class="topic-metadata">

**Author:** [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 6:44pm UTC](https://discourse.julialang.org/t/change-array-type-in-mutating-function/52284 "2020-12-23T18:44:26Z")

</div>

I am trying to define some simple functions for 2-D and 3-D rotations, and I would like to define a mutating version as well. This function function rotate!(r, θ) r\[:\] = exp(θ\*\[0 1 ; -1 0\])\*r end works for arrays o…

---

## [Array cumulation](https://discourse.julialang.org/t/array-cumulation/52287)

<div class="topic-metadata">

**Author:** [@danicaratelli](https://discourse.julialang.org/u/danicaratelli)\
**Replies:** 4\
**Last updated:** [December 23, 2020, 5:43pm UTC](https://discourse.julialang.org/t/array-cumulation/52287 "2020-12-23T17:43:37Z")

</div>

Hello, I am trying to, quickly, accumulate an array without over-riding previous allocations. In particular consider the following example: B = zeros(2,2); A = \[0.1 0.3; 0.2 0.5\]; idx = \[1 1; 1 1\]; I would like to add…

---

## [Parallel Julia's self computing](https://discourse.julialang.org/t/parallel-julias-self-computing/52282)

<div class="topic-metadata">

**Author:** [@marllos](https://discourse.julialang.org/u/marllos)\
**Replies:** 9\
**Last updated:** [December 23, 2020, 4:32pm UTC](https://discourse.julialang.org/t/parallel-julias-self-computing/52282 "2020-12-23T16:32:28Z")

</div>

When I run a longer Julia code, I notice that the 24 cores of the computer are operating. Is this because Julia is running my code with parallel computing? Thanks.

---

## [Style recommendation for enum as type](https://discourse.julialang.org/t/style-recommendation-for-enum-as-type/46078)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 5\
**Last updated:** [December 23, 2020, 2:45pm UTC](https://discourse.julialang.org/t/style-recommendation-for-enum-as-type/46078 "2020-12-23T14:45:28Z")

</div>

Julia documentation states: If a type is effectively an enumeration, it should be defined as a single (ideally immutable struct or primitive) type, with the enumeration values being instances of it. Why? How strong …

---

## [Julia simple String process and file I/O is slow](https://discourse.julialang.org/t/julia-simple-string-process-and-file-i-o-is-slow/52112)

<div class="topic-metadata">

**Author:** [@vedasulo](https://discourse.julialang.org/u/vedasulo)\
**Replies:** 12\
**Last updated:** [December 23, 2020, 2:43pm UTC](https://discourse.julialang.org/t/julia-simple-string-process-and-file-i-o-is-slow/52112 "2020-12-23T14:43:07Z")

</div>

I was doing i/o in julia from string. Code as follows function func(strd) a = Any\[\]; for url in split(replace(strd, "\\n" =\> ""), "✖") if occursin(".",url) push!(a, url); end end …

---

## [Track memory usage](https://discourse.julialang.org/t/track-memory-usage/52158)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 14\
**Last updated:** [December 23, 2020, 2:29pm UTC](https://discourse.julialang.org/t/track-memory-usage/52158 "2020-12-23T14:29:28Z")

</div>

Is there a package/function that I can use to see, track, log, and/or diagnose the memory usage of variables? I’m serving a website with JSServe and WGLMakie, and after a few hours of usage I get OutOfMemory errors. My …

---

## [Find number of digits in a non-integer number?](https://discourse.julialang.org/t/find-number-of-digits-in-a-non-integer-number/37445)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 15\
**Last updated:** [December 23, 2020, 8:13am UTC](https://discourse.julialang.org/t/find-number-of-digits-in-a-non-integer-number/37445 "2020-12-23T08:13:16Z")

</div>

Hello! Say I have four numbers; 1.0 0.5 0.05 0.065 I want to know how far I have to go before I hit the first non-zero value. So in this case; For 1 I would not have to move, so I expect to get output, 0 For 0.5 I wo…

---

## [Why does every module contain a link to Main in the REPL?](https://discourse.julialang.org/t/why-does-every-module-contain-a-link-to-main-in-the-repl/52274)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [December 23, 2020, 1:51pm UTC](https://discourse.julialang.org/t/why-does-every-module-contain-a-link-to-main-in-the-repl/52274 "2020-12-23T13:51:36Z")

</div>

julia\> module foo end Main.foo julia\> foo.Main Main julia\> foo.Main.foo.Main.foo === foo true julia\> x = 4 4 julia\> Main.x 4 julia\> foo.Main.x 4 Not quite sure why foo contains Main?

---

## [Difference between "using x" vs "using .x" or "using Main.x"](https://discourse.julialang.org/t/difference-between-using-x-vs-using-x-or-using-main-x/52269)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [December 23, 2020, 1:13pm UTC](https://discourse.julialang.org/t/difference-between-using-x-vs-using-x-or-using-main-x/52269 "2020-12-23T13:13:50Z")

</div>

Got curious about this behaviour: \] add DataFrames # if needed using .DataFrames # not ok using Main.DataFrames # not ok using DataFrames # ok using .DataFrames # now ok using Main.DataFrames # now ok…

---

## [Access elements in an array that are not contiguous](https://discourse.julialang.org/t/access-elements-in-an-array-that-are-not-contiguous/52262)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 2\
**Last updated:** [December 23, 2020, 8:07am UTC](https://discourse.julialang.org/t/access-elements-in-an-array-that-are-not-contiguous/52262 "2020-12-23T08:07:30Z")

</div>

i have some array like this x=\[2, 1, 1, 0, 1, 0, 1, 0\] and i want to show only the first two elements and the last two elements of the array but when i do this x\[1:2 & 7:8\] it shows me this : 4-element Array{Int64,1}: …

---

## [Promote\_type issues for nested Dual structures](https://discourse.julialang.org/t/promote-type-issues-for-nested-dual-structures/52255)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 0\
**Last updated:** [December 23, 2020, 3:09am UTC](https://discourse.julialang.org/t/promote-type-issues-for-nested-dual-structures/52255 "2020-12-23T03:09:26Z")

</div>

Hey all— I’m trying to write some manually specialized derivatives for a function so that they will play nicely with ForwardDiff, and I’m coming into some issues with second derivatives (no surprises with first derivati…

---

## [My Julia function never runs](https://discourse.julialang.org/t/my-julia-function-never-runs/52248)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 7\
**Last updated:** [December 23, 2020, 2:21am UTC](https://discourse.julialang.org/t/my-julia-function-never-runs/52248 "2020-12-23T02:21:51Z")

</div>

Hello, I’m currently working on this package. When I try to run the main function nothing happens. julia\> y=\[0,0,1,1,1\] julia\> X = \[1 -2; 1 -1; 1 0; 1 1; 1 2\] julia\> fidSampleLR(y, X, 5) There’s a println at the firs…

---

## [Is it possible to solve "convex" neural network using \`Convex.jl\`?](https://discourse.julialang.org/t/is-it-possible-to-solve-convex-neural-network-using-convex-jl/52219)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 5\
**Last updated:** [December 23, 2020, 2:09am UTC](https://discourse.julialang.org/t/is-it-possible-to-solve-convex-neural-network-using-convex-jl/52219 "2020-12-23T02:09:43Z")

</div>

Hi, I’m trying to solve a convex optimisation. More specifically, I build a neural network NN(x, y), which is convex in argument y. Such neural network can be constructed as suggested in Input Convex Neural Networks. S…

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

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