similar to: memory use without running gc()

Displaying 20 results from an estimated 4000 matches similar to: "memory use without running gc()"

2010 Jun 08
2
Extract/format/show for S4 objects
Hi all, I'm trying to make an integer-backed quarter (as in fraction of year) class, but I can't quite it to work. I want integer-backed so I don't have to worry about floating-point effects when doing math, and so that I can use it as in data.table. First of all, is there a good reference for this anywhere? All of the S4 tutorials that I've found have been too high-level, and
2012 Nov 27
1
best HDF5 package: h5r or rhdf5?
What is the current best package for manipulating HDF5 data files? I tried "hdf5" a long time ago, but I ran into memory problems. "h5r" is on CRAN now, and "rhdf5" is part of bioconductor. Ideally, I'd like to read simple vectors or tables, either the entire thing or a subset of rows. I don't need much writing support, but it would be nice. Compression is a
2009 Nov 09
1
zoo: bug with unique for yearmon
I'm using R 2.10.0, with zoo 1.5-8. The release notes for zoo 1.5-8 claim a bug with unique for yearmon objects has been fixed, but I'm still having problems. Browse[1]> tmp2 [1] "Dec 1996" "Dec 1996" Browse[1]> unique(tmp2) [1] "Dec 1996" "Dec 1996" Browse[1]> unique(unique(tmp2)) [1] "Dec 1996" Browse[1]> as.numeric(tmp2) -
2006 Oct 18
2
Multiple histograms in one plot
Hi all, I'm trying to plot multiple histograms in one plot (cross-validation values of model parameters), but I cannot seem to reduce the margins enough to fit as many of them in as I would like. I'm using split.screen to divide the window into a 5x4 grid, then plotting with hist. I've tried explicitly reducing the margins with par(mar=c(1,1,1,1)), but it doesn't seem to have
2007 Mar 22
2
dynamic linear models in R
Hi all, I've just started working my way through Mike West and Jeff Harrison's _Bayesian Forecasting and Dynamic Models_, and I was wondering if there were any publically-available packages to handle dynamic linear models, as they describe. I found the "dynlm" package, but either I don't yet understand what's going on or that package uses a different sense of the phrase
2011 Sep 14
2
External pointers and an apparent memory leak
I'm using external pointers and seemingly leaking memory. My determination of a memory leak is that the R process continually creeps up in memory as seen by top while the usage as reported by gc() stays flat. I have isolated the C code: void h5R_allocate_finalizer(SEXP eptr) { Rprintf("Calling the finalizer\n"); void* vector = R_ExternalPtrAddr(eptr); free(vector);
2012 Nov 22
1
Data Extraction - benchmark()
Hi Berend, I see you are one of the contributors to the rbecnhmark package. I am sorry that I am bothering you again. I have tried to run your code (slightly tweaked) involving the benchmark function, and I am getting the following error message. What am I doing wrong? Error in benchmark(d1 <- s1(df), d2 <- s2(df), d3 <- s3(df), d4 <- s4(df), : could not find function
2010 Sep 19
2
get time as a number
Hi, all, How to get a time as a number? While script is running, I want to print the elapsed time something like TIME_AS_SECOND() in the following script inittime <- TIME_AS_SECOND() for (i in 1:100){ do_something(i) curtime <- TIME_AS_SECOND() elapsedtime <- curtime-inittime print(paste(i, elapsedtime)) } Thanks in advance, Hyunchul [[alternative HTML version
2012 Jun 24
1
Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there "faster alternatives"?
Dear all, Indexing matrices from the Matrix package with [i,j] seems to be very slow. For example: library(rbenchmark) library(Matrix) mm <- matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20) MM <- as(mm, "Matrix") lookup <- function(mat){ for (i in 1:nrow(mat)){ for (j in 1:ncol(mat)){ mat[i,j] } } } benchmark(lookup(mm), lookup(MM),
2009 Jun 04
3
Fast way of finding top-n values of a long vector
If x is a (long) vector and n << length(x), what is a fast way of finding the top-n values of x? Some suggestions (calculating the ratio of the two top values): library("rbenchmark") set.seed(1); x <- runif(1e6, max=1e7); x[1] <- NA; benchmark( replications=20, columns=c("test","elapsed"), order="elapsed" , sort = {a<-sort(x,
2011 Jan 20
1
setGeneric for residuals, etc
I'm experimenting with a few model-fitting classes of my own. I'm leaning towards using S4 for my classes, but the R functions I'd want to override (residuals, predict, etc.) are all S3 methods. As I understand it, I could do setGeneric("residuals"), then add S4 specializations to it. However, I don't understand the full consequences of doing this. Are there any
2007 Jan 16
1
nonlinear regression: nls, gnls, gnm, other?
Hi all, I'm trying to fit a nonlinear (logistic-like) regression, and I'd like to get some recommendations for which package to use. The expression I want to fit is something like: y ~ A * exp(X * Beta1) / (1 + exp(-(x + X * Beta2 - xmid)/scal)) Basically, it's a logistic function, but I want to be able to modify the saturation amplitude by a few parameters (Beta1) and shift the
2012 Sep 18
2
extracting column and regular interval in R
Dear R users, i have a matrix with 31 rows and 444 columns and i want to extract every 37th column of that matrix starting from 1. more precisely i want to select columns 1, 38,75, 112 and so on. then doing the same by starting from column number 2(2,39,76,113.......). i know that there is a manual way of doing it but i wanted to make it more quickly as i have fairly large data to dealth with.
2011 Sep 14
1
substitute games with randomForest::partialPlot
I'm having trouble calling randomForest::partialPlot programmatically. It tries to use name of the (R) variable as the data column name. Example: library(randomForest) iris.rf <- randomForest(Species ~ ., data=iris, importance=TRUE, proximity=TRUE) partialPlot(iris.rf, iris, Sepal.Width) # works partialPlot(iris.rf, iris, "Sepal.Width") # works (function(var.name)
2009 Jun 19
1
Alternate ways of finding number of occurrence of an element in a vector.
Hi, I have a vector "v" and would like to find the number of occurrence of element "x" in the same. Is there a way other than, sum(as.integer(v==x)) or length(which(x==v)) to do the this. I have a huge file to process and do this. Both the above described methods are pretty slow while dealing with a large vector. Please have your comments. Praveen
2009 Nov 03
1
random text added to names (bug with 2.10.0?)
I'm using 2.10.0 on Linux (64 bit), and I just noticed that random numbers are occasionally added to the text of names in vectors. It's happened to me in two separate, long-running R sessions, but I can't find a way to reproduce it in a smaller setting. The code I'm using is > diag.gam.2 <- mdl.run.diag(fit.gam.2, ds.valid) > diag.gam.2 rmse mdae.1413751
2011 Apr 26
7
Second largest element from each matrix row
Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a <- matrix(rnorm(9), 3 ,3) sec.large <- as.vector(apply(a, 1, order, decreasing=T)[2,]) ans <- sapply(1:length(sec.large), function(i) a[i, sec.large[i]]) ans Thanks in advance for your
2017 Jun 14
2
[WISH / PATCH] possibility to split string literals across multiple lines
Mark, that's actually a fair statement, although your extra operator doesn't cause construction at parse time. You still call paste0(), but just add an extra layer on top of it. I also doubt that even in gigantic loops the benefit is going to be significant. Take following example: atestfun <- function(x){ y <- paste0("a very long", "string for
2012 Aug 24
6
updating elements of a vector sequentially - is there a faster way?
I would like to know whether there is a faster way to do the below operation (updating vec1). My objective is to update the elements of a vector (vec1), where a particular element i is dependent on the previous one. I need to do this on vectors that are 1 million or longer and need to repeat that process several hundred times. The for loop works but is slow. If there is a faster way, please let
2012 Sep 16
1
Possible Improvement of the R code
Dear all, In the following code, I was trying to compute each row of the "param" iteratively based on the first row. This likely is not the best way. Can anyone suggest a simpler way to improve the code. Thanks a lot! Hannah param <- matrix(0, 11, 5) colnames(param) <- c("p", "q", "r", "2s", "t") param[1,]