[R] Various newbie questions
Philippe de Rochambeau
philippe at wwphi.net
Wed Feb 4 12:33:15 CET 2004
Hello,
1) What is the difference between a "data frame" (J H Maindonald, Using
R, p. 12) and a "vector"?
In Using R, the author asks the reader to enter the following data in a
data frame, which I will call "mydata":
year snow.cover
1970 6.5
1971 12.0
1972 14.9
1973 10.0
1974 10.7
1975 7.9
...
mydata=data.frame(year=c(1970,...),snow.cover=c(6.5,...))
2) How to you retrieve say, snow.cover's second data item? mydata[1][2]
does not work, neither does mydata[1,2].
hist(mydata[1,2]) does not work. How would you create a histogram with
the above data?
In a French statistics book, the author provides the following data:
Group A Number: 35 Mean:27
Group B Number: 42 Mean:24
and asks: "what is the mean of the group constituted by the reunion of
the two groups?"
The answer is of course (27 x 35) + (24 x 42) / 77
3) Is there a way to compute this mean in R (apart from doing the above
operation, of course) if you have two sets of data?
4) How do you set class limits in R, for instance
10-20
21-31
etc.
5) How do you determine quartiles in R? Is there a way to determine the
"semi-inter-quartile deviation" ("écart semi-inter-quartile" in
French)?
Many thanks!
Philippe de Rochambeau
More information about the R-help
mailing list