[R] count data without NA in certain time intervals and plot it

arun smartpink111 at yahoo.com
Sun Jun 17 03:36:36 CEST 2012



Hi,



Not quite understand the question.
Do you want to select only certain columns or rows without NAs?

Suppose, I have a dataset such as the one below:
dattrial<-data.frame(a=c(1,NA,rnorm(4,10)),b=c(NA,NA,NA,3,4,6),c=c(sample(LETTERS[1:3],replace=TRUE),
 sample(LETTERS[3:5],3,replace=TRUE)),d=runif(6,0.4))
# to eliminate the rows with NAs
dattrial1<-dattrial[complete.cases(dattrial),]
# to delete columns with NAs
dattrial1<-dattrial[,colSums(is.na(dattrial))==0]
or
dattrial1<-dattrial[rowSums(is.na(dattrial))==0,]

A.K.



----- Original Message -----
From: Tagmarie <Ramgad82 at gmx.net>
To: r-help at r-project.org
Cc: 
Sent: Saturday, June 16, 2012 4:11 PM
Subject: [R] count data without NA in certain time intervals and plot it

Hello, 
I'm quite new to R and still spend hours trying to figure out single things
so I hope nobody rolls his eyes over my question. 

I have a data set over time and converted it to the POSTIXct format. I added
a column in the data set for the week and the month. 

I try to get a plot which shows the weeks on the x-axis and the number of
datasets without NAs on the y-axis. That doesn't sound too difficult but I
can't figure it out. 

Does anybody have an idea?

--
View this message in context: http://r.789695.n4.nabble.com/count-data-without-NA-in-certain-time-intervals-and-plot-it-tp4633611.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