I have a dataframe that has a column like this:
x
apple
orange
<pear>
orange
<straw-berry>
i would now like to add a new column that is populated with TRUE
or FALSE
based on whether the value of column x
contains angle brackets, or e.g. starts with <
:
x y
apple FALSE
orange FALSE
<pear> TRUE
orange FALSE
<straw-berry> TRUE
I have tried an approach similar to this, but without success;
d$y<- "False"
d$y[d$x[grep('<', rownames(d$x)),]] <- "True"
I get an incorrect number of dimensions
error with that code.