I have a question about using the paste function and getwd function, my function is:
HTML_OUTPUT_ITERATIONS<-function(df_power_values, df_on_time_values, inventory_DF_List_on_time, DF_inventory_items){
require(R2HTML)
x<-1
DIRECTORY<-getwd()
FOLDER<-"/outputs"
OUTPUTS<-paste(DIRECTORY,FOLDER,sep="")
PATH_OUTPUTS<-gsub(" ","", OUTPUTS, fixed=TRUE)
HTMLStart(outdir=PATH_OUTPUTS, file="iterations",extension="html", echo=FALSE, HTMLframe=TRUE)
HTML.title("Iterations Log Report", HR=3)
HTMLhr()
HTML.title("Log results of iterations powers sequence", HR=2)
HTMLhr()
while(x<=length(inventory_DF_List)){
HTML.title("Power:")
HTML(df_power_values[x,1], digits=4)
HTML.title("Inventory:")
HTML(inventory_DF_List[x])
x<-x+1
}
HTMLhr()
HTML.title("Log results of iterations Time On sequence", HR=2)
HTMLhr()
while(x<=length(inventory_DF_List_on_time)){
HTML.title("Power:")
HTML(df_on_time_values[x,1], digits=4)
HTML.title("Inventory:")
HTML(inventory_DF_List_on_time[x])
x<-x+1
}
HTMLhr()
HTMLStop()
}
As you can see I'm using the library R2HTML. I've been debugging the code and I have not seen any fault, but I'm a very rare mistake. I think the mistake comes from the paste function, but not sure. I think the error is in this part of the code:
DIRECTORY<-getwd()
FOLDER<-"/outputs"
OUTPUTS<-paste(DIRECTORY,FOLDER,sep="")
PATH_OUTPUTS<-gsub(" ","", OUTPUTS, fixed=TRUE)
I'm using this code to get the path of the folder where the R project, and then add the outputs folder to save it the html report file
the error I get is as follows:
Error in rep(paste("\n\t\t<th>", if (sortableDF) "<b class=\"tablesort\">", :
invalid 'times' argument