[R] Select elements from text

R. Michael Weylandt michael.weylandt at gmail.com
Wed Jan 25 01:40:45 CET 2012


paste(text, collapse = " ")

Michael

On Tue, Jan 24, 2012 at 3:41 PM, mdvaan <mathijsdevaan at gmail.com> wrote:
> Thanks for the quick response. I get the latter part, but reading the text
> from MS word into R is problematic. I am able to read in (scan) all unique
> elements (following sep=" ") from the text, but unable to past everything
> together again. Any id on how to solve this? It looks like this now:
>
> text<-scan("test.txt", character(0), sep = " ")
>
>> text
>  [1] "Most"            "fundamentally,"  "it"              "has"
>  [5] "led"             "to"              "an"              "effort"
>  [9] "to"              "clarify"         "the"             "organizational"
> [13] "form"            "concept."        "According"       "to"
> [17] "them"            "[see"            "also"            "Smith,"
> [21] "Jones"           "and"             "Carroll"         "2002],"
> [25] "categories"      "emerge"          "as"              "audience"
> [29] "members"         "recognize"       "dissimilarities" "among"
> [33] "groups"          "of"              "consumers"       "and"
> [37] "label"           "them"            "as"              "members"
> [41] "of"              "a"               "common"          "set"
> [45] "[Nicol"          "2000]."
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Select-elements-from-text-tp4323947p4325174.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list