Dear R users,
Suppose the csv file contains header names such as *"Nike, dunk"*,
*"Converse,
All stars"* etc
When imported to R (with header = T option), the column names are given by:
*"Nike..dunk"* *"Converse..All.stars"*
I have tried the following command to convert these column names to the
original names as in the input source. (i.e substituting "*.."* to
"*, *")
chartr("..",", ",colnames(dat))> "Nike dunk" "Converse All stars"
Not getting what Im expecting...
Greatly appreciate for your help in resolving this matter.
Steven
[[alternative HTML version deleted]]
Gabor Grothendieck
2009-Sep-15 01:44 UTC
[R] Header names when importing csv/excel data sets
See the check.names= argument to read.table. On Mon, Sep 14, 2009 at 9:40 PM, Steven Kang <stochastickang at gmail.com> wrote:> Dear R users, > > > Suppose the csv file contains header names such as *"Nike, dunk"*, *"Converse, > All stars"* etc > > When imported to R (with header = T option), the column names are given by: > > ? ? ? ? ? ?*"Nike..dunk"* ? ? ?*"Converse..All.stars"* > > I have tried the following command to convert these column names to the > original names as in the input source. (i.e substituting "*.."* to "*, *") > > chartr("..",", ",colnames(dat)) >> "Nike ?dunk" ? ? "Converse ?All stars" > > Not getting what Im expecting... > > Greatly appreciate for your help in resolving this matter. > > > > > > > Steven > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >