Add columns that calculate Min, Max, IQR, Mean, Median, Variance, Std. across the columns. I know I must use (using Statistics) and apply the methods, but would like to
add the calculated columns to the existing DF.
Something like
insertcols!(DF, 4, :Min => min.(DF[:.1:3]))
Is there anyway to plot mean values for each row with the Min and Max as upper and lower boundaries on the same plot?
But I want to stress that, this is anti-columnar so you might want to use DataFrameMetas.jl to speed things up. Basically, if you need everything on each row, youβre doing row-based analysis.
Am wondering β if I use DataFrameMeta.jl do I need to qualify anything in the line you provided or the system automatically references the package that will execute optimally?
The ByRow functions seems to work on all row
elements, instead of the column subset of interest.
I suppose I could fill AsTable(2:4), to specify where
to perform the row-wise operation, yes?
Thank you for sharing this, in my example I wanted to make
a deep copy over-write so I included (!). Also, wanted to show
a second :StDev column but *2. I attempted:
I think the broadcast function would be better here, as our colleague has expressed. For loops from what I read are not good design features for larger code, though we are working with small tables here.
the opposite, when your data doesnβt fit in RAM, for-loop sometimes is the only reasonable choice that is also flexible enough (i.e. not .this().that().compute()
The first line has a scalar and the second line makes a vector of 4 βByRowβ functions:
julia> ByRow.([minimum, maximum, round3βvar, round3βstd])
4-element Vector{ByRow}:
(::ByRow{typeof(minimum)}) (generic function with 2 methods)
(::ByRow{typeof(maximum)}) (generic function with 2 methods)
(::ByRow{ComposedFunction{typeof(round3), typeof(var)}}) (generic function with 2 methods)
(::ByRow{ComposedFunction{typeof(round3), typeof(std)}}) (generic function with 2 methods)
and the third line is a vector of 4 names. So by broadcasting => we are simply creating a vector of 4 βpairs of pairsβ. See what we get if we execute the whole expression given as parameter to transform!:
So to make it work just make sure the βByRowβ vector and the names vector have the same size, and the order of βByRowβ functions corresponds to the names (in your code you have the mean function before var but the names in the reverse order):