When I run this script on 9 variables, it works without problems.

Z <-
data[,c("s1_1234_m","s2_1234_m","s3_1234_m","s4_1234_m","s5_1234_m","s6_1234_m","s7_1234_m","s8_1234_m","s9_1234_m"
)]

However, when I run the script on 9 different variables, it does not work:
Z <-
data[,c("d_s1_m","d_s2_m","d_s3_m","d_s4_m","d_s5_m","d_s6_m","d_s7_m","d_s8m","d_s9m"
)]

Error in `[.data.frame`(data, , c("d_s1_m", "d_s2_m", "d_s3_m", "d_s4_m",
 :
  undefined columns selected

The first 9 variables are between 0 and 3, there are no missing values in
the dataset.

The second 9 variables are between -3 and 3, there are no missing values in
the dataset.

I am pretty new to R and have no idea what could cause this error.

Thank you

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to