Hey everyone,
i used the scale function to conduct a z-transformation.
i have a question in respect of a problem, calculating a mean of a column. take this data for exampel:
the result after subsetting:
the result after calculating the column-mean
what is wrong here? why does the function mean() calculate this mean 9.013786e-18 when i try to calculate the column mean. the same is true for my original data-set:
afterwards, i subsetted the data and tried to calculate the mean for this subset
when i take a random subset, for example
the output is:
and when i calculate the mean(), it works perfectly
butafter i tried to calculate the column-mean, something strange happens
how is that possible? when i calculate all the mean from index 1-23 (out of 24), the mean is still reasonable
but as soon as i calculate the column-mean, i get [1] 6.256592e-17
when i only calculate the mean for index 24 separately the mean is reasonable as well:
where is the problem here...
I never had this problem before, after a z-transformation...
thank you in advance for your help (!)...i actually have no idea what the problem is here...
i used the scale function to conduct a z-transformation.
i have a question in respect of a problem, calculating a mean of a column. take this data for exampel:
Code:
aV <- c(rnorm(20,0,1))
condition<-rep(c(1:10),2)
index<-rep(c(1:5),4)
df<- data.frame(condition,index,aV)
df$z.aV <- scale(df$aV ,center=TRUE, scale = TRUE)
Code:
> mean(df$z.aV[df$index==2])
[1] -0.3075451
Code:
> mean(df$z.aV)
[1] 9.013786e-18
Code:
data$aV <- scale(data$av, center = TRUE, scale = TRUE)
when i take a random subset, for example
Code:
data$aV[data$index==5 & data$condition==1 ]
Code:
[1] 0.45603199 -0.55385017 0.25405556 0.25405556 -0.55385017 0.65800842 1.86986702 0.05207912
[9] 0.45603199 -1.15977947
Code:
mean(data$aV[data$index==24 & data$condition==1 ])
Code:
[1] 1.73265
Code:
mean(data$aV)
Code:
[1] 6.256592e-17
Code:
[1] -0.001454894
when i only calculate the mean for index 24 separately the mean is reasonable as well:
Code:
[1] 0.03153915
I never had this problem before, after a z-transformation...
thank you in advance for your help (!)...i actually have no idea what the problem is here...