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) 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.
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.
On 2011-08-02 21: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) > and harvd.l is the log of timber harvest density per catchment.Your question suggests that have not looked at help(cdplot) which clearly says just what the error message says and/or you aren't aware that 'factor' has a specific meaning in R in which case a look at chapter 4 of 'An Introduction to R' likely would be profitable. Peter Ehlers> > 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.