Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of arun
> Sent: Tuesday, January 08, 2013 3:30 PM
> To: Elaine Kuo
> Cc: R help
> Subject: Re: [R] error in a abline loop
>
> HI Elaine,
>
> I
subs),
> abline(line,col=c("yellow","chocolate1","darkorange2",
> "red3","saddlebrown","coral4","grey38")[i],lwd=2) ) #closing parenthesis for
> lm( was missing
> }
>
>
> A.K.
>
>
>
> -
",
"red3","saddlebrown","coral4","grey38")[i],lwd=2)
}
A.K.
- Original Message -
From: Elaine Kuo
To: r-help@r-project.org
Cc:
Sent: Monday, January 7, 2013 8:23 PM
Subject: [R] error in a abline loop
Hello
I have data of body length and
quot;,"chocolate1","darkorange2",
"red3","saddlebrown","coral4","grey38")[i],lwd=2)
}
A.K.
- Original Message -
From: Elaine Kuo
To: r-help@r-project.org
Cc:
Sent: Monday, January 7, 2013 8:23 PM
Subject: [R] error in a abl
t;,"darkorange2",
> "red3","saddlebrown","coral4","grey38")[i],lwd=2)
> }
>
>
> A.K.
>
>
>
> - Original Message -
> From: Elaine Kuo
> To: r-help@r-project.org
> Cc:
> Sent: Monday, January 7, 2013 8:23
Hello,
A ")" is missing.
I guess your code should be
for (i in 1:7){
subs <- data$skin_color==levels(data$skin_color)[i]
line <-lm(body_weight~body_length, data=subset(data, subset=subs))
abline(line,col=c("yellow","chocolate1","darkorange2","red3","saddlebrown","coral4","grey38")[i],lwd=2)
}
Hello
I have data of body length and body weight of people of different skin colors.
I tried to write a code to plot body length and body weight according
to the skin colors.
(Thanks for Petr's advice so far.)
A loop is used but an error shows up in the following code.
It says:
unexpected '}' i
7 matches
Mail list logo