All Questions
Tagged with doparallel for-loop
11
questions
1
vote
1
answer
59
views
Parallelization in R
I am new to parallelization and I want to improve the current version of parallelization of my code to see if I can improve the time. I have 4 rasters and one shapefile with 9000 features. I want for ...
0
votes
0
answers
49
views
dopar% and %foreach% failed to work for gmapsdistance
I am currently trying to apply parallelization with the gmapsdistance package (driving mode = bicycling) to speed up the computation of the for loop that contains 1 origin and 100 destinations per ...
0
votes
1
answer
52
views
Unwanted result from parallel computation with forerach
I want to print a message after every 5 iterations in a loop. This works in a base R loop as follows:
vec = c() # empty vector
for (i in 1:100) {
s = sqrt(i)
vec = c(vec, s)
...
0
votes
1
answer
377
views
Parallelize set in data.table; works with for loop;but foreach %dopar% doesn't; foreach %do% works
I am trying to parallelize my code below; it works perfectly fine with foreach %do%; but not with %dopar%; could someone please help.
I did look at a few other posts and tried a few things but ...
0
votes
1
answer
330
views
Can I use the parallel version of for loop and apply family together?
I met one problem recently when I am doing my research: at first, I defined a function myfunction which contains two for loops in it and then I use lapply(datalist, myfunction), but the processing is ...
2
votes
1
answer
463
views
Solving univariate optimization problems simultaneously in R
I am going to use a very simple example to explain my problem (the real problem concerns a very complex univariate function). Consider the following univariate function
f <- function(x, p){ 10 - (...
2
votes
2
answers
2k
views
Produce a matrix using a foreach loop and parallel processing
I am trying to convert a for loop which I am currently using to run a process across a large matrix. The current for loop finds the maximum value within a 30 x 30 section and creates a new matrix with ...
2
votes
1
answer
213
views
R doParallel: couldn't find function
I have set up the following function:
cv_model <- function(dat, targets, predictors_name){
library(randomForest)
library(caret)
library(MLmetrics)
library(Metrics)
# set up error ...
3
votes
1
answer
6k
views
R Parallel processing error `Error in checkForRemoteErrors(val) : 6 nodes produced errors; first error: subscript out of bounds`
I'm learning parallel processing as a way to handle some huge datasets.
I have some variables predefined as below:
CV <- function(mean, sd) {(sd / mean) * 100}
distThreshold <- 5 # ...
1
vote
1
answer
113
views
speed up R code - vectorize?
I am struggling to make my code faster. Currently I am getting somewhere using doParallel, but I am wondering if it could be made faster though clever programming instead of faster hardware. Here is a ...
0
votes
1
answer
43
views
Efficiently and selectively combining columns in R
I have the following data
countrycols = alljson[,c("country_gc_str","country_ipapi_str","country_tm_str")]
head(countrycols)
country_gc_str country_ipapi_str country_tm_str
1 <NA> ...