[R] New to R and need help
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Oct 15 10:13:55 CEST 2002
Scott Marley wrote:
>
> ----- Original Message -----
> From: "Peter Dalgaard BSA" <p.dalgaard at biostat.ku.dk>
> To: "Martin Maechler" <maechler at stat.math.ethz.ch>
> Cc: "Scott Marley" <azboater at dakotacom.net>; <r-help at stat.math.ethz.ch>
> Sent: Monday, October 14, 2002 9:18 AM
> Subject: Re: [R] New to R and need help
>
> > Martin Maechler <maechler at stat.math.ethz.ch> writes:
> >
> > > >>>>> "Scott" == Scott Marley <azboater at dakotacom.net>
> > > >>>>> on Mon, 14 Oct 2002 08:34:14 -0700 writes:
> > >
> > > Scott> All,
> > >
> > > Scott> I just took a cool R workshop and I'm chomping at the
> > > Scott> bit to play around with it. I'm fairly familiar with
> > > Scott> SAS and have some data that I used with Sas. My
> > > Scott> question is: How do I take a text file(I think my
> > > Scott> instructor called it a rectangular file) and import
> > > Scott> it to R. In sas you use an input statement followed
> > > Scott> by Variable name and the column numbers for the
> > > Scott> location of the data. Does R have a similar
> > > Scott> procedure? What would the syntax look like? Thank
> > > Scott> you for any help you can offer.
> > >
> > > help(read.table)
> >
> > (Why don't we have examples in there??)
> >
> > Specifically, you do something like
> >
> > x <- read.table("myfile.txt")
> > names(x) <- c("age", "height", "weight")
> >
> > or, preferably, add a 1st row containing the variable names to the
> > data file and do
> >
> > x <- read.table("myfile.txt", header=TRUE)
> >
> > There's a number of fine points concerning missing value specification
> > and variable types, for which the help page should be consulted.
> >
>
> Peter and all others,
>
> Thank you for your help. I was able to get the file loaded in. The data
> set I have is unusual in regards to having spaces inbetween variables.
> Usually the columns lack spaces inbetween in my other data sets. In SAS I
> would give the variable name then the column #. Is there a similar
> procedure in R?
See ?read.fwf
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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