[R] help on proportions

2013-01-31 Thread Srinivas Iyyer
Hi: Apologies for asking the following question. As this may sound very basic and stupid for this forum , I honestly do not know how to solve it and I do not have a teacher who can help me understand.   I have list of genes (200) that are involved in a particular process and I call this as a Pr

[R] re-arranging rows in data frame

2012-03-26 Thread Srinivas Iyyer
Hi: sorry for asking simple question (not simple for me though). I have a data frame something like this: ExpName Identifier value MM1-x1 GSK 0.02 MM1-x1 GSK2 0.001 MM1-x1 GSK3 0.04 MM1-x1 GSK4 0.1 MM1-X2 GSK 0.4 MM1-X2 GSK2 0.1 MM1-X2 GSK4 0.002 MMX-X3 GSK 0.4 MMX-X3 GSK2 0.23 I am

Re: [R] help with loops

2011-08-11 Thread Srinivas Iyyer
Thank you. that was very easy. -srini --- On Thu, 8/11/11, R. Michael Weylandt wrote: From: R. Michael Weylandt Subject: Re: [R] help with loops To: "Srinivas Iyyer" Cc: r-help@r-project.org Date: Thursday, August 11, 2011, 12:49 PM unlist() Michael Weylandt On Thu, Aug 11, 201

[R] help with loops

2011-08-11 Thread Srinivas Iyyer
hi I need help with list object. I have a list object > a <- c('apple','orange','grape') > b <- c('car','truck','jeep') > c <- list(a,b) > names(c) <- c('fruit','vehicle') > c $fruit [1] "apple" "orange" "grape" $vehicle [1] "car" "truck" "jeep" I want to write all the elements of this l

Re: [R] finding unique and max value from a data.frame

2008-10-23 Thread Srinivas Iyyer
October 23, 2008, 8:41 PM > ?aggregate > > x1 x2 > 1 a 4 > 2 b 3 > 3 c 2 > 4 a 1 > 5 c 2 > 6 f 3 > 7 g 4 > 8 f 5 > > aggregate(x$x2, list(x$x1), max) > Group.1 x > 1 a 4 > 2 b 3 > 3 c 2 > 4 f 5

[R] finding unique and max value from a data.frame

2008-10-23 Thread Srinivas Iyyer
Hi group, How can I identify an element with max value among duplicated elements all in a data frame Example: > x1 x1 x2 1 a 4 2 b 3 3 c 2 4 a 1 5 c 2 6 f 3 7 g 4 8 f 5 I want to be able to get a data frame with all unique(x1) with max value x1 x2 1 a 4 2 b 3 3 c 2

[R] extracting max row from data matrix

2008-09-07 Thread Srinivas Iyyer
dear group, i have a data matrix with some replicate items with different values. I want to extract the row with max value. for example: > x fruit weight 1 apple1.3 2 apple1.5 3 apple1.6 4 orange1.4 5 orange1.6 x is a data frame. I want to extract unique items from

[R] merging data frames

2008-05-16 Thread Srinivas Iyyer
Dear group, I have 3 different data frames. I want to merge all 3 data frames for which there is intersection. Say DF 1 and DF2 has 100 common elements in Column 1. DF3 does not have many intersection either with DF1 or with DF2. For names in column 1 not present in DF3 I want to introduce NA

[R] creating a list of lists from a data frame

2008-03-27 Thread Srinivas Iyyer
Dear group, I have a dataframe (x). (4 rows, 3 columns for example) I want to create a master list (my_list) from data frame. I want each row of x to be a list. I tried 3 different ways: writing a loop, using apply, and going through each row. Going through each row works for me. since I hav

Re: [R] subset list based on logical within element flag

2008-03-12 Thread Srinivas Iyyer
Hi I have the smililar question. I have a list: my_list <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) > my_list $name [1] "Fred" $wife [1] "Mary" $no.children [1] 3 $child.ages [1] 4 7 9 Now I want to search "Fred" and get attribute of that value which is 'name'.

Re: [R] Converting a data frame with values into a matrix/

2008-03-12 Thread Srinivas Iyyer
NAs. Thanks Srini --- Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Perhaps in this case: > > noquote(with(xx, tapply(NES, list(Class, Name), > paste))) > > > On 12/03/2008, Srinivas Iyyer > <[EMAIL PROTECTED]> wrote: > > Dear Group, > > I

[R] Converting a data frame with values into a matrix/

2008-03-12 Thread Srinivas Iyyer
Dear Group, I have a data frame like the following: x <- c("Mike","A",0.01) x1 <- c("Carl","A",0.2) x2 <- c("Gene","C",0.3) x3 <- c("James","A",-0.3) x4 <- c("Dough","B",0) xx <- rbind(x,x1,x2,x3,x4) colnames(xx)<-c("Name","Class","NES") xx <-as.data.frame(xx) > xx Name Class NES x Mike

Re: [R] Filling data frame data into a matrix - please help

2008-01-24 Thread Srinivas Iyyer
srini --- Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > d1 <- data.frame(d1) > d1$V3 <- as.numeric(as.character(d1$V3)) > xtabs(V3 ~ r1+c1, data=d1) > > You can substitute 0 with NA: > > d1.tb <- xtabs(V3 ~ r1+c1, data=d1) > d1.tb[d1.tb==0] &l

[R] Filling data frame data into a matrix - please help

2008-01-24 Thread Srinivas Iyyer
Dear group, I have a data.frame (d1) with various elements and a matrix (m1) created with NA (or 1s). I want to read each row,column in d1 and fill its numeric value in m1. Could some one help me because I have 130K rows and 500 column data.frame object and I was told that a for loop will take a

[R] List operations in R

2007-11-29 Thread Srinivas Iyyer
hello: I am very confused when it comes to list operations in R. I seek help in the following problem. I have two different vectors myIDs - a character vector with no names to their elements x2 - another character vector derived from unlisting a list where an element has both a name and value