[R] gsub() issue...
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Wed May 18 00:58:56 CEST 2011
Hi Charles,
It's not clear to me what you mean by "doesn't work".
> test <- "Interesting 1\nPoint\n"
> cat(test)
Interesting 1
Point
> test1 <- gsub("ing 1\nP","ing 3\nP", test)
> cat(test1)
Interesting 3
Point
>
Cheers
Andrew
On Tue, May 17, 2011 at 10:45:31AM +0200, Thibault Charles wrote:
> Hello R helpers,
>
>
>
> I get a problem using gsub() function.
>
>
>
> I have the following text :
>
>
>
> text <- ?? INFILTRATION INF_BASE
>
> AIRCHANGE=1 ??
>
>
>
> Then my code is :
>
>
>
> original <- "INFILTRATION INF_BASE \n AIRCHANGE=1"
>
>
>
> replace <- "INFILTRATION INF_BASE \n AIRCHANGE=3"
>
>
>
> new_texte <- gsub(original,replace,text)
>
>
>
> but it doesn?t work.
>
>
>
> Nevertheless, cat(original) works but print(original) doesn?t?
>
>
>
> Would you have an idea ?
>
>
>
> Thanks
>
>
>
> Thibault Charles
>
> Solamen
>
> Audencia - 8 route de la Joneli?re
>
> 44300 Nantes
>
> +33 2 40 37 46 76
>
>
>
>
> [[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 guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Andrew Robinson
Program Manager, ACERA
Department of Mathematics and Statistics Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia (prefer email)
http://www.ms.unimelb.edu.au/~andrewpr Fax: +61-3-8344-4599
http://www.acera.unimelb.edu.au/
Forest Analytics with R (Springer, 2011)
http://www.ms.unimelb.edu.au/FAwR/
Introduction to Scientific Programming and Simulation using R (CRC, 2009):
http://www.ms.unimelb.edu.au/spuRs/
More information about the R-help
mailing list