[R] import data from excel
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Wed Jul 17 10:20:45 CEST 2002
Ulises Mora Alvarez <umalvarez at fata.unam.mx> writes:
> Save your data as a ".txt" file (".cvs", also work). Then in the R command window type:
> object <- read.table("route/to/your/file", header = TRUE)
>
> If any, be sure to include spaces in the route toyour file. The command "header" is optional, should be included if your data include their names.
Those .txt files are Tab-separated so read.delim() is safer in case
you have strings with spaces inside. Or read.delim2() if you're in a
"comma-as-decimal" speaking locale.
By the way: If you cut-and-paste from a spreadsheet into Notepad or
your favourite text editor, the pasted text will also be
Tab-separated and the same procedure applies. This is useful when
people have been scribbling notes and ad-hoc computations all over the
margins of their spreadsheets as some tend to do.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list