[R] help, please! matrix operations inside 3 nested loops

Berend Hasselman bhh at xs4all.nl
Wed Aug 8 17:33:36 CEST 2012


Fridolin wrote
> 
> hello, this is my script:
> 
> #1) read in data:
> daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt',
> header=TRUE, sep="\t")
> daten<-as.matrix(daten)
> 
> #2) create empty matrix:
> indxind<-matrix(nrow=617, ncol=617) 
> indxind[1:20,1:19]
> 

You should at least initialize indxind to 0 with

indxind<-matrix(0,nrow=617, ncol=617) 

because the default for matrix is to use NA for data.

Berend




--
View this message in context: http://r.789695.n4.nabble.com/help-please-matrix-operations-inside-3-nested-loops-tp4639592p4639621.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list