I have two dataframes, formatted as follows:
County RUCC_2013
Alameda 1
Alpine 8
Amador 6
and
County Year RUCC
Alameda 2000 1
Alameda 2001 1
Alameda 2002 1
Alpine 2000 8
Alpine 2001 8
Alpine 2002 8
Amador 2000 6
Amador 2001 6
Amador 2002 6
I originally tried to merge them using
df <- merge(df1, df2, by = 'County')
but I get the aforementioned No data available in the table. I then tried to hand code it by:
df[df$County==c("Alameda", "Amador", "Alpine), RUCC] <- 1
but then I got Error in x[[jj]] :
attempt to select less than one element in get1index
In addition: Warning message:
In ca1$County == c("Alameda", "Contra Costa", "El Dorado", "Los Angeles", :
longer object length is not a multiple of shorter object length
Is there an alternative that is better?