[R] how to make R render plots faster

2013-11-22 Thread Abhishek Pratap
Hi All We are using R to spit out plots(heatmaps) which are being rendered on a shiny app (web page). Currently we are facing an issue with the time it takes R to render a plot taking out the time it takes to do the computation. Let me show the same through a contrived example. In this basic test

Re: [R] reshaping a data frame

2013-06-10 Thread Abhishek Pratap
40,12,replace=TRUE),stringsAsFactors=FALSE) >> >> library(reshape2) >> >> res<-dcast(within(temp1_df,{Seq1<-ave(value,names,variable,FUN=seq_along)}),names+Seq1~variable,value.var="value")[,-2] >> res >> # names w x >> #1 foo 29 28 &g

[R] reshaping a data frame

2013-06-09 Thread Abhishek Pratap
Hi Guys I am trying to cast a data frame but not aggregate the rows for the same variable. here is a contrived example. **input** temp_df <- data.frame(names=c('foo','foo','foo'),variable=c('w','w','w'),value=c(34,65,12)) > temp_df names variable value 1 foow34 2 foow

[R] manipulating R contingency tables

2013-04-05 Thread Abhishek Pratap
Hi Guys I am back with another thing that's puzzling me. I am creating contingency tables but then I want to filter out certain columns and also find if any entry in the table is 0. Example: gts labels A1 B2 G3 121 127 120 223 112 0 Here I want to remove B2 column

Re: [R] about subsetting vectors/list in R

2013-04-04 Thread Abhishek Pratap
On Thu, Apr 4, 2013 at 5:53 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > On Thu, Apr 4, 2013 at 7:46 PM, Abhishek Pratap > wrote: > > Hey Guys > > > > Getting spinned about a slick way to join every 2 entry in a list / > vector > > in R

[R] about subsetting vectors/list in R

2013-04-04 Thread Abhishek Pratap
Hey Guys Getting spinned about a slick way to join every 2 entry in a list / vector in R x=(rep(c('A','G','C','T'),1000)) A G C T A G C T etc form another list with entries as AG CT AG etc so join the first 2 and so on. Thanks!' '-Abhi [[alternative HTML version deleted]] _

[R] dividing values of each column in a dataframe

2012-02-06 Thread Abhishek Pratap
Hey Guys I want to divide(numerically) all the columns of a data frame by different numbers. Here is what I am doing but getting a weird error. The values in each column are not getting divided by the corresponding value in the denominator vector instead by the alternative values. I am sure I am

Re: [R] Comparing two gff/gtf files : de novo transcripts v/s reference

2011-10-24 Thread Abhishek Pratap
Hey Martin Thats exactly what I intended but sent it to general R list. Will post it again. Thanks for checking. -A On Mon, Oct 24, 2011 at 2:32 PM, Martin Morgan wrote: > On 10/24/2011 02:23 PM, Abhishek Pratap wrote: > >> Hi All >> >> I am wondering if people based o

[R] Comparing two gff/gtf files : de novo transcripts v/s reference

2011-10-24 Thread Abhishek Pratap
Hi All I am wondering if people based on their experience could share what methods one could use to compare two gff/gtf files. The reason why I want to do so is that we have constructed a RNA-Seq based transcriptome and would like to compare it with reference transcriptome we had from in-silico a

Re: [R] quick question : interpolating file name in pipe command

2011-05-05 Thread Abhishek Pratap
You can ignore my question I was able to figure out the way. I guess when I touch R after couple of weeks I am rusty. -Abhi On Thu, May 5, 2011 at 2:15 PM, Abhishek Pratap wrote: > Hi Guys > > I am trying to read a bunch of files in the loop but pipe function > which I use to cut

[R] quick question : interpolating file name in pipe command

2011-05-05 Thread Abhishek Pratap
Hi Guys I am trying to read a bunch of files in the loop but pipe function which I use to cut few columns is somehow unable to interpolate the file variable. eg: > file="check.txt" > data <- read.table(pipe("cut -f 2,3 file"), sep="\t", > col.names=c('pos','cov') ) cut: file: No such file or

[R] Clustering problem

