[R] R system command does not work with objects/variables

Johann Hibschman jhibschman at gmail.com
Tue Aug 23 15:06:29 CEST 2011


syrvn <mentor_ at gmx.net> writes:

> If I store the path in a variable/object and call the perl script again it
> does not run and I don't know how to overcome that issue.
>
> p1 <- "../path1"
> p2 <- "../path2"
> p3 <- "../path3"
>
> system("perl p1 p2 p3")

You want something like:

  system(paste("perl", p1, p2, p3"))

Strings don't do interpolation by themselves; you need to tell R, via
the "paste" function, that you want to concatenate the strings together.

-Johann



More information about the R-help mailing list