# General Usage

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

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

**Page:** 482

---

## [LoadError: MethodError: no method matching abs2(::Expression)](https://discourse.julialang.org/t/loaderror-methoderror-no-method-matching-abs2-expression/76764)

<div class="topic-metadata">

**Author:** [@luisgarciapuente](https://discourse.julialang.org/u/luisgarciapuente)\
**Replies:** 10\
**Last updated:** [February 20, 2022, 4:39am UTC](https://discourse.julialang.org/t/loaderror-methoderror-no-method-matching-abs2-expression/76764 "2022-02-20T04:39:12Z")

</div>

I am new to Julia. My collaborators sent me some code that do run for them but I cannot run it myself. We cannot figure out what is wrong since the code does run for them. I tried two different computers, and versions 1.…

---

## [Lag vector by group using another vector as the grouping variable](https://discourse.julialang.org/t/lag-vector-by-group-using-another-vector-as-the-grouping-variable/76766)

<div class="topic-metadata">

**Author:** [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Replies:** 4\
**Last updated:** [February 20, 2022, 1:46am UTC](https://discourse.julialang.org/t/lag-vector-by-group-using-another-vector-as-the-grouping-variable/76766 "2022-02-20T01:46:55Z")

</div>

Hello everyone, I was wondering if it were possible to lag a vector by group, when the grouping variable is a separate vector. Here’s a minimum working example: firm\_id = \["A", "A", "A", "A", "B", "B", "B", "B"\] reve…

---

## [Easiest way to "compile" program to single file](https://discourse.julialang.org/t/easiest-way-to-compile-program-to-single-file/76616)

<div class="topic-metadata">

**Author:** [@peteole](https://discourse.julialang.org/u/peteole)\
**Replies:** 6\
**Last updated:** [February 19, 2022, 10:38pm UTC](https://discourse.julialang.org/t/easiest-way-to-compile-program-to-single-file/76616 "2022-02-19T22:38:23Z")

</div>

Hi, I have the following issue: I want to use julia at a coding competition: https://codingcompetitions.withgoogle.com/kickstart It works fine for old problems. However there is the issue that sometimes I want to use …

---

## [Issues implementing a simple Stan example](https://discourse.julialang.org/t/issues-implementing-a-simple-stan-example/75985)

<div class="topic-metadata">

**Author:** [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Replies:** 33\
**Last updated:** [February 19, 2022, 9:14pm UTC](https://discourse.julialang.org/t/issues-implementing-a-simple-stan-example/75985 "2022-02-19T21:14:46Z")

</div>

Hi everyone, I am following the example posted here: https://github.com/StanJulia/StanSample.jl/blob/master/example/keyword\_bernoulli.jl When I get to the following line of code I get an error: sm = SampleModel("test…

---

## [Index of a grid](https://discourse.julialang.org/t/index-of-a-grid/76771)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 8\
**Last updated:** [February 19, 2022, 7:53pm UTC](https://discourse.julialang.org/t/index-of-a-grid/76771 "2022-02-19T19:53:57Z")

</div>

My goal is to find the index of a grid that meet certain criteria. For example, I have an X Y that is meshgridded together using the below function: X, Y = ndgrid(\[-180:1:180\], \[-90:1:90\]; So my Y will be like a matrix…

---

## [Recode multiple columns in DataFrame as integer](https://discourse.julialang.org/t/recode-multiple-columns-in-dataframe-as-integer/76699)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 8\
**Last updated:** [February 19, 2022, 10:06am UTC](https://discourse.julialang.org/t/recode-multiple-columns-in-dataframe-as-integer/76699 "2022-02-19T10:06:02Z")

</div>

Hi all, I want to recode symbols in a DataFrame as integers so I can use confusmat to create a confusion matrix. Here is what my DataFrame looks like: using DataFrames df = DataFrame(x = \[:a,:a,:b,:c,:c\], y = \[:b,:b,…

---

## [Gadfly labels overlap and are not readable](https://discourse.julialang.org/t/gadfly-labels-overlap-and-are-not-readable/76634)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 0\
**Last updated:** [February 17, 2022, 3:56pm UTC](https://discourse.julialang.org/t/gadfly-labels-overlap-and-are-not-readable/76634 "2022-02-17T15:56:39Z")

</div>

I am trying to plot a figure which very elongated. However, the Gadfly labels overlap and are not readable. See below: Gadfly.draw(Gadfly.PDF("a.pdf"), Gadfly.spy(rand(1000,10), Gadfly.Scale.y\_discrete(labels=i-\>string…

---

## [Shearlab in julia](https://discourse.julialang.org/t/shearlab-in-julia/76747)

<div class="topic-metadata">

**Author:** [@randino](https://discourse.julialang.org/u/randino)\
**Replies:** 1\
**Last updated:** [February 19, 2022, 2:08pm UTC](https://discourse.julialang.org/t/shearlab-in-julia/76747 "2022-02-19T14:08:40Z")

</div>

when I tested this step , it 's not work @time shearletSystem\_nopar = Shearlab.getshearletsystem2D(size(X\_nopar,1), size(X\_nopar,2), scales,shearLevels,full,directionalFilter,scalingFilter,0); help me plzz

---

## [Interpolate variable value inside macro call](https://discourse.julialang.org/t/interpolate-variable-value-inside-macro-call/76740)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 5\
**Last updated:** [February 19, 2022, 1:53pm UTC](https://discourse.julialang.org/t/interpolate-variable-value-inside-macro-call/76740 "2022-02-19T13:53:39Z")

</div>

I am trying to parse a file containing half-lives of nuclear isotopes. One of the columns contains the units of the half-life time as a string, and I would like to convert it into Unitful units. As an example, let’s say…

---

## [The active manifest file is an older format](https://discourse.julialang.org/t/the-active-manifest-file-is-an-older-format/72963)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 3\
**Last updated:** [February 19, 2022, 1:48pm UTC](https://discourse.julialang.org/t/the-active-manifest-file-is-an-older-format/72963 "2022-02-19T13:48:55Z")

</div>

How to solve this alert that appears during the update? julia\> VERSION v “1.7.0” Apparently I have not inherited correctly the packages from Julia 1.6.4 to Julia 1.7.0 !!! ┌ Warning: The active manifest file is an ol…

---

## [Julia in python](https://discourse.julialang.org/t/julia-in-python/76731)

<div class="topic-metadata">

**Author:** [@randino](https://discourse.julialang.org/u/randino)\
**Replies:** 6\
**Last updated:** [February 19, 2022, 12:17pm UTC](https://discourse.julialang.org/t/julia-in-python/76731 "2022-02-19T12:17:05Z")

</div>

I want to execute the juila in python , but the shearlab is not work plzz help me import warnings import julia import sys import pylab import Shearlab n = 512; mat\_fname\_gt = pjoin('./sample\_data/', 'barbara.jpg') data\_…

---

## [Why is \`sort(x, by = \_ -\> rand())\` not a good shuffler?](https://discourse.julialang.org/t/why-is-sort-x-by-rand-not-a-good-shuffler/76737)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 2\
**Last updated:** [February 19, 2022, 12:15pm UTC](https://discourse.julialang.org/t/why-is-sort-x-by-rand-not-a-good-shuffler/76737 "2022-02-19T12:15:11Z")

</div>

I learned this the hard way in that sort(x, by = \_ -\> rand()) is not a shuffler, i.e. x is not random enough after this shuffle. Using Random.shuffle is the correct way it seems. But why is sort(x, by = \_ -\> rand()) no…

---

## [How to work on a specific field of an vector of structure?](https://discourse.julialang.org/t/how-to-work-on-a-specific-field-of-an-vector-of-structure/76720)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 7\
**Last updated:** [February 18, 2022, 11:04pm UTC](https://discourse.julialang.org/t/how-to-work-on-a-specific-field-of-an-vector-of-structure/76720 "2022-02-18T23:04:18Z")

</div>

I have the below R instance of Rs structure. I want to work on a specific field of all rows (as dealing with Matrix). So, I am using R\[:\].I\[:\] but it gives an error. Any way to do that? Base.@kwdef mutable struct Rs …

---

## [Getting an error for FixedEffectModels](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498)

<div class="topic-metadata">

**Author:** [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Replies:** 12\
**Last updated:** [February 18, 2022, 6:58pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498 "2022-02-18T18:58:59Z")

</div>

Hello everyone, Recently I updated all my packages on Julia 1.6 via Pkg.update() and also \]up, and since then the regressions I had previously been running using FixedEffectModels.reg are not working anymore. Here’s a …

---

## [Why do take! and put! for channels allocate memory?](https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 1\
**Last updated:** [February 18, 2022, 6:00pm UTC](https://discourse.julialang.org/t/why-do-take-and-put-for-channels-allocate-memory/76513 "2022-02-18T18:00:20Z")

</div>

I ran a bunch of floats through some channels across threads to test it out and discovered that memory was being allocated during the process which seems odd. Increasing the count in the for loop increases the allocation…

---

## [@nloops, but for n-1 indices](https://discourse.julialang.org/t/nloops-but-for-n-1-indices/76595)

<div class="topic-metadata">

**Author:** [@jbshannon](https://discourse.julialang.org/u/jbshannon)\
**Replies:** 6\
**Last updated:** [February 18, 2022, 5:42pm UTC](https://discourse.julialang.org/t/nloops-but-for-n-1-indices/76595 "2022-02-18T17:42:01Z")

</div>

I’m writing a function where I want to use Base.Cartesian.@nloops to collect possible combinations of inputs, but the object I am creating has one index with a fixed value. Here is a function that does something similar …

---

## [Julia 1.9 (not yet downloadable) and 1.8](https://discourse.julialang.org/t/julia-1-9-not-yet-downloadable-and-1-8/76708)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [February 18, 2022, 4:30pm UTC](https://discourse.julialang.org/t/julia-1-9-not-yet-downloadable-and-1-8/76708 "2022-02-18T16:30:27Z")

</div>

I just downloaded the Julia nightly to get Julia 1.9-DEV that is now on master. 1.8-beta1 seems close. I actually get: | | |\_| | | | (\_| | | Version 1.8.0-DEV.1505 (2022-02-12) \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Commit e422…

---

## [Pluging: Julia | Dataiku](https://discourse.julialang.org/t/pluging-julia-dataiku/76709)

<div class="topic-metadata">

**Author:** [@SOFIA\_PEDRAZA](https://discourse.julialang.org/u/SOFIA_PEDRAZA)\
**Replies:** 5\
**Last updated:** [February 18, 2022, 5:10pm UTC](https://discourse.julialang.org/t/pluging-julia-dataiku/76709 "2022-02-18T17:10:40Z")

</div>

Hi, I had installed the pluging in DataIku to create and execute Julia recipes the same way you would use any other code recipes. It makes that a Julia kernel also becomes available for Jupyter notebooks. I am using the…

---

## [Call julia operator function \* from python](https://discourse.julialang.org/t/call-julia-operator-function-from-python/76691)

<div class="topic-metadata">

**Author:** [@kerim](https://discourse.julialang.org/u/kerim)\
**Replies:** 0\
**Last updated:** [February 18, 2022, 12:06pm UTC](https://discourse.julialang.org/t/call-julia-operator-function-from-python/76691 "2022-02-18T12:06:20Z")

</div>

Hi, If in julia I have a function: module MyModule function \*(a, b) a - b end end # module Is there a way to call that function from python using pyjulia?

---

## [Bug in LinearAlgebra pinv()](https://discourse.julialang.org/t/bug-in-linearalgebra-pinv/76663)

<div class="topic-metadata">

**Author:** [@rwyoung7](https://discourse.julialang.org/u/rwyoung7)\
**Replies:** 9\
**Last updated:** [February 18, 2022, 12:06pm UTC](https://discourse.julialang.org/t/bug-in-linearalgebra-pinv/76663 "2022-02-18T12:06:13Z")

</div>

A = \[1.0 0.0;0.0 1.0;0.0 0.0\] A1 = pinv(A): \[1.0 0.0 1.0;0.0 0.0 0.0\] wrong A1\*A \[1.0 0.0;0.0 0.0\] wrong A2 = inv(A’\*A)A’: \[1.0 0.0 0.0;0.0 1.0 0.0\] correct A2A \[1.0 0.0;0.0 1.0\] correct

---

## [Mysterious error message when terminating a HTTP.jl server](https://discourse.julialang.org/t/mysterious-error-message-when-terminating-a-http-jl-server/76687)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 0\
**Last updated:** [February 18, 2022, 10:13am UTC](https://discourse.julialang.org/t/mysterious-error-message-when-terminating-a-http-jl-server/76687 "2022-02-18T10:13:35Z")

</div>

Julia 1.7.2 HTTP.jl 0.9.17 I’m using HTTP.jl to write a microservice running on GCP Cloud Run. I noticed in the logs that when the process is terminated an error message shows up, apart from the “Terminated” message: s…

---

## [Subtypes (apparently) not defined within module](https://discourse.julialang.org/t/subtypes-apparently-not-defined-within-module/76669)

<div class="topic-metadata">

**Author:** [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Replies:** 1\
**Last updated:** [February 18, 2022, 3:16am UTC](https://discourse.julialang.org/t/subtypes-apparently-not-defined-within-module/76669 "2022-02-18T03:16:15Z")

</div>

I don’t understand why my function s1type works as expected but the same code coming from MyType module throws a subtypes not defined error. Any thoughts? function s1type(T::DataType) println("type:\\t\\t", T) pri…

---

## [How can I use strings containing whitespace in VegaLite?](https://discourse.julialang.org/t/how-can-i-use-strings-containing-whitespace-in-vegalite/76648)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 2\
**Last updated:** [February 18, 2022, 2:48am UTC](https://discourse.julialang.org/t/how-can-i-use-strings-containing-whitespace-in-vegalite/76648 "2022-02-18T02:48:33Z")

</div>

I want to create a heatmap using VegaLite. That is not hard to do if the name of the column containing the numeric data is well-behaved. This chart looks good: using DataFrames, VegaLite df = DataFrame( "AA" =\> rand(…

---

## [Simple formatting problem](https://discourse.julialang.org/t/simple-formatting-problem/76667)

<div class="topic-metadata">

**Author:** [@Bob\_Bass](https://discourse.julialang.org/u/Bob_Bass)\
**Replies:** 2\
**Last updated:** [February 18, 2022, 2:34am UTC](https://discourse.julialang.org/t/simple-formatting-problem/76667 "2022-02-18T02:34:54Z")

</div>

Hi. I’m working through “Julia Bit-By-Bit” and following is an exercise from chapter 2: You are required to print the values of the integer variables b , h and n . Write a statement which prints b with its rightmost d…

---

## [Project.toml specification for packages used via Requires](https://discourse.julialang.org/t/project-toml-specification-for-packages-used-via-requires/14806)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 5\
**Last updated:** [February 17, 2022, 10:47pm UTC](https://discourse.julialang.org/t/project-toml-specification-for-packages-used-via-requires/14806 "2022-02-17T22:47:50Z")

</div>

Hi all, I have a package that uses Requires to lazy-load other packages depending on the type of dataset the user is using. As per the Requires docs for v1.0, all uses of @require are contained in my packages \_\_init\_\_() …

---

## [Avoiding Vectors of Abstract Types](https://discourse.julialang.org/t/avoiding-vectors-of-abstract-types/61883)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 22\
**Last updated:** [February 17, 2022, 9:46pm UTC](https://discourse.julialang.org/t/avoiding-vectors-of-abstract-types/61883 "2022-02-17T21:46:36Z")

</div>

I’ve come across a few instances (see 1, 2, 3) where it would be intuitive to create a vector of structs that all fall under the same abstract type (maybe this comes from an OO style of thinking?). Unfortunately, this le…

---

## [How to get the manifest version?](https://discourse.julialang.org/t/how-to-get-the-manifest-version/76633)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 0\
**Last updated:** [February 17, 2022, 3:56pm UTC](https://discourse.julialang.org/t/how-to-get-the-manifest-version/76633 "2022-02-17T15:56:38Z")

</div>

I’m moving Manifest files from Julia 1.6 to 1.7 and calling Pkg.upgrade\_manifest() to do this. Unfortunately, if a manifest is already at version 2.0, then Pkg.upgrade\_manifest() throws an exception: ERROR: LoadError: …

---

## [A few basic questions about Precompilation](https://discourse.julialang.org/t/a-few-basic-questions-about-precompilation/71545)

<div class="topic-metadata">

**Author:** [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Replies:** 6\
**Last updated:** [February 17, 2022, 3:46pm UTC](https://discourse.julialang.org/t/a-few-basic-questions-about-precompilation/71545 "2022-02-17T15:46:10Z")

</div>

Hi everyone, I have recently tried with little success to add a precompilation step to my own package project and hope someone can help me clarify a few problems. In this post it is explained that one can precompile …

---

## [String Distance Calculations on GPU](https://discourse.julialang.org/t/string-distance-calculations-on-gpu/57549)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [February 17, 2022, 3:38pm UTC](https://discourse.julialang.org/t/string-distance-calculations-on-gpu/57549 "2022-02-17T15:38:42Z")

</div>

How difficult would it be to do this in Julia? It looks like it might be possible to do this with PyTorch: And here are some papers on the topic: https://www.researchgate.net/publication/300042590\_Using\_GPUs\_to\_Spee…

---

## [How can I create type stable stable tuples with non-concrete parameters (or: Invariant tuple types)](https://discourse.julialang.org/t/how-can-i-create-type-stable-stable-tuples-with-non-concrete-parameters-or-invariant-tuple-types/76627)

<div class="topic-metadata">

**Author:** [@jakobnissen](https://discourse.julialang.org/u/jakobnissen)\
**Replies:** 5\
**Last updated:** [February 17, 2022, 2:14pm UTC](https://discourse.julialang.org/t/how-can-i-create-type-stable-stable-tuples-with-non-concrete-parameters-or-invariant-tuple-types/76627 "2022-02-17T14:14:28Z")

</div>

Hey all, So, I made this script where I have a type like this: struct Foo v::NTuple{8, Union{String, Nothing}} end The reason being that I want the compiler to be able to enforce a length of 8 for me, and also tha…

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

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