delete space from the names of a variable in r

0

I have a variable (a column) with names and surnames. I want to eliminate the space between the name and the last name.

How can I do it, without converting all the fields of my matrix into factors?

    
asked by Ana 17.11.2016 в 12:04
source

1 answer

3

It can help you gsub(" ", "", tu_string) .

This function replaces matches within a chain. The first parameter is what you want to replace, in this case the blank space " " , the second parameter is because value you want to replace the first, in this case "" and the third is your string.

I leave a link with more examples about this function, it is in English but the google translator is enough to understand.

Gsub Examples

    
answered by 17.11.2016 в 13:02