r - How to use the for loop with function needing for a string field? -


i using smbinning r package compute variables information value included in dataset.

the function smbinning() pretty simple , has used follows:

result = smbinning(df= dataframe, y= "target_variable", x="characteristic_variable", p = 0.05) 

so, df dataset want analyse, y target variable , x variable of want compute information value statistics; enumerate characteristic variables z1, z2, ... z417 able use loop mechanize analysis process.

i tried use following loop:

for (i in 1:417) {  result = smbinning(df=data, y = "flag", x = "data[,i]", p=0.05)   } 

in order able compute information value each variable corresponding i column of dataframe.

the data class "data.frame" while resultone "character".

so, question how compute information value of each variable , store in object denominated result?

thanks! appreciated!

no sample data provided can hazard guess following work:

results_list = list()     (i in 1:417) {     current_var = paste0('z', i)     current_result = smbinning(df=data, y = "flag", x = current_var, p=0.05)     results_list[i] = current_result$iv } 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -