search for: stephen66

Displaying 7 results from an estimated 7 matches for "stephen66".

2017 Jul 22
0
a difficult situation, how to do this using base function.
...nction(i){ test <- numex[[i]] val <- df[i,1] if(nrow(test) ==1 ) test[1,1]+val else { wm <- which(val < test[,2])[1] test[wm,1]+val - test[wm-1,2] } }) > df$updated [1] 1005 1510 6050 690 Cheers, Bert On Fri, Jul 21, 2017 at 4:24 PM, Honkit Wong <stephen66 at gmail.com> wrote: > Sorry for confusion, it was right, it should be: 600+(200-60-50)=690. > 60 and 50 are from difference of previous two ranges. Thanks! Any clue? > > Stephen (Hon-Kit) Wong > >> On Jul 21, 2017, at 4:13 PM, Bert Gunter <bgunter.4567 at gmail.com> w...
2018 Mar 01
3
how to make row.names based on column1 with duplicated values
Dear All, Suppose I have a dataframe like this with many thousands rows all with different names: data.frame(gene=c("a","b","c","d","c","d","c","f"),value=c(20,300,48,55,9,2,100,200)), I want to set column "gene" as row.names, but there are duplicates (c, d), which I want to transform into this as row names:
2018 May 25
0
how to make the code more efficient using lapply
...),] } myL <- lapply( X=list.files(), FUN=f ) temp.df.all<-do.call("rbind",myL) names(temp.df.all)<-gsub("^.*] ","",names(temp.df.all)) write_xlsx(temp.df.all, path="output.xlsx") HTH, Eric On Fri, May 25, 2018 at 9:24 AM, Stephen HonKit Wong <stephen66 at gmail.com> wrote: > Dear All, > > I have a following for-loop code which is basically intended to read in > many excel files (each file has many columns and rows) in a directory and > extract the some rows and columns out of each file and then combine them > together into a...
2018 May 25
2
how to make the code more efficient using lapply
Dear All, I have a following for-loop code which is basically intended to read in many excel files (each file has many columns and rows) in a directory and extract the some rows and columns out of each file and then combine them together into a dataframe. I use for loop which can do the work but quite slow. How to make it faster using lapply function ? Thanks in advance! temp.df<-c() #
2018 May 25
1
how to make the code more efficient using lapply
...f ) temp.df.all<-do.call("rbind",myL) names(temp.df.all)<-gsub("^.*] ","",names(temp.df.all)) write_xlsx(temp.df.all, path="output.xlsx") HTH, Eric On Fri, May 25, 2018 at 9:24 AM, Stephen HonKit Wong <stephen66 at gmail.com> wrote: > Dear All, > > I have a following for-loop code which is basically intended to read in > many excel files (each file has many columns and rows) in a directory and > extract the some rows and columns out of each file and then combi...
2018 Mar 01
0
how to make row.names based on column1 with duplicated values
On Wed, 28 Feb 2018, Stephen HonKit Wong wrote: > Dear All, > Suppose I have a dataframe like this with many thousands rows all with > different names: > data.frame(gene=c("a","b","c","d","c","d","c","f"),value=c(20,300,48,55,9,2,100,200)), > > I want to set column "gene" as row.names, but
2017 Jul 21
1
a difficult situation, how to do this using base function.
Hello, I have a following dataframe with many rows. data.frame(match.start=c(5,10,100,200),range.coordinates=c("1000-1050","1500-1555","5000-5050,6000-6180","100-150,200-260,600-900")) match.start range.coordinates 5 1000-1050 10 1500-1555 100 5000-5050,6000-6180 200