I created the dataset in R and I have been struggling to find a way to get RStudio to come back with a solution
I tried using:
dat1$age <-dat1$currentyear - dat1$born
But I keep getting:
Error in dat1$currentyear - dat1$born :
non-numeric argument to binary operator
I just need to find out how old someone would be in 2021, given their birth year. I was trying to get their current age to appear in the dataframe which along with name, born, and friends, but not have any other dataset showing. work example here
born
is a character variable so you need to change it to integer/numeric. Trydat1$age <- dat1$currentyear - as.integer(dat1$born)
.