Read 2-dimensional array into R -
my data stored in text file looks this:
1, { {0, 1}, {1, 0}, {2, 6} } 2, { {0, 3}, {2, 2}, {0, 1} } ... the first element integer, , second 2-dimensional array. there function reads r?
data.frame( lapply( read.csv(text= "1, { {0, 1}, {1, 0}, {2, 6} } # read line character columns 2, { {0, 3}, {2, 2}, {0, 1} } # '{' , '}' non-syntactic characters ", header=false ), function(x) as.numeric( gsub("[^[:digit:]]", "", x) ) ) ) #---------------------- v1 v2 v3 v4 v5 v6 v7 1 1 0 1 1 0 2 6 2 2 0 3 2 2 0 1
Comments
Post a Comment