[R] boxplot via plot command
niederlein-rstat at yahoo.de
Tue Dec 2 10:06:53 CET 2008
thank you both for your response.
I don't want to do anything like this - I just got some code like this from
someone else and was wondering about the result.
I would have used another approach to create a boxplot like this...
markleeds at verizon.net schrieb:
> hi: i'm not well versed in the OO mechanism behind R but you've created
> a dataframe with one column being factors so,
> when the plot command sees this, there must be code in the plot generic
> that decided that the best thing to use is a boxplot.
> I'm not sure what you want since you have 3 factors but below is a guess
> ? I split by the factor and then plot the values seperately
> with the colors denoting the factors ? if it's not what you want, then i
> would resend your question to the list explaining what you
> do want because there are others on this list that can probably help you
> more than i can. good luck.
> x <- rnorm(300)
> l <- c(rep("label1",100), rep("label2",50), rep("label3",150))
> df <- data.frame(l=as.factor(l), x)
> temp <- split(df,df$l)
> On Tue, Dec 2, 2008 at 3:30 AM, Antje wrote:
>> Hi folks,
>> I've just discovered that the following code leads to boxplot
>> (surprisingly to me).
>> Can anybody explain to me why? Is this documented somewhere? I've
>> never consider this option before.
>> x <- rnorm(300)
>> l <- c(rep("label1",100), rep("label2",50), rep("label3",150))
>> df <- data.frame(as.factor(l), x)
>> Thank you!
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help