I am trying to create a LM() with just Friday Saturday and Sunday as independent variables any clue on how to do this I have been searching for three days with know luck.
you have 7 levels not 2.
It seems like you want to remove rows of the dataframe RData2019 which have a day outiside of Saturday and Sunday; its popular on this forum to use dplyr::filter() for those sorts of operations; but this could be addressed with base R function subset
perhaps your best order of operations is to filter/subset reducing the frame to only the two types of rows of interest and then transform that dat column from character to factor, and it will naturally have 2 levels.
hello I am having some trouble getting this to work I truly do appreciate your help
here is the code I came up with, out of research
RData2019$Day <- as.factor(RData2019$Day)
filter(RData2019, Day == "monday", "Tuesday", "Wednesday", "Thursday")
this is the error I received
Error in filter():
! Problem while computing ..2 = "Tuesday". Input ..2 must be a logical vector, not a character.
Run rlang::last_error() to see where the error occurred.
rlang:: last_error
dplyr::filter(...)
dplyr:::filter.data.frame(RData2019, Day == "monday", "Tuesday", "Wednesday",
"Thursday")
in R we can contain together multiple items of the same type in a c(ombination) using c() or of mixed types in a list list().
Also filter is used to specify what is kept (the inverse of what is removed)
filter(RData2019, Day %in% c("Saturday","Sunday"))
Thank you for this. just as a reminder I am trying to isolate Friday, Saturday, and Sunday Values to see what
effect these independent days or variables would have on the model.