Basic-Excel-R-Toolkit icon indicating copy to clipboard operation
Basic-Excel-R-Toolkit copied to clipboard

Execute and copy code in sheet

Open naiiiiii opened this issue 7 years ago • 0 comments

Hello !

I have 2 questions !

I define this function :

select_var <- function(...) { require(tidyverse) vars <- quos(...)

sous_df <- select(df, !!!vars) }

to select var in my dataframe !

Sub pre_process() On Error Resume Next tmp = Application.DisplayAlerts Application.DisplayAlerts = False Application.ActiveWorkbook.Sheets("test").Delete Application.DisplayAlerts = tmp On Error GoTo 0 Dim x As Variant 'Compute new variable x = "df$age = ceiling(age_calc(df$DOB, enddate = Sys.Date(), units = 'years', precise = TRUE))" y = "df$age_car = ceiling(age_calc(df$DOBCAR, enddate = Sys.Date(), units = 'years', precise = TRUE))" 'On entre les variables que l'on souhaite selectionner Z = "sous_df = select_var(age,age_car,CRM)" Application.Run "BERT.Exec", x Application.Run "BERT.Exec", y Application.Run "BERT.Exec", Z End Sub

I want to execute to have the value of Z (to make machine learning with this) And then copy the value like this , how can I do?

v = Application.Run("BERT.Call", "function", var1) Range("A1").Resize(UBound(v, 1), UBound(v, 2)) = v

Thank !

N

naiiiiii avatar Jun 26 '18 15:06 naiiiiii