)<-gsub("^[X](.*)","\\1",colnames(dat1))
A.K.
- Original Message -
From: Vincy Pyne
To: r-help@r-project.org
Cc:
Sent: Thursday, July 19, 2012 2:55 AM
Subject: [R] Maintaining Column names while writing csv file.
Dear R helpers,
I have one trivial problem while writing
On 19/07/12 18:55, Vincy Pyne wrote:
Dear R helpers,
I have one trivial problem while writing an output file in csv format.
I have two dataframes say df1 and df2 which I am reading from two different csv
files.
df1 has column names as date, r1, r2, r3 while the dataframe df2 has column
names
Hi Vincy,
have you checked
names(df2)
and
names(df_new)
because by default 'data.frame' checks the column names "to ensure that
they are syntactically valid variable names" and 1w and 2w aren't, so an
X is prepended (see ?data.frame and ?make.names).
compare
tst.fail<-data.frame(a=1:3,"1a"=1:3
Dear R helpers,
I have one trivial problem while writing an output file in csv format.
I have two dataframes say df1 and df2 which I am reading from two different csv
files.
df1 has column names as date, r1, r2, r3 while the dataframe df2 has column
names as date, 1w, 2w.
(the dates in both
4 matches
Mail list logo