Re: [R] removing blanks from a string

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 27 Jun 2008 05:26:34 -0400

Is this what you want:

> x <- c("hola ", "Yes ", "hello ")
> gsub(" *$", "", x)

[1] "hola" "Yes" "hello"
>
>

On Fri, Jun 27, 2008 at 4:34 AM, juli pausas <pausas_at_gmail.com> wrote:
> Hi
> Is there a way to remove blank characters from the end of strings in a
> vector? Something like the =TRIM functions of the OpenOffice
> spreadsheet. E.g.,
> a <- c("hola ", "Yes ", "hello ") # I'd like to get:
> c("hola", "Yes", "hello")
>
> Thanks
>
> Juli
>
>
> --
> http://www.ceam.es/pausas
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 27 Jun 2008 - 09:29:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jun 2008 - 10:31:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive