[R] Plotting graph problem!!

Jim Lemon jim at bitwrit.com.au
Sat Mar 19 23:02:19 CET 2011


On 03/20/2011 04:33 AM, andrew456 wrote:
> Thanks a lot for teaching me!!! By the way,one more question,how do i plot a
> boxplot of that??
>
Hi Andrew,
As you seem to be an R newbie and some of the replies may have been 
cryptic to a newbie, try this:

boxplot(a$Life.Expectancies.at.Birth)

To explain the above a little bit, when reading in a text file, R does 
some silent substitutions, like sticking full stops (.) in where there 
were spaces in the field labels. The dollar sign operator means "return 
the list element of "a" - a data frame column in this case - that has 
the name after the dollar sign. That gives the "boxplot" function a 
vector of numeric values and it knows what to do. These things are so 
familiar to most of us that we don't bother to explain them. You will 
probably encounter more of these little mysteries as you progress with 
R. Good luck.

Jim



More information about the R-help mailing list