Re: [R] how to use vectorization instead of for loop

2016-03-21 Thread Stephen HK WONG
ifelse ? Thanks. From: ruipbarra...@sapo.pt <ruipbarra...@sapo.pt> Sent: Monday, March 21, 2016 11:50 AM To: Stephen HK WONG Cc: r-help@r-project.org Subject: Re: [R] how to use vectorization instead of for loop Hello, I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try

[R] how to use vectorization instead of for loop

2016-03-21 Thread Stephen HK WONG
Dear All, I have a dataframe like below but with many thousands rows, structure(list(gene_id = structure(1:6, .Label = c("0610005C13Rik", "0610007P14Rik", "0610009B22Rik", "0610009L18Rik", "0610009O20Rik", "0610010B08Rik,OTTMUSG0016609"), class = "factor"), log2.fold_change. = c(0.0114463,

[R] how to loop through dataframe objects in environment

2014-10-15 Thread Stephen HK Wong
all objects and perform the similar action ? One way I can think of is like this: for (i in 1:50){ get(ls()[i])[,3]+get(ls()[i][,4] } But I don't know how to save the addition result back to 5th column of each dataframe. Many Thanks! Stephen HK Wong

Re: [R] read.table() 1Gb text dataframe

2014-09-19 Thread Stephen HK Wong
on documentation. Stephen HK Wong Stanford, California 94305-5324 - Original Message - From: Henrik Bengtsson h...@biostat.ucsf.edu To: Stephen HK Wong hon...@stanford.edu Cc: r-help@r-project.org Sent: Thu, 18 Sep 2014 18:33:15 -0700 (PDT) Subject: Re: [R] read.table() 1Gb text dataframe

[R] read.table() 1Gb text dataframe

2014-09-18 Thread Stephen HK Wong
colbycol package, but it is not not available. Many thanks!! Stephen HK Wong Stanford, California 94305-5324 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

[R] How to randomly extract a number of rows in a data frame

2014-08-01 Thread Stephen HK Wong
3005558 3005593 - chr13005890 3005925 + chr13005929 3005964 + chr13005913 3005948 - chr13005913 3005948 - Stephen HK Wong __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] how to extract word before /// in a data frame contain many thousands rows.

2014-07-31 Thread Stephen HK Wong
, GRHL1, KCNH8, CADM2, TSNARE1, KCNG3, FOXP2, B4GALNT2 )), .Names = c(Probe.Set.ID, Gene.Symbol), row.names = c(NA, 10L), class = data.frame) Stephen HK Wong __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] urgent for R graphics

2007-09-24 Thread a hk
Hi, everyone, I am green with R. Now I am working on a graphics projects. I have a dataset: --- abc 1 228 83 6.69 2 274 83 7.36 3 320 83 8.86 4 366 83 7.36 5 412 83 6.81 6 228 129 5.58 - I want to