[R] Put square brackets as column name in a data frame
Mathieu V
bobhoul at hotmail.com
Fri Mar 19 18:34:08 CET 2010
Hi everyone,
this is a pretty simple question, but I have not found any answer about this
in this forum.
I'm trying to make a data frame like this :
ID,X[m],Y[m],Z[m]
0,-4.32902,-3.5437,12.4441
1,-4.31887,-3.54278,12.4441
2,-4.33672,-3.54401,12.4615
3,-4.67554,-2.78566,13.4151
4,-4.71124,-2.79889,13.4204
...
Actually, with my code, I'm getting this :
ID,X.m.,Y.m.,Z.m.
0,-4.32902,-3.5437,12.4441
1,-4.31887,-3.54278,12.4441
2,-4.33672,-3.54401,12.4615
3,-4.67554,-2.78566,13.4151
4,-4.71124,-2.79889,13.4204
...
How can I put square brackets ([ ]) in column names?
this is my code :
nouvTable <-
data.frame(ID=0:longueur,X[m]=colonneX,Y[m]=colonneY,Z[m]=colonneZ)
After, I'm putting this data frame in a text file
write.table(nouvTable, file = "C:/....txt", sep=",",quote=FALSE,row.names =
FALSE)
Everything work fine but I need the correct column names
Thank you
--
View this message in context: http://n4.nabble.com/Put-square-brackets-as-column-name-in-a-data-frame-tp1599725p1599725.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list