baptiste auguie wrote:
> Hi,
>
> something like this perhaps,
>
>
> create_string <- function(.s){
>     result <- read.table(textConnection(.s))
>     sapply(result, as.character)
> }
>
> (test <- create_string("ab cd ef"))

or:

unlist(strsplit('ab cd ef', split=' '))

vQ

>
> hope this helps
>
> baptiste
>
> On 20 Feb 2009, at 16:38, Sean Zhang wrote:
>
>> My dear R-helpers:
>>
>> I am a novice in R and have the following text string manipulation
>> question.
>>
>> Is there a function that performs the job described below?
>> Say,
>> wanted_output <- c("ab", "cd", "ef")
>> #the function_wanted can generate  c("ab", "cd", "ef") using ab cd ef
>> as the
>> single input argument
>> wanted_output <- function_wanted(ab cd ef)
>>

______________________________________________
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.

Reply via email to