Perfect, thank you!
From: Jessica Streicher
To: Sarah Auburn
Cc: R help
Sent: Friday, 6 July 2012, 17:48
Subject: Re: [R] function on strsplit output
sap<-sapply(strsplit(m,","),as.numeric)
sap[which(sap <= 3)]<-0
mNew<-matrix(apply(sap,2,FUN=function(x){paste(x,
Hi,
I am trying to format some data (example matrix "m" below) for which each data
point has 2 associated values separated by a comma.
I want to replace values <3 with "0" to give the example output below.
I have got as far as:
out<-lapply(strsplit(m,","),as.numeric)
Failed to identify anything a
Thanks everyone for your help. All of the solutions posted (Arun, David, Jim
and Petr) worked for my problem.
From: arun
To: Sarah Auburn
Cc: R help
Sent: Tuesday, 3 July 2012, 2:13
Subject: Re: [R] R sub query
Hi,
Either of these should work:
m<-matrix(c(".:0:0,0", &quo
Thank you
From: Rui Barradas
To: Sarah Auburn
Cc: r-help@r-project.org
Sent: Monday, 2 July 2012, 17:39
Subject: Re: [R] table function in a matrix
Hello,
See the difference.
a <- b <- c("A", "A", "B", "B", "C", "A", &quo
Hello,
I would like to substitute a substring of characters defined by a specific
start and end sequence.
i.e. in the example matrix below, I would like to substitute ".:X:" with "",
where X varies in sequence...
m<-matrix(c(".:0:0,0", ".:2:0,2", ".:194:193,1", ".:56:0,56", ".:58:50,8",
".:13
Dear Petr,
Thanks for your help. Sorry one more query for one of my datasets which has NAs
(missing genotypes). Is there any way in which I can count NAs?
Many thanks!
Sarah
From: Sarah Auburn
To: Petr Savicky
Cc: "r-help@r-project.org"
Sent: Thursday, 7 June 2012, 23:24
Subje
Perfect, thank you!
From: Petr Savicky
To: r-help@r-project.org
Sent: Thursday, 7 June 2012, 19:42
Subject: Re: [R] table function in a matrix
On Wed, Jun 06, 2012 at 11:02:46PM -0700, Sarah Auburn wrote:
> Hi,
> I am trying to get a summary of the cou
Hi,
I am trying to get a summary of the counts of different variables for each
sample in a matrix of the form "m" below to generate an output as shown.
(Ultimately I want to generate a stacked barchart for each sample). I am only
able to get the "table" function to work on one sample (column) at
8 matches
Mail list logo