[R] Doubt

aolinto@bignet.com.br aolinto at bignet.com.br
Mon Nov 12 17:46:36 CET 2001


> As to call files of another softwares(as, Excel, minitab)  
>  to be manipulated inside of R-plus?
> Respectfully
> Regiane

Dear Regiane

The easiest way I found to transfer data from Excel to 
data.frames in R was to use copy and paste function.

Let’s say you have a 4 column x 101 row data set in Excel 
(columns A to D; row 1 with titles: Species, Sex, Weight and 
Length, rows 2 to 101 with data).

In Excel make a new column (column E) and in cell E2 write 
=A2&" "&B2&" "&C2&" "&D2. Fill all lines (2 to 101) of column 
E with this formula. Copy cells E2 to E101.

In R write:
data.dat <- data.frame(scan(what = list (Sp=" ", Sex=" ", 
Wt=0, Lt=0), sep=" "))

*** use dec=","  if your system uses comma (,) as decimal 
separator: ... sep=" ", dec=","))
Also note that in this example Sp and Sex are factors.

When "1:" appears in R press Ctrl+v

Good luck,

Antonio Olinto



-----------------------------------------------------



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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