substring - split each character in R -


I have song.txt file

  *** ** [1] "White night shines on the snowy hill" should not be seen. [2] "A state of isolation, and it seems that I am queen" [3] "Wind revolves like this swirling storm which can not keep it inside; Paradise knows that I have tried" *** [4] "Do not let them see them, do not let them see" [5] "Be nice girl, you do not always feel free to leave, do not let them know" [6] "Now they know" ** ***   

I want to loop songs and fill in the elements of each list Because each element has a letter vector in the list, where the element of each vector is a word in the song

as

  [1] "" "" "" "" "" "" "" "" "" "" "Footprint" "" "" can be seen "." "A" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" I can not "try" "" "" "" "" "" "" "" "" "" "" "" "inside" "" "" "" "" " "" "Good girl" "always" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" 

"pseudo," "no", "feel", "" "" "" "" "" "" "" "" "First of all I words <-> vector ( "List", 2) .

has created an empty list, I think I should put the text first in a long character vector ***** with respect to the serial number and start

  star = "\\ * {5}" pindex = grep (star, page)   

What should I do next?

It looks like you Run (effective) strsplit , therefore, "the point of a single long character string divided by **** and spaces" (which I think is what you have?). Starts with:

  list_of_vectors & lt; - lapply (strsplit (song, split = "\\ * {5}"), function (x) {# split every poem by space - variant & lt; - strsplit (x, split = "") # Returns as a vector return (List (Split_verse))})   

The result should be a list of each poem, in each poem there should be each element of the vector consisting of each word. IF You are not working with a single character string in the read-in object, show us the file and how you are reading it;).

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -