I want to rename the file in the directory by adding the prefix "signficant' if file$p.value<0.05
filenames<- list.files(".", pattern="\\.assoc.linear$")
dataset <- data.frame()
outdirectory <- "~/out"
lapply(filenames, function(x) {
for (x in filenames){
df <- fread(filenames[x], stringsAsFactors = F)
if (df$P.value<0.005){
paste0("significant_", x, '.txt', sep="")}}
dir.create(outdirectory)
file.copy(b, file.path(outdirectory, b))
})
I tried but failed with error message: "Error in if (input == "" || length(grep("\n|\r", input))) { : missing value where TRUE/FALSE needed"
Aucun commentaire:
Enregistrer un commentaire