[R] Reading data from xls..........please help
Katya Mauff
Katya.Mauff at uct.ac.za
Fri Jun 18 14:00:47 CEST 2010
Surely you could also save the excel spreadsheet with the relevant data as a text file, and then read it into R as normal?
Select "save as" in Excel and then change "save as type" to "Text (Tab delimited)(*.txt)".
Save it in the directory you are using in R, (or change the directory in R to where you would like to keep your data), and then use the read.table statement for the text version of the file. Just ensure that you do not have spaces between words in each cell, so e.g. if you have a column named "variable type", change it to "variable_type"-otherwise you'll get an error when you try to read it into R. You might also find it useful to change any missing (empty) cells in Excel to "NA" before reading it in.
>>> Petr PIKAL <petr.pikal at precheza.cz> 2010/06/18 01:42 PM >>>
Hi
r-help-bounces at r-project.org napsal dne 16.06.2010 22:14:33:
> Thanks for your reply. Possibly I donot have perl. I am not sure
although.
> How I can find whether I have it? If I dont have it then where can I
> download it from?
Do you have Excel? If yes you can
Open Excel
Select data you want to transfer to R
Press
Ctrl-C
to copy it to clipboard
Open R and write
mydata <- read.delim("clipboard")
to console.
Regards
Petr
>
>
> On Thu, Jun 17, 2010 at 12:57 AM, Barry Rowlingson <
> b.rowlingson at lancaster.ac.uk> wrote:
>
> > On Wed, Jun 16, 2010 at 7:29 PM, Christofer Bogaso
> > <bogaso.christofer at gmail.com> wrote:
> > > Can anyone help me how to read xls file into R. I have tried
following
> > >
> > > library(gdata)
> > > xlsfile <- file.path(.path.package('gdata'),'xls','iris.xls')
> > > read.xls(xlsfile)
> > >
> > > I got following error:
> > > Converting xls file to csv file... Error in system(cmd, intern =
> > !verbose) :
> > > perl not found
> > > Error in file.exists(tfn) : invalid 'file' argument
> > >
> > > Question *1) What is the way to get it working?*
> >
> > Works for me on an Ubuntu 9.10 with R 2.10.1, so swapping your OS and
> > R version to that will get it working... What OS/R are you on?
> >
> > Note it says 'perl not found'. That's because it hasn't found perl.
> > Do you have perl on your system? Do you need to specify the path to
> > perl, as in the examples for Windows in help(read.xls)?
> >
> > Barry
> >
>
> [[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.
______________________________________________
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.
###
UNIVERSITY OF CAPE TOWN
This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 4500. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.
###
More information about the R-help
mailing list