I'm doing an economics replication paper, and I need to estimate the year that an immigrant entered the labour market.
This expression is supposed to tell me if I can use their arrival to America as the year of entry into the labour market or not, since some people stay in school (df_clean$ysm < df_clean$AGE - df_clean$EDUCD - 5)
For those that have been in the US longer than the time they spent in school in addition to five extra years for being a toddler/baby, I can use the date of immigration (df_clean$YRIMMIG).
For those that haven't been here as long, their year of entry into the labour market in the US will need to account for the time they've spent in school before entering the labour market in America (df_clean$YRIMMIG + df_clean$EDUCD + 5).
How can I make a new variable that can estimate when they joined the US labour force?
library(dplyr)
class(df_clean$YRIMMIG) #integer # date/year of immigration to US
class(df_clean$ysm) # numeric # quantity of years since the migration
class(df_clean$AGE) #integer # age in years
class(df_clean$EDUCD) #numeric #number of years educated in America
class(df_clean$year_entry) # integer # year the immigrant entered into the labour force
df_clean$YRIMMIG <- as.numeric(df_clean$YRIMMIG) %>%
mutate(
year_entry = ifelse(df_clean$ysm < df_clean$AGE - df_clean$EDUCD - 5, df_clean$YRIMMIG, df_clean$YRIMMIG + df_clean$EDUCD + 5))
The error I'm getting is Error in UseMethod("mutate") : no applicable method for 'mutate' applied to an object of class "c('double', 'numeric')"