As to call files of another softwares(as, Excel, minitab) to be manipulated inside of R-plus? Respectfully Regiane -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20011112/23b21666/attachment.html
> As to call files of another softwares(as, Excel, minitab) > to be manipulated inside of R-plus? > Respectfully > RegianeDear 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I use to save the data in Excell as ascii text
with cols separated by spaces. Then, in R, I use
scan (although there are now more sophisticated
functions). For example, if your data matrix is
10cols x 1000 rows, you save it as a file text and then
import it to R with:
mydatain <- scan(matrix("path_and_filename"),byrow=T,ncol=10)
Then you can copy the names of the col. variables to
another text file and:
mynames <- scan("path_and_file_name",what="")
dimnames(mydatain) <- list(NA,mynames)
And an analogous procedure for the row names.
Hope it helps!
Agus
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es
On Mon, 12 Nov 2001, Gep wrote:
> As to call files of another softwares(as, Excel, minitab)
> to be manipulated inside of R-plus?
> Respectfully
> Regiane
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
aolinto at bignet.com.br writes:>> 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.I find that comma separated files come in OK and Excel writes these from File -> Save and File -> Save As... Remember to use sep = "," and header = TRUE as in: my.df <- read.table(myfile.csv, sep = ",", header = TRUE) Mark -- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Jeremy, You write:>i am folloing the thread.... thankx for the info thus far. most of the people >who pop into my office for a "quick question" end up leaving their excel data >sheets with me which i then import into R(usually via S+, but i am on the >only member in the dept with a windows copy of s+!). > >my question is how to deal with missing data. can you leave the cells blank >in excel and use the import as you have suggested below or do you have to do >a find replace or something equivalent...? i.e. does R import 8,,8 as 8 mdata >8?Yes, it works fine. Prof Ripley writes: It's easier to use read.csv, on the same help page, or consult the Data Import/Export Manual. And he is right ... it has the appropriate defaults for the sep, dec and header parameters set so you don't have to bother with that. Mark -- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._