[R] cdplot error

Allan Engelhardt (CYBAEA) allane at cybaea.com
Wed Aug 3 08:49:22 CEST 2011


On 03/08/11 05:52, wildernessness wrote:
> Fairly new at this.
> Trying to create a conditional density plot.
>
>> cdplot(status~harvd.l,data=phy)
> Error in cdplot.formula(status~harvd.l,data=phy):
> dependent variable should be a factor
>
> What does this error mean?  Status is a binary response of infestation (0/1)

Probably status is a numerical variable rather than a factor**.  Try 
print(is.factor(phy$status)) and if that is FALSE then

phy$status <- factor(phy$status, labels=c("N", "Y"))
cdplot(status~harvd.l,data=phy)

Hope this helps a little.

Allan

> and harvd.l is the log of timber harvest density per catchment.
>
> Thanks.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/cdplot-error-tp3714454p3714454.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list