[R] return output to console for copying as input

Enrico Schumann es at enricoschumann.net
Tue Jun 25 10:26:02 CEST 2013


On Tue, 25 Jun 2013, nevil amos <nevil.amos at gmail.com> writes:

> I want to print a vector of strings to the console formatted as if it were
> input
>
> X<-c("a","b","c")
>> X
> [1] "a" "b" "c"
>
> what I would like to get is
>
> the.function(X)
>>"a","b","c"
>
> what is the function?
>

the.function <- function(x)
    cat(paste0("\"", x, "\"", collapse = ", "), "\n")



-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-help mailing list