Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #Data:
  2. df1 <- as.Date(c('Jul 1', 'Jun 26', 'July 5', 'July 15'), format = '%B %d')
  3. df2 <- c("red", "blue", "red", "blue")
  4.  
  5. df1 <- data.frame(df1,df2)
  6.  
  7. # Group.1 x
  8. [1] 4 red
  9. [2] 19 blue
  10.  
  11. df <- aggregate(df1[,1], list(df1[,2]), as.numeric(max(df1[,1]) - min(df1[,1]), units="days"))
  12.  
  13. Error in match.fun(FUN) :
  14. 'as.numeric(max(df1$date) - min(df1$date), units = "days")' is not a function, character or symbol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement