similar to: mclapply Segmentation Fault for Ubuntu

Displaying 20 results from an estimated 100 matches similar to: "mclapply Segmentation Fault for Ubuntu"

2012 Oct 11
1
simplify2array edge case
Should simplify2array(higher=TRUE) treat 1 by 1 matrices differently than others? I expected a 3-dimensional array from all of the following 3 examples, not just the last 2. > str(simplify2array(list(array(11,c(1,1)), array(21,c(1,1))), higher=TRUE)) num [1:2] 11 21 > str(simplify2array(list(array(11:13,c(3,1)), array(21:23,c(3,1))), higher=TRUE)) int [1:3, 1, 1:2] 11 12 13 21 22
2024 Feb 08
1
Is simplify2array working for dimension > 2?
Reading the doc for ?simplify2array, I got the impression that with the 'higher = T' argument the function returns an array of dimension greater than 2 when it makes sense (the doc says "when appropriate", which is rather vague). I would expect a <- list( list(list(1, 2), list(3, 4)), list(list(5, 6), list(7, 8)) ) simplify2array(a, higher = T) to return the same
2024 Feb 08
1
Is simplify2array working for dimension > 2?
Jean-Claude: Well, here's my "explanation". Caveat emptor! Note that: "simplify2array() is the utility called from sapply() when simplify is not false" and > sapply(a, I, simplify = "array") [,1] [,2] [1,] list,2 list,2 [2,] list,2 list,2 So it seems that simplify2array() is not intended to operate in the way that you expected, i.e. that recursive
2013 Feb 14
3
list of matrices --> array
i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list <- list() my_list[[1]] <- matrix(1:20, ncol = 5) my_list[[2]] <- matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list to a 2x4x5 (or some other permutation of the dim sizes) array. i know i can initialize the array, then
2011 Aug 10
3
convert 'list' to 'vector'?
Dear all How does one convert a "non-symmetric" list to a vector? See below: > x <- list() > x[[1]] <- letters[1:5] > x[[2]] <- letters[6:10] > x[[3]] <- letters[11:12] > x [[1]] [1] "a" "b" "c" "d" "e" [[2]] [1] "f" "g" "h" "i" "j" [[3]] [1] "k"
2015 Apr 17
3
Redefining {
I am curious if anyone knows of R code where the "{" function is redefined in a useful way. Or "(" for that matter. Thanks Mick
2013 Apr 25
2
Decomposing a List
Greetings! For some reason I am not managing to work out how to do this (in principle) simple task! As a result of applying strsplit() to a vector of character strings, I have a long list L (N elements), where each element is a vector of two character strings, like: L[1] = c("A1","B1") L[2] = c("A2","B2") L[3] = c("A3","B3")
2018 Mar 13
4
Possible Improvement to sapply
While working with sapply, the documentation states that the simplify argument will yield a vector, matrix etc "when possible". I was curious how the code actually defined "as possible" and see this within the function if (!identical(simplify, FALSE) && length(answer)) This seems superfluous to me, in particular this part: !identical(simplify, FALSE) The preceding
2024 Apr 18
1
Tidyverse/dplyr solution for filling values of a tibble/dataframe from a column with a nested list.
Hi experts. I have a tibble? with a column containing a nested list (<list<list<double>>>? data type to be specific). Looks something like the following (but in R/Arrow? format): ID Nestedvals 001 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3)[[4]](4,0.4)[[5]](5,0.5) 002 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3)[[4]](4,0.4) 003 [[1]](1,0.1)[[2]](2,0.2)[[3]](3,0.3) 004 [[1]](1,0.1)[[2]](2,0.2)
2013 Aug 26
1
Loop for converting character columns to Numeric
Hi, Suppose you created a dataframe like this: set.seed(28) ?dat1<-as.data.frame(simplify2array(list(letters[1:5],sample(1:20,5,replace=TRUE),6:10)),stringsAsFactors=FALSE) ?str(dat1) #'data.frame':??? 5 obs. of? 3 variables: # $ V1: chr? "a" "b" "c" "d" ... # $ V2: chr? "1" "2" "10" "18" ... # $ V3: chr?
2012 Dec 31
3
weird bug with parallel, RSQlite and tcltk
Hello, I spent a lot of a time on a weird bug, and I just managed to narrow it down. In parallel code (here with parallel::mclappy, but I got it doMC/multicore too), if the library(tcltk) is loaded, R hangs when trying to open a DB connection. I got the same behaviour on two different computers, one dual-core, and one 2 xeon quad-core. Here's the code: library(parallel) library(RSQLite)
2012 Mar 30
1
How to use access results of gregexpr in data frames
Hello, I'm trying to figure out how to find the index of the second occurrence of "/" in a string (which happens to represent a date) within a data frame column. I've used the following code successfully to find the first instance of "/". dframe <- data.frame(date=c("5/14/2011", "4/7/2011")) dframe$x1 <- regexpr("/", dframe[, 1])
2018 Mar 13
0
Possible Improvement to sapply
Wouldn't that change how simplify='array' is handled? > str(sapply(1:3, function(x)diag(x,5,2), simplify="array")) int [1:5, 1:2, 1:3] 1 0 0 0 0 0 1 0 0 0 ... > str(sapply(1:3, function(x)diag(x,5,2), simplify=TRUE)) int [1:10, 1:3] 1 0 0 0 0 0 1 0 0 0 ... > str(sapply(1:3, function(x)diag(x,5,2), simplify=FALSE)) List of 3 $ : int [1:5, 1:2] 1 0 0 0 0 0 1 0 0
2011 Nov 15
2
using tapply() with the quantile function?
Hi: Summary: I am trying to determine the 90th percentile of ambulance response times for groups of data. Background: A fire chief would like to look at emergency response times at the 90th percentile for 1 kilometer grids in Cape Coral, Florida. I have mapped out ambulance response times on a GIS map. Then I superimpose a regularly-spaced grid over the response times and spatially join the
2018 Mar 13
2
Possible Improvement to sapply
Martin In terms of context of the actual problem, sapply is called millions of times because the work involves scoring individual students who took a test. A score for student A is generated and then student B and such and there are millions of students. The psychometric process of scoring students is complex and our code makes use of sapply many times for each student. The toy example used
2013 Mar 11
3
take two columns from a set of lists
say I have a matrix and lists like x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) x.list <- lapply(seq_len(nrow(x)), function(i) x[i,]) if I want a column of the matrix x, I write x[, 2] for example. But how can I do something similar for a set of lists, x.list, above? > x.list [[1]] [1] 12.1 0.1 12.0 1.1 [[2]] [1] 3.44 3.00 33.10 23.00 unlist(x.list)[,2] does
2018 Mar 13
1
Possible Improvement to sapply
You?re right, it sure does. My suggestion causes it to fail when simplify = ?array? From: William Dunlap [mailto:wdunlap at tibco.com] Sent: Tuesday, March 13, 2018 12:11 PM To: Doran, Harold <HDoran at air.org> Cc: r-help at r-project.org Subject: Re: [R] Possible Improvement to sapply Wouldn't that change how simplify='array' is handled? > str(sapply(1:3,
2020 Apr 04
5
Help useRs to use R's own Time/Date objects more efficiently
This is mostly a RFC [but *not* about the many extra packages, please..]: Noticing to my chagrin how my students work in a project, googling for R code and cut'n'pasting stuff together, accumulating this and that package on the way all just for simple daily time series (though with partly missing parts), using chron, zoo, lubridate, ... all for things that are very easy in base R *IF*
2018 Mar 13
0
Possible Improvement to sapply
On 03/13/2018 09:23 AM, Doran, Harold wrote: > While working with sapply, the documentation states that the simplify argument will yield a vector, matrix etc "when possible". I was curious how the code actually defined "as possible" and see this within the function > > if (!identical(simplify, FALSE) && length(answer)) > > This seems superfluous to me,
2011 Sep 30
1
Covariance-Variance Matrix and For Loops
Hello, I am very new to R (as my Subject probably indicates). I want to do something that should, I think, be very simple. I have five vectors in a list and I want to construct a covariance matrix out of them. Given a 5X5 matrix cvm1, and the list of vectors, cvm1_list, I thought the following would work (sorry cannot find code tags): for(i in 1:5){ for(j in 1:5){ cvm1[i,j] <-