t
> Sent: Wed, 18 Jul 2012 13:35:00 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] Entering Data Files
>
> Hi,
>
> Entering data from a given file is the hardest part of learning R for me.
> For example, I have this datafile from Moore's text:
>
> Live
type ?read.table in R
-
Yasir Kaheil
--
View this message in context:
http://r.789695.n4.nabble.com/Entering-Data-Files-tp4636943p4636959.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://st
p;M University
College Station, TX 77843-4352
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Rui Barradas
> Sent: Wednesday, July 18, 2012 4:24 PM
> To: darnold
> Cc: r-help@r-project.org
> Subject: Re: [R] En
For reading data into R you should start with
http://cran.r-project.org/doc/manuals/R-data.html (or the local copy
that was installed with R on your machine).
For the example above the read.table function should be fine. If you
want to change the shape of the resulting data frame then look at the
Hello,
Sorry, I forgot the barplot.
dmelt <- melt(d, id.vars=c("Live", "Age"), measure.vars="Count")
wide <- dcast(Live ~ Age, data = dmelt)
col <- rainbow(4)
barplot(as.matrix(wide[, 2:5]), beside=T, col=col)
legend("topleft", wide[, 1], fill=col)
Hope this helps,
Rui Barradas
Em 18-07-20
Hello,
Install package 'reshape2' and try the following.
#install.packages('reshape2')
library(reshape2)
d <- read.table(text="
LiveAgeCount
ParentsAge19324
AnotherAge1937
OwnPlaceAge19116
GroupAge1958
OtherAge195
ParentsAge20378
Another
Hi,
Entering data from a given file is the hardest part of learning R for me.
For example, I have this datafile from Moore's text:
LiveAge Count
Parents Age19 324
Another Age19 37
OwnPlaceAge19 116
Group Age19 58
Other Age19 5
Parents Age20 378
Another Age20 47
O
7 matches
Mail list logo