Bug 14898 - parSapply fails with an error if list argument has one element
Summary: parSapply fails with an error if list argument has one element
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 2.15.0
Hardware: ix86 (32-bit) Windows 32-bit
: P5 minor
Assignee: R-core
Depends on:
Reported: 2012-04-28 18:55 UTC by Nick Ray
Modified: 2014-02-16 11:41 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Ray 2012-04-28 18:55:35 UTC
parSapply from package 'parallel' fails if the list argument contains a single element, whereas sapply works OK. See test case below:

cl = makeCluster(4,methods=FALSE)

fred = parSapply(cl,1:10,function(x){x}) # works fine

fred = parSapply(cl,1,function(x){x}) # gives an error
# Error in cut.default(i, breaks) : 'breaks' are not unique

fred = sapply(1,function(x){x}) # works fine



Windows Vista 32-bit. 

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
 [1] graphics  grDevices utils     datasets  grid      tcltk     parallel  stats     methods   base     

other attached packages:
[1] ggplot2_0.8.9   proto_0.3-9.2   reshape_0.8.4   plyr_1.7.1      quantmod_0.3-17 TTR_0.21-0      xts_0.8-2       zoo_1.7-6       Defaults_1.1-1 

loaded via a namespace (and not attached):
[1] lattice_0.20-6 tools_2.15.0  
Comment 1 Brian Ripley 2012-04-30 11:26:11 UTC
Fixed for 2.15.0 patched.
Comment 2 Jackie Rosen 2014-02-16 11:41:55 UTC
(spam comment removed)