In my data frame table, the days of the week are integer type. I want to change the days of the week, for example Monday, Tuesday.
I tried stringr::str_replace()
In my data frame table, the days of the week are integer type. I want to change the days of the week, for example Monday, Tuesday.
I tried stringr::str_replace()
 
    
    Please try to capture sample data and desired output next time. I will try based on provided info.
Simple Approach : Lets say your data has a column weekday with integer values, similar to this- added data just for sample:
df <- data.frame(
   days_n =c(1,2,3,4,5,6,7)
   ,SomeData = c('A','AA','BB','CC','BB','AAA','CCC'))
Then just mutate using wonderful lubridate
df%>%mutate(Weekday = wday(x = days_n,label = T,abbr = T))
will give you :
 days_n SomeData Weekday
1      1        A     Sun
2      2       AA     Mon
3      3       BB     Tue
4      4       CC     Wed
5      5       BB     Thu
6      6      AAA     Fri
7      7      CCC     Sat
Check wday() in lubridate for more.
