I have a problem with using output of names() in data$ operation. The set-up of the code is:
list <- names(train1aM1)
list
#[1] "MOSTYPE" "MAANTHUI" "MGEMOMV" "MGEMLEEF" "MOSHOOFD" "MGODRK" "MGODPR" "MGODOV"
#[9] "MGODGE" "MRELGE" ......
list[1]
#[1] "MOSTYPE"
as.name(list[1])
#[1] MOSTYPE
This returns value:
train1aM1$MOSTYPE
#[1] 33 23 33 11 33 23 38 13 33 13 34 13 37 40 31 24 8 7 41 39 33 24 8 33 3 38 39 33 33 ....
But the following code returns NULL.
test <- as.name(list[1])
train1aM1$test
#NULL
What is wrong?