date - R select row by year and month -


i have à dataframe

head(journalbeart)         date     vtemperature 1 2012-03-08 10.2938450704225 2 2012-03-09 10.6240559440559 3 2012-03-10 12.4791398601399 4 2012-03-11 14.3567482517483 5 2012-03-12 15.9947622377622 6 2012-03-13 16.1366433566434 

and want select line month , year. select rows months between april , june of 2012 have find month,

month(journalbeart$date) %in% 3:9 

how integrate month , year

thanks!

unless date column in date format,

journalbeart$date <- as.date(as.character(journalbeart$date), "%y-%m-%d") 

then can use logical argument select date range want:

journalbeart[journalbeart$date >= as.date("010412", "%d%m%y") & journalbeart$date <= as.date("300612", "%d%m%y"), ] 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -