Luke Neraas
2007-Sep-19 00:23 UTC
[R] Create a loop to conduct multiple pairwise binary operations Retry
#Hello, # Sorry, my last letter contained an error this code should work #I have three data frames, X,Y and Z with two columns each and different numbers of rows. # creation of data frame X X.alleles <- c(1,5,6,7,8) X.Freq <- c(0.35, 0.15, 0.05 , 0.10, 0.35) Loc1 <- cbind( X.alleles,X.Freq) X <- data.frame(Loc1) #creation of data frame Y Y.alleles <- c(1,4,6,8) Y.Freq <- c(0.35, 0.35, 0.10, 0.20 ) Loc2 <- cbind(Y.alleles, Y.Freq) Y <- data.frame (Loc2) # creation of data frame Z Z.alleles <- c(1,4,5,6,8) Z.Freq <- c(0.35, 0.35, 0.05, 0.05, 0.20) Loc3 <- cbind(Z.alleles, Z.Freq) Z <- data.frame (Loc3) X Y Z # I want to create a pair wise multiplication for all of the second columns of my dataframe X,Y and Z # Here is a way to get two of the data frames to create a pairwise multiplication. X.Freq_times_Y.Freq<- matrix(Y[,2] %o% X[,2], ncol=1) X.Freq_times_Y.Freq # I would like to create a loop to calculate all possible pairwise multiplications for the # second columns of my X,Y, and Z data frames. # I will be conducting pair wise comparisons for up to 50 different data frames so I need the code to be # as flexible as possible Any help would be greatly appreciated. Thanks in advance Luke Neraas University of Alaska Fairbanks School of Fisheries and Ocean Sciences 11120 Glacier Highway UAF Fisheries Division Juneau, AK 99801 [[alternative HTML version deleted]]
Possibly Parallel Threads
- Help create a loopto conduct multiple pairwise operations
- How to multiply all dataframe rows by another dataframe's columns
- create data frame(s) from a list with different numbers of rows
- matching pairs regardless of order,multiple matches
- [LLVMdev] Limitations of Alias Analysis?