4
I have a data.frame that has a column with names, but these names repeat a few times. I need to create a new column in a new data.frame with all names, but no repetitions.
4
I have a data.frame that has a column with names, but these names repeat a few times. I need to create a new column in a new data.frame with all names, but no repetitions.
7
Suppose your data frame is called dados
and the column with these names is called nomes
, do
unique(dados$nomes)
If you want to know the number of times each name appears, do
table(dados$nomes)
Browser other questions tagged r
You are not signed in. Login or sign up in order to post.
Perfect, that’s exactly what I needed. Between asking my question and seeing your answer, I ended up making a longer path using 'levels(as.factor(given$names)'. But I adopted your solution.
– Filipe Vargas
I’m glad you were able to come up with a correct and independent answer from me. If possible, please accept my answer so that in future other people can benefit from it as well.
– Marcus Nunes