Please download the file into your computer,and run :
http://freeuploadfiles.com/bb3cwypih2d2
data=read.table("path/to/file", sep="|",quote='',
head=T,blank.lines.skip=T,as.is=T)
ddata=array(data,dim=c(nrow(data),ncol(data)))
ddata[1,1]
I want to extract the first element of the first column. The answer should be AAC.
How do I do that?
Some suggestions to clean your code and make life easier in the long term:
data.frame, not anarray.TRUEasT.TRUEis a reserved word that can never be redefined, whereasTcan take any value, includingFALSE<-symbol for assignmentheader, nothead. This might bite youArrays can only contain a single class of object. Thus converting your data to
arraywill implicitly convert thenumericcolumn tocharacter, which surely is a bad thing.You then index the data frame like this:
The following alternative ways of indexing also return the same element:
If you really want to do the foolish thing and convert your data to an array, then use
matrix:Disclaimer: I only post this since you ask. Arrays and matrices are powerful and fast, but not appropriate for this data.