mary
2013-Jan-19 10:43 UTC
[R] import data (txt) separated by many blank spaces and lines with variable names that correspond to multiple observations.
Hello, I have read other posts and in part I tried to solve my problem. I have a txt file but the values ??as well as being separated by many blank spaces and lines eg. var_a var_b var_c 1 2 4 5 2 6 2 have an encoding problem in the header, let me explain: some of the variables grouping multiple observations throughout the text eg var_a = 1 var_b = 2,4,5 var_c=2 etc. now I have tried to achieve by removing the header and "doubling" the name of the variable where needed but the problem still remains to convert the data that come out like this: istr<-scan(file.choose(), what = "numeric", sep="\n",quote="\"'", n = -1, dec = ".",flush = FALSE, fill = FALSE, strip.white = TRUE, quiet = FALSE, blank.lines.skip = TRUE, multi.line = TRUE) [25877] "1\t\t \t \t \t1\t \t1\t1\t1\t \t2\t4\t [25878] "t5\t\t\t\t2\t6\t\t\t\t2" write.table(istr, qmethod = "double") "25877" "1 2 4 " "25878" " 5 2 6 2 " but remains the problem: - all numbers are in a unique quote "" (i would like a separeted cells) - in txt format variables are not exhausted all in the first line, but for example from the first to the fifth however, when R imports, each line seems to be an observation in my case an individual (n) how to solve it? -- View this message in context: http://r.789695.n4.nabble.com/import-data-txt-separated-by-many-blank-spaces-and-lines-with-variable-names-that-correspond-to-mult-tp4656041.html Sent from the R help mailing list archive at Nabble.com.
Reasonably Related Threads
- setting font in plots
- [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event
- Help with "MERGE" gratefully accepted
- descriptive statistics
- Assigning constant value without alloca/load/store