I have a dataframe(master) that has some variables which i have stored in the list below:
cont<-list("Quantity","Amt_per_qty","Trans_tax","Total_trans_amt")
catg<-list("Gender","Region_code","SubCategory")
I am trying to create a function where I can access the variables from dataframe and perform some function on them, though x and val in below function seems to resolve, how can I access the variables using the $ sign inside function
univar<-function (x){
for (val in cont){
print (val)
n<-nrow(x$val) }
print (n) }
univar(master)
Its returning NULL, I tried even with n<-nrow(x[,val]), that also don't seem to work.
[[instead of$c