[R] additional "X" characters in headers

Ben Bolker bbolker at gmail.com
Sun Mar 4 23:09:46 CET 2012


  [cc'ing back to r-help]


On 12-03-04 05:07 PM, Mateusz Kędzior wrote:
> Sorry, may I ask one more question?
> What does "X" exactly meand and why without it, it's invalid variable name?

  Follow the documentation link to ?make.names to see the definition of
a valid variable name (hint, it can't begin with a numeric character)
and to see that R puts an "X" in front of the name to make it valid if
necessary.

  When in doubt, you should follow the links in the help pages for more
information ... the R documentation is very cross-linked.


> 
> I'm quoting (read.table definition
> <http://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html>)
> here:
> /|check.names|/
> 
> /logical. If |TRUE| then the names of the variables in the data frame
> are checked to ensure that they are syntactically valid variable names.
> If necessary they are adjusted (by |make.names
> <http://stat.ethz.ch/R-manual/R-devel/library/base/html/make.names.html>|)
> so that they are, and also to ensure that there are no duplicates./
> 
> 
> ===============
> Best regards,
> Mateusz
> 
> W dniu 4 marca 2012 23:02 użytkownik Mateusz Kędzior
> <matandked at gmail.com <mailto:matandked at gmail.com>> napisał:
> 
>     Thank you.
> 
>     ============
>     Best regards,
>     Mateusz
> 
> 
>     2012/3/4 Ben Bolker <bbolker at gmail.com <mailto:bbolker at gmail.com>>
> 
>         Mateusz Kędzior <matandked <at> gmail.com <http://gmail.com>>
>         writes:
> 
>         > I want to prepare boxplot graphs from CSV files which containt
>         in first row
>         > years.
>         > I've tried to use both read.table and read.CSV functions, but
>         each of them
>         > add "X" to year in header,
>         > so I can see: X2012 instead of simply 2012.
>         > After calling boxplot those strange signs weren't removed.
>         > Is there any option to "properly" import such file?
>         > I've tried to add brackets, but it doesn't work.
>         >
> 
>          Use 'check.names=FALSE' in your calls to read.table and
>         read.csv.  (Search
>         ?read.table for 'check.names' to see what it means.)
> 
>         ______________________________________________
>         R-help at r-project.org <mailto: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.
> 
> 
>



More information about the R-help mailing list