I have found similar issues resolved with NA omit, however I can't seem to have any luck with it though. could anyone advise me how why pathF might have zero rows? I'm new to R
library(tidyverse)
data_path <- paste (setwd ("Data"))
SamplesF <- list.files(path = data_path, pattern = "*.R1.fastq.gz", all.files = FALSE,
full.names = FALSE, recursive = FALSE,
ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)
TabF <- as.data.frame(SamplesF)
PathF <- data.frame(lapply(TabF, function(TabF) {gsub("Data/", "$PWD/N/", TabF)}))
PathF <- data.frame(lapply(PathF, function(PathF) {gsub("fastq.gz", "fastq.gip", PathF)}))
names(PathF)[names(PathF)=="SamplesF"] <- "absolute-filepath"
PathF['direction']='forward'
PathF['sample-id']= SamplesF
Heres the error:
Error in `[<-.data.frame`(`*tmp*`, "direction", value = "forward") :
replacement has 1 row, data has 0
Calls: [<- -> [<-.data.frame
Execution halted