[R-SIG-Mac] Fw: Question about stripchart

Richard M. Heiberger rmh @end|ng |rom temp|e@edu
Tue Feb 2 23:19:14 CET 2021


months<-c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

monames.factor <- factor(monamescon$monames, levels=months)
stripchart(conc~monames.factor, data=monamescon, vert=TRUE)

read the help file
?factor

and see that the levels factor must contain unique values.

Please always keep the list as a recipient when you respond.
This question belongs on R-help using r-project.org
because it is not Macintosh specific.
Any followup should be sent to R-help using R-project.org


________________________________________
From: Parkhurst, David F. <parkhurs using indiana.edu>
Sent: Tuesday, February 2, 2021 4:29 PM
To: Richard M. Heiberger
Subject: Re: Question about stripchart

Hmm.  I’m guessing that this might work with my stripchart problem:

Define months<-c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

Then use mofac<-factor(months, months)

Then set up a vector of 73 elements like

mos<-c(mofac[4],mofac[4],…,mofac[12])

Then my call to stripchart would be (conc~mos, …)

Is that what I need to do?


From: Richard M. Heiberger <rmh using temple.edu>
Date: Monday, February 1, 2021 at 9:10 PM
To: Parkhurst, David F. <parkhurs using indiana.edu>
Subject: Re: Question about stripchart
month.factor <- factor(month.name, month.name)


> month.name
 [1] "January"   "February"  "March"     "April"     "May"       "June"
 [7] "July"      "August"    "September" "October"   "November"  "December"
> class(month.name)
[1] "character"
> month.factor <- factor(month.name, month.name)
> levels(factor(month.name))
 [1] "April"     "August"    "December"  "February"  "January"   "July"
 [7] "June"      "March"     "May"       "November"  "October"   "September"
> levels(factor(month.factor))
 [1] "January"   "February"  "March"     "April"     "May"       "June"
 [7] "July"      "August"    "September" "October"   "November"  "December"
>

________________________________________
From: R-SIG-Mac <r-sig-mac-bounces using r-project.org> on behalf of Parkhurst, David F. <parkhurs using indiana.edu>
Sent: Monday, February 1, 2021 8:53 PM
To: r-sig-mac using r-project.org
Subject: [R-SIG-Mac] Question about stripchart

I have E. coli data (variable �conc�) for 73 dates over months from Apr through Dec (variable �monames�).  The data are in order from the April through December, and are in a data.frame titled "monamescon�.  When I run stripchart(conc~monames, data=monamescon, vert=TRUE), the months come out in alphabetical order along the x axis.  How can I get them to come out in time order instead?


        [[alternative HTML version deleted]]


More information about the R-SIG-Mac mailing list