[datatable-help] Error in eval(expr, envir, enclos) : object 'BlaBla' not found

Kostia Kofman kofmank at gmail.com
Thu Aug 29 16:36:51 CEST 2013


Hi,

I'm new to R and data.table and having some difficulties with a certain
function that I wrote.

the function code:

freq_per = function(data,byWhat,month){
    for (i in 1:length(month)){
        data = data.table(data)
        data[,percent :=sum(freq),by = byWhat]
        data[,percent := (freq/percent)*100]
        data = data.frame(data)
        data$percent = format(round(data$percent),nsmall = 2)
    }
    data

}

I have tried to call the function with freq_per(data,list(BlaBla),month)
and get the error message from the topic.

I have tried to create a global variable with byWhat = list(BlaBla), it
didn't work because the object 'BlaBla' not found.

I also tried to use keyby instead of by with  c(colnames(data)[1]), but the
results that I got are not right.

anybody has an idea how to overcome the problem?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130829/cfc61b76/attachment.html>


More information about the datatable-help mailing list