Dear R users, I have some trivial query. I have a string, I want to remove space from the string. For eg. Input: a <- " Remove space " Output required: "Removespace" I tried using str_trim but only removes end spaces. library(stringr). Regards Vikram [[alternative HTML version deleted]]
gsub(" ","",a)
/Gustaf
On Fri, Jan 13, 2012 at 12:24 PM, Vikram Bahure
<economics.vikram@gmail.com>wrote:
> Dear R users,
>
> I have some trivial query.
>
> I have a string, I want to remove space from the string.
>
> For eg.
>
> Input:
> a <- " Remove space "
>
> Output required:
> "Removespace"
>
> I tried using str_trim but only removes end spaces. library(stringr).
>
> Regards
> Vikram
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
--
Gustaf Rydevik, M.Sci.
tel: +44(0)74 253 760 42
address:St John's hill 18/5 EH8 9UQ Edinburgh, UK
skype:gustaf_rydevik
[[alternative HTML version deleted]]
Hi> > Dear R users, > > I have some trivial query. > > I have a string, I want to remove space from the string. > > For eg. > > Input: > a <- " Remove space " > > Output required: > "Removespace"It seems to be simple. Even myself with very poor knowledge of regexpr can suggest solution. gsub(" ", "", a) Regards Petr> > I tried using str_trim but only removes end spaces. library(stringr). > > Regards > Vikram > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.