I have a dataset which contains multiple columns - around 30 but I would like to get the names column and years column if the years are bigger than 2000. I know how to do it if there would be both columns with numbers, but in my case one has names and the other numbers:
ys <- DF[DF$year<= DF$names, ] # this would work if both would contain numbers
counts <- table(names, year)
barplot(counts, main="Names by year",
xlab="Years",ylab = "Names(count)", col=colorRampPalette(brewer.pal(name="Dark2", n = 8))(18),
legend = rownames(counts))
And then as you can see above, I would like to use the result of that in the barplot.