Re: [R] merging tables based on both row and column names

2015-10-01 Thread Giorgio Garziano
Replacing na.omit() with !is.na() appears to improve performance with time. rm(list=ls()) test1 <- (rbind(c(0.1,0.2),0.3,0.1)) rownames(test1)=c('y1','y2','y3') colnames(test1) = c('x1','x2'); test2 <- (rbind(c(0.8,0.9,0.5),c(0.5,0.1,0.6))) rownames(test2) = c('y2','y5') colnames(te

Re: [R] merging tables based on both row and column names

2015-10-01 Thread Giorgio Garziano
I reworked Frank Schwidom's solution to make it shorter than its original version. test1 <- (rbind(c(0.1,0.2),0.3,0.1)) rownames(test1)=c('y1','y2','y3') colnames(test1) = c('x1','x2'); test2 <- (rbind(c(0.8,0.9,0.5),c(0.5,0.1,0.6))) rownames(test2) = c('y2','y5') colnames(test2) = c(

Re: [R] merging tables based on both row and column names

2015-09-29 Thread Giorgio Garziano
Another approach: test1 <- data.frame(rbind(c(0.1,0.2),0.3,0.1)) rownames(test1) = c('y1','y2','y3') colnames(test1) = c('x1','x2'); test2 <- data.frame(rbind(c(0.8,0.9,0.5),c(0.5,0.1,0.6))) rownames(test2) = c('y2','y5') colnames(test2) = c('x1','x3','x2') > test1 x1 x2 y1 0.1 0.2 y2 0.3 0.

Re: [R] merging tables based on both row and column names

2015-09-28 Thread Frank Schwidom
test1 <- (rbind(c(0.1,0.2),0.3,0.1)) rownames(test1)=c('y1','y2','y3') colnames(test1) = c('x1','x2'); test2 <- (rbind(c(0.8,0.9,0.5),c(0.5,0.1,0.6))) rownames(test2) = c('y2','y5') colnames(test2) = c('x1','x3','x2') lTest12 <- list( test1, test2) namesRow <- unique( unlist( lapply( lTest12, ro

[R] merging tables based on both row and column names

2015-09-28 Thread C Lin
Dear R users, I am trying to merge tables based on both their row names and column names. My ultimate goal is to build a distribution table of values for each combination of row and column names. I have more test tables, more x's and y's than in the toy example below. Thanks in advance for your

Re: [R] Merging tables

2009-01-20 Thread Carlos J. Gil Bellosta
Hello, Use merge. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Tue, 2009-01-20 at 13:41 +, Dry, Jonathan R wrote: > I am relatively new to R and am trying to do some basic data manipulation. > Basically I have a table (csv - table 1) of data for a set of samples (

Re: [R] Merging tables

2009-01-20 Thread stephen sefick
?merge ?match On Tue, Jan 20, 2009 at 8:41 AM, Dry, Jonathan R wrote: > I am relatively new to R and am trying to do some basic data manipulation. > Basically I have a table (csv - table 1) of data for a set of samples (rows), > and a second table (table 2) of information about a subset of sam

[R] Merging tables

2009-01-20 Thread Dry, Jonathan R
I am relatively new to R and am trying to do some basic data manipulation. Basically I have a table (csv - table 1) of data for a set of samples (rows), and a second table (table 2) of information about a subset of samples of particular interest. I want to pull out the data from table 1 for th