ID Date Day
11/1 Sunday
22/1 Tuesday/Holiday
3 Wednesday, March 1
·
·
·
I would like to treat data like this as a different variable if it includes holidays.
ph<-grep("holiday", data)
I got the line as , but I'm at a loss how to create a variable after this.
r
grep
has been able to get the column number, so
ph<-data [grep("holiday", data),]
Alternatively, use grepl
to return TRUE or FALSE
ph<-subset(data, grepl("holiday", data))
© 2024 OneMinuteCode. All rights reserved.