diff --git a/Exercise09Answer.R b/Exercise09Answer.R new file mode 100644 index 0000000..fc1da44 --- /dev/null +++ b/Exercise09Answer.R @@ -0,0 +1,31 @@ +#set working directory +setwd("C:Desktop/R Studio Projects/Biocomp_tutorial11") + +# define the function +cov_function <-function(dir,column_num,nrow=50){ + data <- list.files(dir) + cov <- 0 + + for(i in data){ + table <- read.table(file= i, header=TRUE, sep=",", stringsAsFactors=FALSE) + rows <- length(table[,col]) + if(rows