I have a data frame similar to this
V1 V2 .. 1 .. 2 .. 1 .. 3
and etc.
For each individual value of V2, I would like to calculate the variance of the data in V1. I just started my adventure with R, any hints how to do this? for my particular case, I assume that I can manually do something like
var1 = var(data[data$V2==1, "V1"]) var2 = ...
etc., because I know all the possible values โโof V2 (there are not many of them), however, I am curious what more general solutions will be. Any ideas?
source share