0

I am trying to get output of Summary() function of R. I want my output in Excel. I have used BERT console to write my R function which calculates summary as below:

descriptive <- function(data){
  X <- summary(data)
  return(X)
}

I am able to run this and call in Excel as r.descriptive and also getting an output by selecting multiple cells and pressing the combination (Ctrl + Shift + Enter). Now, next I want to print the output using VBA.

I have used Application.Run(BERT.Call, ..)

But what exactly to write to get the output of summary using BERT function in VBA is confusing. I want to execute VBA code to print multiple cells output of summary function in BERT.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109

1 Answers1

0

If the spreadsheet function does exactly what you want, you can use that directly instead of using BERT.Call.

If you are using a spreadsheet function like =R.descriptive(A1:F10), then you can do the same thing in VBA using

x = Application.Run("R.descriptive", Range("A1:F10"))
duncan
  • 446
  • 3
  • 7