Re: [R] plotting a point graph with data in X-axis

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 08 May 2007 20:39:40 -0400

set.seed(1)
sim <- data.frame(

   my.year = rep(2000:2002, c(8, 12, 12)),    my.month = c(5:12, 1:12, 1:12),
   freq = sample(1:40, 32)
)
sim$date <- as.Date(paste(sim$my.year, sim$my.month, 1, sep = "-")) plot(freq ~ date, sim)

On 5/8/07, Milton Cezar Ribeiro <milton_ruser_at_yahoo.com.br> wrote:
> Dear all,
>
> I have two data frame, on with a complete list of my field survey with frequency data of a sample species. This data frame looks like:
>
>
> simulation<-data.frame(cbind(my.year=c(rep(2000,8),rep(2001,12),rep(2002,12)),my.month=c(5:12,1:12,1:12)))
> simulation$year.month<-paste(simulation$my.year,"_",ifelse(simulation$my.month>=10,simulation$my.month,paste("0",simulation$my.month,sep="")),sep="")
> simulation$freq<-sample(1:40,32)
> attach(simulation)
> plot(year.month, freq)
>
> As you can see, I have a collumn with the year and month of my samples, and a freq variable with simulated data. I would like to plot this data but when I try to use the plot showed above, I get a error message.
>
> After bypass this problem, I would like add points in my graph with simulated data for only a random number of survey month, but I need that the full range of surveys be kept on the X-axis. Just to simulate a sample I am using:
>
> simulation.sample<-simulation[sample(1:length(year.month),8, replace=F),]
> simulation.sample$freq<-sample(1:40,8)
>
> Any ideas?
>
> Kind regards
>
> Miltinho
>
> __________________________________________________
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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_at_stat.math.ethz.ch 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. Received on Wed 09 May 2007 - 00:49:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 May 2007 - 02:32:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.