Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Exercise9_answers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

variancefunction <- function(dir,x){
files <- list.files(path = dir, pattern = "*.csv")

finalvector <- vector()
for(i in files){
a = 0
b = 0
if(i[,x] < 50){
print("Error less than 50 entries, type yes to continue, or anything else to break")
if(readline() == "yes"){
a<-mean(i[,x])
b<-sd(i[,x])
variancecoef = b/a
append(finalvector,variancecoef, after = length(finalvector))
}else{
break
}
}else{
a<-mean(i[,x])
b<-sd(i[,x])
variancecoef = b/a
append(finalvector,variancecoef, after = length(finalvector))
}
}

}