2011-03-21 Thread Abhishek Pratap
Hi Guys I want to apply a clustering algo to my dataset in order to find the regions points(X,Y) which have similar values(percent_GC and mean_phred_quality). Details below. I have sampled 1% of points from my main data set of 85 million points. The result is still somewhat large 800K points and

Re: [R] Interactive/Dynamic plots with R

2011-02-28 Thread Abhishek Pratap
Thanks Greg for all the suggestions. -Abhi On Sat, Feb 26, 2011 at 2:07 PM, Tal Galili wrote: > Hello Abhishek, > Also notice that if you are on windows, then rggobi doesn't work for the > latest R (with ggobi 2.1.8) because of GTK/dll issues.  In such a > case, Greg's other suggestions are prob

Re: [R] Interactive/Dynamic plots with R

2011-02-26 Thread Abhishek Pratap
ountain Healthcare > greg.s...@imail.org > 801.408.8111 > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Abhishek Pratap >> Sent: Friday, February 25, 2011 12:37 AM >> To: r-help@r-

[R] Interactive/Dynamic plots with R

2011-02-24 Thread Abhishek Pratap
Hi Guys In order to look at a dense plot I would like to have the capability to plot dynamic/interactive. Before I try rgobi which I heard can help me; I would like to take your opinion. Thanks! -Abhi __ R-help@r-project.org mailing list https://stat.e

Re: [R] modifying factors in a data frame

2010-08-18 Thread Abhishek Pratap
t; > data1$sample <- as.factor(as.numeric(data1$sample)) > > HTH > > Peter Alspach > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > > project.org] On Behalf Of Abhishek Pratap > > Sent: Thur

[R] modifying factors in a data frame

2010-08-18 Thread Abhishek Pratap
Hi All I have a data frame in which on the columns is a factor with following levels Levels: M006 M0114 M0379 M0432 M0823 M1012 M1096 M1107 SW393 SW708 I want to change all the M006 to "1", M0114 to "2" and so on. What I am trying is not working. data1$sample[data1$sample =='M006'] <- "1" Warn

Re: [R] ShortRead with BWA

2010-04-27 Thread Abhishek Pratap
Hi Duke While your mails are most welcome to this mailing list. You may find the following mailing list more useful as it caters to the Bioconductor and Next Generation Sequencing stuff. Bioc-sig-sequencing mailing list > bioc-sig-sequenc...@r-project.org > https://stat.ethz.ch/mailman/listinfo/b

Re: [R] Merging files

2010-04-27 Thread Abhishek Pratap
Hi Alex merge wont write a file automatically. You need to use something which can direct the output to a file. write.table(merge12, file = "output.data" ) should do the trick. Read more at ?write.table -Abhi On Tue, Apr 27, 2010 at 5:23 PM, Alex Jameson wrote: > David, > > merg12 > > displa

Re: [R] Passing values to a function when using apply

2010-04-27 Thread Abhishek Pratap
Makes sense. Thanks guys for your quick reverts! -Abhi On Tue, Apr 27, 2010 at 3:34 PM, Erik Iverson wrote: > > > Abhishek Pratap wrote: >> >> Hi Guys >> >> Thank you for clearing something I dint know. Just wondering the >> reason of putting the word fun

Re: [R] Passing values to a function when using apply

2010-04-27 Thread Abhishek Pratap
Hi Guys Thank you for clearing something I dint know. Just wondering the reason of putting the word function(x) in the apply function when we have already declared stats function separately. I better understand how the arguments are passed. Thanks! -Abhi On Tue, Apr 27, 2010 at 2:46 PM, Erik I

Re: [R] Passing values to a function when using apply

