Displaying 3 results from an estimated 3 matches for "removed8sampl".
Did you mean:
removed8samples
2018 Apr 16
5
how to write a loop to repetitive jobs
Hi All..,
I need to do the following repetitive jobs:
seg71 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen71/seg.pr3.csv", head=T)
seg71$id <-"sn71"
seg72 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen72/seg.pr3.csv", head=T)
seg72$id <-"sn72"
seg73 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen73/seg.pr3...
2018 Apr 16
0
how to write a loop to repetitive jobs
Hello,
The following might do it. Without data it's untested.
wd <- function(i){
paste0("C:/Awork/geneAssociation/removed8samples/neuhausen7", i,
"/seg.pr3.csv")
}
seg <- lapply(1:5, function(i) {
DF <-read.csv(wd(i))
DF$id <- paste0("sn7", i)
DF
})
seg <- do.call(rbind, seg)
row.names(seg) <- NULL
Hope this helps,
Rui Barradas
On 4/16/2018 9:54 PM, Ding, Yuan Ch...
2018 Apr 17
0
how to write a loop to repetitive jobs
Hello Ding,
try this:
seg <- list()
for ( d in 71:75) {
s <- paste0("seg",d)
sn <- paste0("sn",d)
Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep="")
setwd(Dir)
seg[[s]] <- read.csv("seg.pr3.csv", head=T)
seg[[s]]$id <- sn
}
Greetings,
Albrecht
--
Albrecht Kauffmann
alkauffm at fastmail.fm
Am Mo, 16. Apr 2018, um 22:54, schrieb Ding, Yuan Chun:
> Hi All..,
>
> I need...