Re: [R] Read in dataset without saving it

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Wed, 09 Jun 2010 12:55:59 +0200

Hi

r-help-bounces_at_r-project.org napsal dne 09.06.2010 12:44:33:

> See ?textConnection, eg
> test <-"1 2.5 3.4
> 1 2.3 3.1
> 1 2.6 3.9
> 2 2.9 2.8
> 2 2.6 2.9
> 2 2.7 2.9
> 3 2.3 3.3
> 3 2.4 3.0
> 3 2.7 3.2"
> x <- textConnection(test)
> read.table(x)
> close(x)
>
> On Wed, Jun 9, 2010 at 10:38 AM, Paul Chatfield
> <p.s.chatfield_at_reading.ac.uk> wrote:
> >
> > A simple question - I have a small dataset to read in and want to copy
and
> > paste part from Excel and paste it into an R script file without
creating
> > more files saving it as a .txt/.csv and then reading that in. I want
to

In Excel select what you want to copy
press Ctrl C
In R use
read.delim("clipboard")
or
read.table("clipboard")

depending whether you selected or did not selected some header.

Regards
Petr

> > read in 3 columns e.g.
> > 1 2.5 3.4
> > 1 2.3 3.1
> > 1 2.6 3.9
> > 2 2.9 2.8
> > 2 2.6 2.9
> > 2 2.7 2.9
> > 3 2.3 3.3
> > 3 2.4 3.0
> > 3 2.7 3.2
> >
> > I thought I could use scan() but don't know how to extend it to
multiple
> > columns? I thought about using colwise (plyr) but think I am making
this
> > more complicated than it probably should be! Is there an easy way to
do
> > this?
> >
> > Any ideas gratefully received,
> >
> > Paul
> > --
> > View this message in context:
http://r.789695.n4.nabble.com/Read-in-dataset-
> without-saving-it-tp2248495p2248495.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > 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.
> >
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Applied mathematics, biometrics and process control
>
> tel : +32 9 264 59 87
> Joris.Meys_at_Ugent.be
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
> ______________________________________________
> 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. Received on Wed 09 Jun 2010 - 10:58:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jun 2010 - 11:10:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive