[R] lapply function

2015-05-30 Thread Sohail Khan
Hi R Gurus, I am writing a simple function that take a numeric vector column from a data frame and scales the vector column with certain criteria. I would then pass this function to a list of dataframes by lappy. Question is how do I write a function that works on a numeric vector. My function

[R] Cluster -- Agnes function

2014-09-24 Thread Sohail Khan
Dear All, I have clustered a patient data set by agnes. I want to extract information for each cluster, I.E. all row ids belonging to each cluster. Thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list ht

Re: [R] reshape a dataset

2014-08-15 Thread Sohail Khan
names(d)), sapply(apply(d, 2, list), "[", 1)) > names(res)[1] <- "ID" > res > > HTH, > Jorge.- > > > > On Fri, Aug 15, 2014 at 7:19 PM, Jim Lemon wrote: > > > On Thu, 14 Aug 2014 06:08:51 PM Sohail Khan wrote: > > > Hi > > >

[R] reshape a dataset

2014-08-15 Thread Sohail Khan
Hi I have data set as follows: A 92315 A 35018 A 56710 B 52700 B 92315 B 15135 C 35018 C 52700 I would like to transform this data set into: ID 92315 35018 56710 52700 15135 A 1 1 1 0 0 B 1 0 0 1 1 C 0 1 0 1 0 I looked into reshape package to no avail. I would appreciate any suggestio