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

Kostia Kofman kofmank at gmail.com
Thu Aug 29 16:57:01 CEST 2013


This is the error I receive trying "BlaBla" instead of list(BlaBla)


Error in `[.data.table`(data, , `:=`(percent, sum(freq)), by = byWhat) :
  Type of RHS ('integer') must match LHS ('character'). To check and
coerce would impact performance too much for the fastest cases. Either
change the type of the target column, or coerce the RHS of := yourself
(e.g. by using 1L instead of 1)



On Thu, Aug 29, 2013 at 5:44 PM, Frank Erickson <FErickson at psu.edu> wrote:

> Try "BlaBla" instead of list(BlaBla)
>
> (oops, forgot to reply to the mailing list the first time I sent this.
> Sorry for the double email, Kostia.)
>
>
> On Thu, Aug 29, 2013 at 9:36 AM, Kostia Kofman <kofmank at gmail.com> wrote:
>
>> 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.
>>
>>
>>
>> _______________________________________________
>> datatable-help mailing list
>> datatable-help at lists.r-forge.r-project.org
>>
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130829/f0a7938c/attachment.html>


More information about the datatable-help mailing list