[R] my function does not work for large data set

Jim Holtman jholtman at gmail.com
Thu Dec 16 23:57:07 CET 2010


I think that your object exceeds the limit of 2^31 elements. 

Sent from my iPad

On Dec 16, 2010, at 17:44, Changbin Du <changbind at gmail.com> wrote:

> Dear R community,
> 
> I have one function, it works for small data set, but does not work on large
> data set, can anyone help me with this?
> 
>> #creat new variable by dividing each aa dimer by total_length.
>> imper<-function(x, file) {
> +                    round(x/file$length, 5)
> +                     }
> 
> 
>> dim(test)
> [1]  999 2402
> 
>> test[varname[2:2401]]<- apply(as.matrix(test[varname[2:2401]]), 2,
> function (x) imper(x, test))
> 
> 
>> dim(dimer.nn)
> [1] 999554   2402
> 
>> dimer.nn[varname[2:2401]]<- apply(as.matrix(dimer.nn[varname[2:2401]]), 2,
> function (x) imper(x, dimer.nn))
> *
> Error in unlist(X, recursive = FALSE, use.names = FALSE) :
>  negative length vectors are not allowed*
> 
> 
> Thanks so much!
> 
> -- 
> Sincerely,
> Changbin
> --
> 
> Changbin Du
> DOE Joint Genome Institute
> Bldg 400 Rm 457
> 2800 Mitchell Dr
> Walnut Creet, CA 94598
> Phone: 925-927-2856
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list