I am quite new in R and has to work out an example of an operation that makes a new row after a certain string has occured in a single vector.
The vector is illustrated here:
address_list <- c("Road","Number","City","Zipcode","Telephone","House","Road","Number","City","Zipcode","House","Road","Number","City","Zipcode","Telephone","House")
The operation is to make a new row for every time "House" occurs. Leaving the vector into a matrix that goes:
Road,Number,City,Zipcode,Telephone,House
road,Number,City,Zipcode,,House
road,Number,City,Zipcode,Telephone,House
I do not know anything about Excel or VBA. But I could imagine that this question was sort of the same operation as I am looking to construct in R.
I came up with some pseudo-code that might give a more intuitive example of how i should think in order to solve this operation.
gsub(list, \s, ",")
For
every "House" in list as i
rbind(list, \n, i)