[R] Importing data into R
smartpink111 at yahoo.com
Sat Jan 11 16:15:57 CET 2014
May be this helps:
url <- "http://genome.ucsc.edu/cgi-bin/hgc?hgsid=358528009&g=htcDnaNearGene&i=uc003qec.4&c=chr6&l=133562494&r=133853258&o=knownGene&hgSeq.promoter=on&boolshad.hgSeq.promoter=0&hgSeq.promoterSize=10759&hgSeq.utrExon5=on&boolshad.hgSeq.utrExon5=0&hgSeq.cdsExon=on&boolshad.hgSeq.cdsExon=0&hgSeq.utrExon3=on&boolshad.hgSeq.utrExon3=0&hgSeq.intron=on&boolshad.hgSeq.intron=0&hgSeq.downstream=on&boolshad.hgSeq.downstream=0&hgSeq.downstreamSize=9999&hgSeq.granularity=gene&hgSeq.padding5=0&hgSeq.padding3=0&boolshad.hgSeq.splitCDSUTR=0&hgSeq.casing=upper&boolshad.hgSeq.maskRepeats=0&hgSeq.repMasking=lower&submit=submit"
lines1 <- readLines(url,n=-1)
lines2 <- lines1[-c(1:3,6235)]
vec1 <- unlist(strsplit(lines2,""))
So I have a set of data here(note: ignore the first line, the data sets from the second line). There are
311,522 characters in total. I wish to import this into R such that each single character is in one cell, so I end up with a 311,522 by 1 column vector. However, when I copied the data into a text file and then
imported that into R, each line is recognized as one single "character"
and instead I end up with a column vector where each entry is the entire line rather than a single character.
How can I get around this?
More information about the R-help