2
votes

I wish to run the example from here, but I get this error:

julia> using DataFrames, GLM

julia> data = DataFrame(X=[1,2,3], Y=[2,4,7])

ERROR: cannot assign variable ImageAxes.data from module Main Stacktrace: 1 top-level scope at none:0

Can someone help?

1

1 Answers

3
votes

ImageAxes.jl defines a deprecated function data. You must have used this function before trying to assign a value to data variable.

Now to understand what is going on consider the following example. I am using a fresh REPL session:

julia> sin = 1
1

julia> sin
1

julia> cos(1)
0.5403023058681398

julia> cos = 1
ERROR: cannot assign variable Base.cos from module Main

julia> log # it is enough to reference a function ho have this situation - you do not have to call it
log (generic function with 19 methods)

julia> log = 1

You can notice that you could bind a value to sin (although it is a standard function) to 1 BEFORE sin was referenced to (e.g. called) in the session. On the other hand we have called cos first before trying to assign a value to cos variable. This introduced cos into global scope, and as cos is a function rebinding the value assigned to cos is not allowed.