@@ -18,10 +18,14 @@ loadScrit <- function(){
1818 }
1919 return (fileName )
2020}
21- if (! require(" parallel" )) install.packages(" parallel" ) # The new parallel version requires library parallels
22- library(parallel )
21+ if (! require(" foreach" )) install.packages(" foreach" , repos = ' http://cran.us.r-project.org' ) # The new parallel version requires library parallels
22+ library(foreach )
23+
2324script <- suppressWarnings(readLines(" mainScript.interOp" )) # This triggers a warning but not an concern
25+ script <- suppressWarnings(readLines(" scripts/r.interOp" )) # This triggerss a warning but not an concern
26+
2427# From loading from a file have to conver to table matrix
28+ # script <- suppressWarnings(readLines(loadScrit()))
2529script <- as.matrix(script )
2630
2731# Remove all comments #######THIS COULD ALL BE NOT WORKING BC YOU HAVENT REDEFINED IT AS A MATRIX?
@@ -69,6 +73,9 @@ processBounds <- function(){
6973 for ( i in 1 : length(script [,1 ])){
7074 bounds <- rbind(bounds , findBounds(script , startingVal = counter ))
7175 counter <- findBounds(script , startingVal = counter )[2 ]
76+ if (is.null(counter )) {
77+ break ()
78+ }
7279 if (counter == length(script [,1 ])){
7380 break
7481 }
@@ -80,7 +87,16 @@ processBounds <- function(){
8087# Send Processing calls
8188
8289allbounds <- processBounds()
83- titleRows <- as.integer(allbounds [,1 ])
90+ # If there is only one function assigning a row wont always work
91+ # so we need to check first how many functions their are.
92+ if (length(allbounds ) != 3 ) {
93+ titleRows <- as.integer(allbounds [,1 ])
94+
95+ } else if (length(allbounds ) == 3 ) {
96+ titleRows <- as.integer(allbounds [,1 ])
97+ } else {
98+ print(" faital script error" )
99+ }
84100source(" processRequest.R" )
85101
86102Piper <- function (firstFunc , secondFunc ){
@@ -148,10 +164,10 @@ master <- function(){
148164 }
149165 }
150166}
151- # start_time <- Sys.time()
167+ start_time <- Sys.time()
152168master()
153- # end_time <- Sys.time()
154- # end_time - start_time
169+ end_time <- Sys.time()
170+ end_time - start_time
155171
156172
157173
0 commit comments