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

2016-03-21 Thread Stephen HK WONG
sing ifelse ? Thanks. From: 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 dat[, 4

[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
rough 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! Steph

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

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

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

2014-09-18 Thread Stephen HK Wong
using 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-projec

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

2014-08-01 Thread Stephen HK Wong
275 - chr13005558 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 t

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

2014-07-31 Thread Stephen HK Wong
_a_at", "1552902_a_at", "1552903_at"), Gene.Symbol = c("CORO6", "CDH23 /// LOC100653137", "IRF6", "GRHL1", "KCNH8", "CADM2", "TSNARE1", "KCNG3", "FOXP2", "B4GALNT2&quo