RE: [R] Reading data from "clipboard"

From: Francisco J. Zagmutt <gerifalte28_at_hotmail.com>
Date: Tue 29 Mar 2005 - 07:42:58 EST

>From: "Liaw, Andy" <andy_liaw@merck.com>
>To: "'R_xprt_wannabe'" <r_xprt_wannabe@yahoo.com>, r-help@stat.math.ethz.ch
>Subject: RE: [R] Reading data from "clipboard"
>Date: Mon, 28 Mar 2005 15:53:45 -0500
>
> > From: R_xprt_wannabe
> >
> > Dear List,
> >
> > As a way to learn R, I am trying out some of the
> > examples shown in the Reference Cards.
> >
> > I use the following to read a column of numbers from
> > Excel:
> >
> > x <- read.delim("clipboard")
> >
> > My questions are:
> >
> > 1. Why is it that the first number is omitted from the
> > selected data range? How do I tell R to pick up the
> > first number as part of the entire selection?
>
>It's probably because read.delim() has the argument `header' that is TRUE
>by
>default, so unless you set that to FALSE, it treats the first row as column
>headers.
>
>
> > 2. The next thing I want to do once my data are read
> > in the way described above is
> >
> > y <- ppoints(sort(x))
> >
> > but I get the following:
> >
> > Error in sort(x): 'x' must be atomic
> >
> > What does 'atomic' mean in this context? How do I
> > make 'x' atomic?
>
>read.delim() outputs a data frame, which is a collection of variables. In
>your case it's probably just one variable. You can do x <- x[[1]] to
>change
>x into the first column of the data frame.
>
>If you only have one column of data, scan() would be a better choice than
>read.delim() (and friends).
>
> > 3. While I understand there are other ways to
> > accomplish the same thing, I seem to recall there is a
> > way to invoke within R a spreadsheet-like window for
> > data input, but I can't seem to locate the command for
> > the life of me.
>
>You're probably looking for data.entry().

You can also access the same spreadsheet-like feature using fix() or edit().   I like fix() better because it does not write the resuts of your edits back to the console once you make changes/add data.

Francisco

>
>Andy
>
> > Any help is appreciated.
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
> >
> >
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
>http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Mar 29 07:48:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST