Skip to content
Prev 326002 / 398503 Next

2nd question about adding an additional variable along certain criteria in a dataframe

Hi,

Using your testframe and testvector (and thank you for the convenient
reproducible example):

# I used NA instead of "to be assigned"
testframe <- data.frame(testframe, landuse = "NA", stringsAsFactors=FALSE)

# checks membership in testvector
testframe[testframe$testcoordID %in% testvector, "landuse"] <- "gfgh"


Sarah

On Wed, Jun 26, 2013 at 5:36 AM, Jacqueline Oehri
<jacqueline.oehri at gmail.com> wrote: