# First step, was to create a folder with the data files for the analysis
# Set the WD for that directory
setwd("C://Embalonurids")
# Call all the names of the files in that folder
file.names <- dir(pattern = "*.txt")
#Make a LOOP for the analysis
for(i in 1:length(file.names)){file <- read.table(file.names[i],header=TRUE) # read the text files one by one
# Deducer code used
file[c("TBC")] <- recode.variables(file[c("TBC")] , "0 -> NA;")
# Create
new BW variable and data set then
change data file name for the analysis
BW<-within(file,BW<-Fmax-Fmin)
BW<-within(BW,FcH1<-Fc*.5)
BW<-within(BW,FcH3<-FcH1*3)
BatStats<-BW
BatStats<-Deducer::descriptive.table (vars = d (Dur,TBC,Fmin,Fmax,BW,Fmean,Fk,FcH1,Fc,FcH3,Sc,Pmc),data= BatStats,func.names =c("Valid N","Minimum","Maximum","Mean","St. Deviation"),func.additional= list(p75=function(x) quantile(x, c(0.75), na.rm=TRUE),p85=function(x) quantile(x, c(0.85), na.rm=TRUE),p90=function(x) quantile(x, c(0.90),na.rm=TRUE),p99=function(x) quantile(x, c(0.99),na.rm=TRUE)))
## Then the results need to be output
name <- as.character(paste(file.names[i], ".csv", sep="")) # this creates an element that will have the name of the file that is used in each run
# I have
tried both setting a new WD or simply defined where to writ the
results
setwd("C://Embalonurids/Results")
write.csv(BatStats, name) #this should assign the names of the files as it iterates one by one })
#also tried directing where to write the output
#write.csv(BatStats,name,file="C:\\Emballonurids\Results"))
If I manually load the data files in the data viewer window and run the steps one at a time it all works.
I would like to run this as an iteration as I
have > 200 data files to process and would love to have it
run in background while I am working on other things.
Is there way to add superscript text to an axis label (e.g., "km2" to "km2")? Thanks.
list1=list(name=dt1,name=dt2)
# define the function to be executed
function1= function(x) 2*x
# then run by applying the function to the list