[R] Error when using s.multinom() of the ade4 package - %PCA and MCOA

2012-09-07 Thread Fridolin
Hello, I am working with s.multinom() from the ade4package. I tried to plot the results of my %PCA (via the function dudi.pca()) followed by a MCOA (mcoa()). But when I give my variables to s.multinom() I get the following Error message: Error in FUN(1:14[[1L]], ...) : number 1 profile without da

[R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread Fridolin
What is a smart way to change an entry inside a column of a dataframe or matrix which is of type "factor"? Here is my script incl. input data: > #set working directory: > setwd("K:/R") > > #read in data: > input<-read.table("Exampleinput.txt", sep="\t", header=TRUE) > > #check data: > input I

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

2012-08-09 Thread Fridolin
all problems solved. thank you for your help! for the sake of completeness, here my solution: #1) read in data: daten<-read.table('K:/Analysen/STRUCTURE/test.txt', header=TRUE, sep="\t") daten<-as.data.frame(daten) #2) create empty matrix: indxind<-matrix(0,nrow=617, ncol=617) #indxind[1:20,1:19]

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

2012-08-09 Thread Fridolin
SORRY it should be: Fridolin wrote > > for (s in 3:6) { #walks though the matrix colum by colum, starting at > colum 3 > for (z1 in 1:5) { #for each current colum, take one row (z1)... > for (z2 in 1:5) { #...and compare it to another row (z2) of the > current

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

2012-08-09 Thread Fridolin
thank you for your help. my input data looks like this (tab separated): Ind.nr. Pop.nr. scm266 rms1280 scm247 rms1107 1 101 305 318 222 135 1 101 305 318 231 135 2 101 305 313 999 96 2 101 305 321 999 130 3

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

2012-08-08 Thread Fridolin
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] #3) compare cells to each other, score: fo