Hi experts I want to read an excel file in an R-script and send the inputs to another script to more process the first file for reading the data is (First.R): wb <- loadWorkbook("adress") dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=strow, endRow=endrow, startCol=spalte, endCol=spalte,header=FALSE) datalist<-dat[,1] while(n<=length(datalist)) { m<-strsplit(datalist[n],split=",") m<-sapply(m,as.numeric) m<-c(m) input<-m n<-n+30 } and now, I want to use input in other R script for each loop (second.R), how can I do that [[alternative HTML version deleted]]
Duncan Murdoch
2014-Jan-08 17:52 UTC
[R] How to include (source) R script in other scripts
On 08/01/2014 11:27 AM, Baro wrote:> Hi experts > > I want to read an excel file in an R-script and send the inputs to another > script to more process > > the first file for reading the data is (First.R): > > wb <- loadWorkbook("adress") > dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=strow, > endRow=endrow, startCol=spalte, endCol=spalte,header=FALSE) > datalist<-dat[,1] > > while(n<=length(datalist)) > { > m<-strsplit(datalist[n],split=",") > m<-sapply(m,as.numeric) > m<-c(m) > > input<-m > > n<-n+30 > } > > and now, I want to use input in other R script for each loop (second.R), > how can I do thatYou should be using functions for this. Write a function that loads your workbook and does the processing above. Call that in a loop. Duncan Murdoch