2010-04-27 Thread Abhishek Pratap
gene) stats<- function(count,length_gene,total) { ( count/( total * (length_gene ) ) ) * ( 10^9) } Thanks! -Abhi On Tue, Apr 27, 2010 at 2:18 PM, Henrique Dallazuanna wrote: > Try this: > > apply( veh_drg_animal1[ , c("readCount","gene_length")] ,1,  stats, agr3 = &g

[R] Passing values to a function when using apply

2010-04-27 Thread Abhishek Pratap
Hi All Slightly lost on how should I pass values to a function I am calling using apply. apply( veh_drg_animal1[ , c("readCount","gene_length")] ,1, stats() ) here stats is a custom function where I want to pass two parameters from data frame as shown and a third argument which is constant per

Re: [R] Maximum Likelihood Estimation in R

2010-04-21 Thread Abhishek Pratap
Hey Henrik I dont do MLE myself but this recent blog might be helpful. http://www.johnmyleswhite.com/notebook/2010/04/21/doing-maximum-likelihood-estimation-by-hand-in-r/ -A On Wed, Apr 21, 2010 at 10:02 AM, Thomas Stewart wrote: > Two possible problems: > > (a) If you're working with a normal

Re: [R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
raightened out. > > -- > David. > > > On Apr 6, 2010, at 4:53 PM, Abhishek Pratap wrote: > > Just so you know >> >> length(intersect(data_lane6_snps$SNP, data_lane6_snps_rsid$SNP)) >> 796120 >> >> I just need to include the chr condition now where I am

Re: [R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
Just so you know length(intersect(data_lane6_snps$SNP, data_lane6_snps_rsid$SNP)) 796120 I just need to include the chr condition now where I am stuck. -Abhi On Tue, Apr 6, 2010 at 4:51 PM, Abhishek Pratap wrote: > Hi David > > I can understand looking the SNP data values it can be

Re: [R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
correct results since it is possible for two chromosomes to have a SNP at the same bp location so the merge needs to take both SNP position and Chromosome into account. Thanks! -Abhi On Tue, Apr 6, 2010 at 4:42 PM, David Winsemius wrote: > > On Apr 6, 2010, at 4:03 PM, Abhishek Pratap wrote: &

Re: [R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
And I should also add that if I merge only on one column it works fine but the result is not what I want. merge(data_lane6_snps, data_lane6_snps_rsid , by = c("SNP") : works as expected. Is the "chr" column being a factor creating probs here ? -A On Tue, Apr 6, 2010 at 4:03

Re: [R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
381 57122299 41899656 76990037 ... $ end : int 68143872 11071026 69423434 12394791 1302846 95330693 3921381 57122299 41899656 76990037 ... $ rsid: Factor w/ 797807 levels "rs10","rs1010",..: 100229 685690 505395 470219 780326 29342 29263 327909 434159 723152 ... On Tue,

[R] Merging data frames on two conditions

2010-04-06 Thread Abhishek Pratap
Hi Guys I have two data frames which I would like to merge on two conditions. I am doing the following (abstract form) new.data.frame <- merge(df1,df2, by=c("Col1","Col2")) It is giving me a null result. Basically I need to apply two conditions. I also tried sqldf but it is running forever.

Re: [R] Adding a prefix to all values in a col in a data.frame

2010-04-05 Thread Abhishek Pratap
Thanks Henrique. It works fine. Cheers! -Abhi On Mon, Apr 5, 2010 at 1:41 PM, Henrique Dallazuanna wrote: > Try this: > > DF <- transform(DF, V1 = sprintf('number%d', V1)) > > > On Mon, Apr 5, 2010 at 2:38 PM, Abhishek Pratap > wrote: > > Hi All &g

[R] Adding a prefix to all values in a col in a data.frame

2010-04-05 Thread Abhishek Pratap
Hi All I am looking for a way to prefix a constant value to all the rows in column in a data frame. Eg. V1 2 3 4 5 I want to make it like this V1 number2 number3 number4 number5 Thanks! -Abhi [[alternative HTML version deleted]] __ R-help@

Re: [R] Plotting 15 million points

2010-02-25 Thread Abhishek Pratap
(s) [1] 16750589 hist(log(s,10),breaks=100) Thanks! -Abhi On Thu, Feb 25, 2010 at 7:38 PM, Nordlund, Dan (DSHS/RDA) wrote: >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of Abhishek Pratap >> Sent: Th

[R] Plotting 15 million points

2010-02-25 Thread Abhishek Pratap
Hi All I have a vector of about 15 million numbers which I would like to plot. The goal is the see the distribution. I tired the usual steps. 1. Histogram : never gets complete my window freezes w/out log base 10 2. Density : I first calculated the kernel density and then plotted it which worke

Re: [R] Taking mean of 3 cols in data frame : error

2010-01-29 Thread Abhishek Pratap
Pratap wrote: > I see what is happening here. When I am reading the data frame values > from a csv file, they are not read as numerics. > > _A > > On Sat, Jan 30, 2010 at 12:29 AM, Abhishek Pratap > wrote: >> Hi All >> >> I am seeing quite a si

Re: [R] Taking mean of 3 cols in data frame : error

2010-01-29 Thread Abhishek Pratap
I see what is happening here. When I am reading the data frame values from a csv file, they are not read as numerics. _A On Sat, Jan 30, 2010 at 12:29 AM, Abhishek Pratap wrote: > Hi All > > I am seeing quite a silly thing for which I dont have much of > explanation. I want to take

[R] Taking mean of 3 cols in data frame : error

2010-01-29 Thread Abhishek Pratap
Hi All I am seeing quite a silly thing for which I dont have much of explanation. I want to take per row mean of 3 columns of a data frame. What I am getting is all NA in the result. Here is what I am doing apply(a[,1:3],1,mean) I get warnings. In mean.default(newX[, i], ...) : argument i

Re: [R] Operating on each row of data frame

2010-01-13 Thread Abhishek Pratap
,4)],1,mean),apply(d[,c(2,3,4)],1,sd)) > > HTH, > Stephan > > > Abhishek Pratap schrieb: > >> Hi All >> >> I have a data frame in which there are 4 columns . >> >> Column 1 : name >> >> Column 2-4 : values >> >> I would l

[R] Operating on each row of data frame

2010-01-13 Thread Abhishek Pratap
Hi All I have a data frame in which there are 4 columns . Column 1 : name Column 2-4 : values I would like to calculate mean/Standard error of values in column 2-4 and store them in column 5,6 respectively. I have done the following but doesn't seem to work mean_N_SE <-function(x) { name

Re: [R] Normalization of Data

2009-11-15 Thread Abhishek Pratap
function on R. > > > El dom, 15-11-2009 a las 16:29 -0800, Abhishek Pratap escribió: > > Hi All > > > > I am looking for some resource to learn data normalization. I understand > I > > am talking very broad here, I need something like a primer to give me a > jum

[R] Normalization of Data

2009-11-15 Thread Abhishek Pratap
Hi All I am looking for some resource to learn data normalization. I understand I am talking very broad here, I need something like a primer to give me a jump start. If you happen to know any good resource please do let me know. Cheers, -Abhi [[alternative HTML version deleted]] ___

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Abhishek Pratap
ptions, specifically the "sep" argument? Presumably, you > want, > > paste(a, b, sep = "") > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Abhishek Pratap > Sent: Wednesday, Sep

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Abhishek Pratap
I did try ?paste and paste(a,b,separator=""). same result Thanks, -Abhi On Wed, Sep 9, 2009 at 5:11 PM, milton ruser wrote: > You not tryed ?paste :-) > > paste(a,b,sep="") > > bests > > milton > > On Wed, Sep 9, 2009 at 5:08 PM, Abhishek Pra

[R] Joining Characters in R {issue with paste}

2009-09-09 Thread Abhishek Pratap
Hi Guys I am want to join to strings in R. I am using paste but not getting desirable result. For the sake of clarity, a quick example: > a="Bio" > b="iology" > paste(a,b) [1] "Bio iology" *There is a SPACE in the word biology which is what I dont want * Thanks, -Abhi [[alternative H

Re: [R] Writing R Scripts and passing command line arguments

2009-09-09 Thread Abhishek Pratap
on Rscript will help. Thanks, -Abhi On Mon, Sep 7, 2009 at 2:37 PM, cls59 wrote: > > > Abhishek Pratap wrote: > > > > > > 1. What's the best way to pass command line arguments to R scripts ? > > > > > > As Gabor mentioned, the commandArgs functi

[R] Writing R Scripts and passing command line arguments

2009-09-07 Thread Abhishek Pratap
Hi Guys I am Abhishek, primarily a bioinformatician. I have recently started using a lot of R thanks to some excellent packages available. Lately I have felt the need to batch process few of the R scripts I have been working with and strangely enough I am not able to find a good resource on how t