Re: [R] [FORGED] function for remove white space

2017-02-22 Thread José Luis
Oh, thank you so much!! It's perfect!! Enviado desde mi iPhone > El 22 feb 2017, a las 17:49, William Dunlap escribió: > > Try the following function to apply gsub to all character or factor > columns of a data.frame (and maintain change the class of all > columns): > > gsubDataFrame <- fun

Re: [R] [FORGED] function for remove white space

2017-02-22 Thread William Dunlap via R-help
Try the following function to apply gsub to all character or factor columns of a data.frame (and maintain change the class of all columns): gsubDataFrame <- function(pattern, replacement, x, ...) { stopifnot(is.data.frame(x)) for(i in seq_len(ncol(x))) { if (is.character(x[[i]])) {

Re: [R] [FORGED] function for remove white space

2017-02-21 Thread José Luis
Thank's for your answer. I'm using read.csv. Enviado desde mi iPad > El 22/2/2017, a las 3:39, William Michels escribió: > > Hi José (and Rolf), > > It's not entirely clear what type of 'whitespace' you're referring to, > but if you're using read.table() or read.csv() to create your > datafra

Re: [R] [FORGED] function for remove white space

2017-02-21 Thread William Michels via R-help
Hi José (and Rolf), It's not entirely clear what type of 'whitespace' you're referring to, but if you're using read.table() or read.csv() to create your dataframe in the first place, setting 'strip.white = TRUE' will remove leading and trailing whitespace 'from unquoted character fields (numeric f

Re: [R] [FORGED] function for remove white space

2017-02-21 Thread Rolf Turner
On 22/02/17 12:51, José Luis Aguilar wrote: Hi all, i have a dataframe with 34 columns and 1534 observations. In some columns I have strings with spaces, i want remove the space. Is there a function that removes whitespace from the entire dataframe? I use gsub but I would need some function to