Hi,

After I read an xlsx file into the work space:
A <- read.xlsx("B.xls", header = T, check.names = F)
There are several headers with the names like:
colnames(A) [1:4]
# [1] "A 1"                        "B"
 [3] "C 2"                          "D"
I can get the content of column 2 and column 4 easily by
A$B or A$D

However, I can not type something like
A$A 1 (cause there is a space in between)

Obviously, you can get around this by using something like
A[,colnames(A) == "A 1"]
The other way to get around is to read it by using check.names = T
A <- read.xlsx("B.xls", header = T, check.names = T)
and type something like
A$A.1

But I am wondering if I stick using check.names = F, if there is anything
that is as easy as
A$A 1
that works.

Thanks,

-Jack

        [[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