Use of std function in Statistics

I am trying to use this function

result = Statistics.std(data_data; corrected=true, mean=nothing, 2)

But this is throwing an error and I do not understand why. Could anyone explain to properly format the parameters for things like this:

std(v; corrected::Bool=true, mean=nothing, dims)

Keyword parameters (i.e. arguments appearing after the semi-colon “;”) have to be named, which is not the case of dims here, for which you directly put the value 2.

This should work:

julia> data = rand(1000,1000);
julia> using Statistics
julia> result = std(data; corrected=true, mean=nothing, dims=2)
1000×1 Array{Float64,2}:
 0.27789883476970717
 0.2834628928652056 
 0.2843101448288627 
 0.290594711126601  
 ...

or, since it looks like you want to keep the default values for corrected and mean:

julia> result = std(data; dims=2)
1000×1 Array{Float64,2}:
 0.27789883476970717
 0.2834628928652056 
 0.2843101448288627 
 0.290594711126601  
 ...
1 Like

Hopefully, you’ve got your answer, but in the future, please provide a minimal working example that demonstrates your problem and shows the error message. Please read: make it easier to help you