Hi,
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...
Ciao,
Antje
[EMAIL PROTECTED] 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)
print(df)
print(str(df))
temp <- split(df,df$l)
plot(temp[[1]]$x,ylim=c(min(temp[[1]]$x,temp[[2]]$x,temp[[3]]$x),
max(temp[[1]]$x,temp[[2]]$x,temp[[3]]$x)),col="green")
lines(temp[[2]]$x,type="p",col="blue")
lines(temp[[3]]$x,type="p",col="red")
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)
plot(df)
Thank you!
Antje
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.