Thanks,It does work for the sample data.
When I use it for my actual data it is throwing this error
Error in data.frame(Sample = .samp, Chr = .set$Chr[1L], Start =
min(.set$Start), :
arguments imply differing number of rows: 1, 0
I am not able to understand Why I am getting this?
waiting for you
I only used textConnection for the sample data. Just put your file
name in the read.table; e.g.,
x<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','numeric','numeric'))
as you have in your email. I used 'x' in my code, so I replaced your
'm' with 'x'.
T
Hi Jim,
Thanks for the reply, ok but I dont want to use textConnection and paste
each line but want the input to be read from a file like
m<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','numeric','numeric').
So how do I incorporate that in your code.
Than
Hi,
This is the code that I wrote for 3 samples:
code:
>m<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','numeric','numeric','numeric'))
>
s<-data.frame(c(rle(m$Sample1)[[2]],rle(m$Sample2)[[2]],rle(m$Sample3)[[2]]),c(rle(m$Sample1)[[1]],rle(m$Sample2)[[1]]
The solution that I sent will handle the 150 different samples; just
list the column names in the argument to the top 'lapply'. You don't
need the 'rle' in my approach.
On Wed, Sep 28, 2011 at 2:13 PM, viritha k wrote:
> Hi,
> This is the code that I wrote for 3 samples:
> code:
>>m<-read.table(
Here one approach:
> x <- read.table(textConnection("Chr start end sample1 sample2
+ chr2 9896633 9896683 0 0
+ chr2 9896639 9896690 0 0
+ chr2 14314039 14314098 0 -0.35
+ chr2 14404467 14404502 0 -0.35
+ chr2 14421718 14421777 -0.43 -0.35
+ chr2 16031710 16031769 -0.43 -0.35
+ chr2 16036178 16036
6 matches
Mail list logo