Hey, I am trying to make a data frame and the name of a column is composed of a number, a dot, and a word, such as "1.whatever". But I always get this error message:"syntax error, unexpected SYMBOL, expecting ',' in:" while printing data frame out . When I rename the column with purely letter, everything works fine. Some suggestion about the cause/ solution ?? Thanks. -- View this message in context: http://www.nabble.com/naming-columns-of-data-frame-tf4449324.html#a12694795 Sent from the R help mailing list archive at Nabble.com.
when I try what you describe there is no problem -maybe send a reproducible example.> x<-data.frame(matrix(2,2,2)) > colnames(x) <- c("1.xx", "2.xx") > x1.xx 2.xx 1 2 2 2 2 2 On Sat, 15 Sep 2007, kevinchang wrote:> > Hey, > > I am trying to make a data frame and the name of a column is composed of a > number, a dot, and a word, such as "1.whatever". But I always get this error > message:"syntax error, unexpected SYMBOL, expecting ',' in:" while printing > data frame out . When I rename the column with purely letter, everything > works fine. Some suggestion about the cause/ solution ?? Thanks. > -- > View this message in context: http://www.nabble.com/naming-columns-of-data-frame-tf4449324.html#a12694795 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Try this: df <- data.frame('1.test'=rnorm(100), '2.test'=runif(100), check.names=F) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O On 15/09/2007, kevinchang <shukai@seas.upenn.edu> wrote:> > > Hey, > > I am trying to make a data frame and the name of a column is composed of a > number, a dot, and a word, such as "1.whatever". But I always get this > error > message:"syntax error, unexpected SYMBOL, expecting ',' in:" while > printing > data frame out . When I rename the column with purely letter, everything > works fine. Some suggestion about the cause/ solution ?? Thanks. > -- > View this message in context: > http://www.nabble.com/naming-columns-of-data-frame-tf4449324.html#a12694795 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]