Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-
> bounces at stat.math.ethz.ch] On Behalf Of Agustin Lobo
> Sent: Wednesday, April 22, 2009 10:55 PM
> To: Jaime R. Garcia Marquez
> Cc: sig-geo
> Subject: Re: [R-sig-Geo] paste(" /" ") and paste(" /' ") for grass
> command
>
> True. Also, actually grass accepts where='(GRIDCODE = 11917)', so the
> practical problem is solved.
> Nevertheless, I find odd the different behavior of
>
> paste("\"","Hola","\"",sep="")
> and
> paste("\'","Hola","\'",sep="")
>
> the former printing the \
> while the second one does not.
>
> Thanks!
>
> Agus
>
> Jaime R. Garcia Marquez wrote:
> > Dear Agustin,
> >
> > I think that using the script paste("\"","Hola","\"",sep="") will do
> > the job anyway. Yes, you would get "\"Hola\"" as a result but when
> you
> > pass the script to GRASS the \ symbol will not be considered and so
> > you will get the string you are looking for.
> >
> > a <- "v.extract codigo_Montseny07_clump"
> > b <- paste("out=extract", 11917, sep="") c <- paste("(GRIDCODE = ",
> > 11917, ")", sep="") c <- paste("where=\"", c, "\"",sep="")
> >
> > string <- paste(a,b,c, sep=" ")
> > system(string)
> >
> >> string
> > [1] "v.extract codigo_Montseny07_clump out=extract11917
> > where=\"(GRIDCODE = 11917)\""
> >
> > When the command is read in GRASS the \ symbol will mean move to the
> > next line in the console.
> >
> > Best,
> >
> > Jaime -R
> >
> >
> > On Wed, 22 Apr 2009 10:31:55 +0200, Agustin Lobo
> > <alobolistas at gmail.com> wrote:
> >
> >> I wish to write "" using paste(), but
> >>
> >>> paste("\"","Hola","\"",sep="")
> >> [1] "\"Hola\""
> >>>
> >>
> >> while the same approach works with ''
> >>> paste("\'","Hola","\'",sep="")
> >> [1] "'Hola'"
> >>
> >> why this difference? how could I do it to get "Hola" ?
> >>
> >> I need this to write this string in R:
> >> v.extract codigo_Montseny07_clump out=extract11917 where="(GRIDCODE
> =
> >> 11917)"
> >>
> >> and pass it to grass. Something like:
> >> for (i in polis){
> >> system("g.region vect=codigo_Montseny07_clump") nomextract <-
> >> paste("extract",i,sep="") grcomm <- paste("v.extract
> >> codigo_Montseny07_clump out=",nomextract, " where=\"(GRIDCODE =
> >> ",i,")\" ",sep="")
> >> system(grcomm)
> >>
> >> ...
> >>
> >> Thanks
> >>
> >> Agus
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >