[Rd] [R-devel] what are labels in struct sxpinfo_struct from Rinternals.h mean?

2014-08-22 Thread PO SU

Dear Rdevelers,
     The following struct is in the Rinternals.h. I want to know  the meanings 
of labels or names like "gp,mark,obj,named,trace." . TKS!


struct sxpinfo_struct {
    SEXPTYPE type      :  5;/* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP
     * -> warning: `type' is narrower than values
     *              of its type
     * when SEXPTYPE was an enum */
    unsigned int obj   :  1;
    unsigned int named :  2;
    unsigned int gp    : 16;
    unsigned int mark  :  1;
    unsigned int debug :  1;
    unsigned int trace :  1;  /* functions and memory tracing */
    unsigned int spare :  1;  /* currently unused */
    unsigned int gcgen :  1;  /* old generation number */
    unsigned int gccls :  3;  /* node class */
}; /*   Tot: 32 */




--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R-devel] what are labels in struct sxpinfo_struct from Rinternals.h mean?

2014-08-22 Thread Prof Brian Ripley
Once again[*], you really should study the posting guide.  The 
documentation is the 'R Internals manual', and it does cover this.


fortunes::fortune(14) applies.

[*] After two postings on R-help which ignored it, one reply to which 
pointed out this manual.


On 22/08/2014 07:32, PO SU wrote:


Dear Rdevelers,
  The following struct is in the Rinternals.h. I want to know  the meanings of labels 
or names like "gp,mark,obj,named,trace." . TKS!


struct sxpinfo_struct {
 SEXPTYPE type  :  5;/* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP
 * -> warning: `type' is narrower than values
 *  of its type
 * when SEXPTYPE was an enum */
 unsigned int obj   :  1;
 unsigned int named :  2;
 unsigned int gp: 16;
 unsigned int mark  :  1;
 unsigned int debug :  1;
 unsigned int trace :  1;  /* functions and memory tracing */
 unsigned int spare :  1;  /* currently unused */
 unsigned int gcgen :  1;  /* old generation number */
 unsigned int gccls :  3;  /* node class */
}; /*   Tot: 32 */




--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Inconsistent handling of data frames in min(), max(), and mean()

2014-08-22 Thread Martin Maechler
> Gavin Simpson 
> on Thu, 21 Aug 2014 12:32:31 -0600 writes:

> This inconsistency recently came to my attention:
>> df <- data.frame(A = 1:10, B = rnorm(10)) 
>> min(df)
> [1] -1.768958
>> max(df)
> [1] 10
>> mean(df)
> [1] NA Warning message: In mean.default(df) : argument is
> not numeric or logical: returning NA

I would tend to agree (:-) that mean() should rather give an error here
(and read on).

> I recall the times where `mean(df)` would give
> `colMeans(df)` and this behaviour was deemed
> inconsistent. 

> It seems though that the change has removed one
> inconsistency and replaced it with another. 

The whole idea of removing the mean method for data frames was
that there are many more summary functions, e.g. median, and it
seems wrong to write a data frame method for each of them; then
why for *some* of them.
So we *did* keep the  Summary.data.frame  group method,
and that's why min(), max(), sum(),.. work  {though sum() will be
slightly slower than colSums()}.

When teaching R, the audience should learn to use  apply() or
similar functions, e.g. from the hadleyverse,
because that is the general approach of dealing with matrix-like
objects that is indeed how I think users should start thinking
of data frames.


> Am I missing good reasons why there couldn't be a
> `mean.data.frame()` method which worked like `max()` etc
> when given a data frame?
yes, see above.
[ There's no consistent end after that: Why is median() different, why would
 sd(), var(), ... not work ?]

>  Namely that they return the
> required statistic *only* when presented with a data frame
> of all numeric variables? E.g.

>> df <- data.frame(A = 1:10, B = rnorm(10), C =
>> factor(rep(c("A","B"), each
> = 5)))
>> max(df)
> Error in FUN(X[[1L]], ...) : only defined on a data frame
> with all numeric variables

> I would expect `mean(df)` to fail with the same error as
> for `max(df)` with the new example `df` but for would
> return the same as `mean(as.matrix(df))` or
> `mean(colMeans(df))` if given an entirely numeric data
> frame:

>> mean(colMeans(df[, 1:2]))
> [1] 2.78366
>> mean(as.matrix(df[, 1:2]))
> [1] 2.78366
>> mean(df[,1:2])
> [1] 2.78366

> I just can't see the sense in having `mean` work the way
> it does now?

I agree. It would be better to give an error.
E.g.,  mean.default could start with  

if(is.object(x)) 
   stop("there is no mean() method for ", class(x)[1], " objects")


> Thanks,
> Gavin

> -- 

> Gavin Simpson, PhD

>   [[alternative HTML version deleted]]
^
 ( hmmm... and that on R-devel ... )

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] markdown vignette with the vignette command

2014-08-22 Thread Leo Lahti
Dear list,

we have a markdown vignette for our package in vignette/vignette.md

This is not visible from within R with the vignette(package = "mypackage")
command.

I assume the reason is that the vignette function only shows PDF vignettes.
Is there any way to circumvent this and display markdown vignettes directly
from within R?

I tried to seek the answer from R archives and search engines but could not
find the solution so far.

best regards,
Leo Lahti

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] markdown vignette with the vignette command

2014-08-22 Thread Duncan Murdoch
On 22/08/2014, 6:09 AM, Leo Lahti wrote:
> Dear list,
> 
> we have a markdown vignette for our package in vignette/vignette.md
> 
> This is not visible from within R with the vignette(package = "mypackage")
> command.
> 
> I assume the reason is that the vignette function only shows PDF vignettes.
> Is there any way to circumvent this and display markdown vignettes directly
> from within R?
> 
> I tried to seek the answer from R archives and search engines but could not
> find the solution so far.
> 

If you are using a current version of R, it should just work.  For example,

vignette("knitr-markdown")

works for me when knitr is attached.  If knitr was not attached, I'd
have to list it in the pkg argument of the vignette call.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] markdown vignette with the vignette command

2014-08-22 Thread Leo Lahti
Solved, thanks!

Leo


On Fri, Aug 22, 2014 at 1:04 PM, Duncan Murdoch 
wrote:

> On 22/08/2014, 6:09 AM, Leo Lahti wrote:
> > Dear list,
> >
> > we have a markdown vignette for our package in vignette/vignette.md
> >
> > This is not visible from within R with the vignette(package =
> "mypackage")
> > command.
> >
> > I assume the reason is that the vignette function only shows PDF
> vignettes.
> > Is there any way to circumvent this and display markdown vignettes
> directly
> > from within R?
> >
> > I tried to seek the answer from R archives and search engines but could
> not
> > find the solution so far.
> >
>
> If you are using a current version of R, it should just work.  For example,
>
> vignette("knitr-markdown")
>
> works for me when knitr is attached.  If knitr was not attached, I'd
> have to list it in the pkg argument of the vignette call.
>
> Duncan Murdoch
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] markdown vignette with the vignette command

2014-08-22 Thread Duncan Murdoch

On 22/08/2014 8:06 AM, Leo Lahti wrote:

Solved, thanks!

Could you post a short description of the solution, in case this problem 
arises for anyone else?  These posts are archived, and can be a useful 
resource for others.


Duncan Murdoch



On Fri, Aug 22, 2014 at 1:04 PM, Duncan Murdoch 
mailto:murdoch.dun...@gmail.com>> wrote:


On 22/08/2014, 6:09 AM, Leo Lahti wrote:
> Dear list,
>
> we have a markdown vignette for our package in
vignette/vignette.md 
>
> This is not visible from within R with the vignette(package =
"mypackage")
> command.
>
> I assume the reason is that the vignette function only shows PDF
vignettes.
> Is there any way to circumvent this and display markdown
vignettes directly
> from within R?
>
> I tried to seek the answer from R archives and search engines
but could not
> find the solution so far.
>

If you are using a current version of R, it should just work.  For
example,

vignette("knitr-markdown")

works for me when knitr is attached.  If knitr was not attached, I'd
have to list it in the pkg argument of the vignette call.

Duncan Murdoch




__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] markdown vignette with the vignette command

2014-08-22 Thread Leo Lahti
I followed the instructions in
http://cran.r-project.org/web/packages/knitr/vignettes/knitr-markdown.html

   - add *.Rmd files under the vignettes directory
   - add VignetteBuilder: knitr to the DESCRIPTION file
   - specify the vignette engine \VignetteEngine{knitr::knitr} in the Rmd
   files (inside HTML comments)

Leo


On Fri, Aug 22, 2014 at 2:36 PM, Duncan Murdoch 
wrote:

> On 22/08/2014 8:06 AM, Leo Lahti wrote:
>
>> Solved, thanks!
>>
>>  Could you post a short description of the solution, in case this problem
> arises for anyone else?  These posts are archived, and can be a useful
> resource for others.
>
> Duncan Murdoch
>
>
>> On Fri, Aug 22, 2014 at 1:04 PM, Duncan Murdoch > > wrote:
>>
>> On 22/08/2014, 6:09 AM, Leo Lahti wrote:
>> > Dear list,
>> >
>> > we have a markdown vignette for our package in
>> vignette/vignette.md 
>>
>> >
>> > This is not visible from within R with the vignette(package =
>> "mypackage")
>> > command.
>> >
>> > I assume the reason is that the vignette function only shows PDF
>> vignettes.
>> > Is there any way to circumvent this and display markdown
>> vignettes directly
>> > from within R?
>> >
>> > I tried to seek the answer from R archives and search engines
>> but could not
>> > find the solution so far.
>> >
>>
>> If you are using a current version of R, it should just work.  For
>> example,
>>
>> vignette("knitr-markdown")
>>
>> works for me when knitr is attached.  If knitr was not attached, I'd
>> have to list it in the pkg argument of the vignette call.
>>
>> Duncan Murdoch
>>
>>
>>
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to (appropropriately) use require in a package?

2014-08-22 Thread Henrik Singmann

Dear Joshua,

Sorry for resurrecting this thread, but I was on holidays earlier. I also had 
that problem and unfortunately using loadNamespace() as suggested by Prof. 
Ripley didn't work in my case (the reason is that the cluster is created by the 
user and the call executed on the cluster can contain additional function calls 
from the loaded package which are passed by the user).

I settled on the following construct that doesn't seem to raise issues with R 
CMD check:

junk <- clusterCall(cl = cl, "require", package = "lme4", character.only = TRUE)

Let's hope it continues to not raise any flags.

Best,
Henrik


Am 08.08.2014 09:22, schrieb Joshua Wiley:

Dear Professor Ripley,

PkgB does not need to be on the search path---importing into the namespace
is fine.  I did not realize that namespace scoping ensured that if a
cluster is created from within a package, that packages entire environment
tree is available on all the workers.
I tried to apply how makeCluster works from an interactive R session, where
functions from packages that are loaded when the cluster is created are not
available on the workers, to how it works from within a package.

Thanks for your reply,

Josh



On Fri, Aug 8, 2014 at 4:47 PM, Prof Brian Ripley 
wrote:


The safe, elegant way to do this is to use namespace scoping: it is still
not at all clear why 'other code' needs PkgB *on the search path*.

In other cases seen in CRAN submissions, 'other code' has been in PkgA's
namespace, and hence things in PkgB's exports have been visible as it was
imported by PkgA and hence in the environment tree for functions in PkgA.
  Then namespace scoping will ensure that PkgB's namespace is loaded on the
cluster workers.



On 08/08/2014 00:58, Joshua Wiley wrote:


Someone kindly pointed out that it is not clear from my email why Depends
will not work.  A more complete example is:

PkgA:
f <- function(ncores) {
cl <- makeCluster(ncores)

clusterEvalQ(cl, {
  require(PkgB)
})
[other code]

### this is the code I want to work and need to be able to call
### PkgB functions on each of the cluster slaves
output <- parLapply(cl, 1:n, function(i) {
  [code from my package and using some functions from PkgB]
})

}

As far as I know, just because I add PkgB to the Depends (or imports,
whatever) of PkgA, does not mean that the cluster started by PkgA will
automatically have PkgB loaded and functions available.

Thanks!



On Fri, Aug 8, 2014 at 9:35 AM, Joshua Wiley 
wrote:

  Dear All,


What is the preferred way for Package A, to initialize a cluster, and
load
Package B on all nodes?

I am writing a package that parallelizes some functions through the use
of
a cluster if useRs are on a Windows machine (using parLapply and family).
   I also make use of another package in some of my code, so it is
necessary
to load the required packages on each slave once the cluster is started.

Right now, I have done this, by evaluating require(packages) on each
slave; however, Rcmd check has a note that I should remove the "require"
in
my code.

Thanks!

Josh

--
Joshua F. Wiley
Ph.D. Student, UCLA Department of Psychology
http://joshuawiley.com/
Senior Analyst, Elkhart Group Ltd.
http://elkhartgroup.com
Office: 260.673.5518








--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595







--
Dr. Henrik Singmann
Albert-Ludwigs-Universität Freiburg, Germany
http://www.psychologie.uni-freiburg.de/Members/singmann

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Inconsistent handling of data frames in min(), max(), and mean()

2014-08-22 Thread Gavin Simpson
Thanks Martin

(sorry about the HTML - GMail and my incompetent use of it; hopefully I've
beaten it into submission this time).

I can see the point of view, however the inconsistency remains whether one
patches the other summary stat functions to work as if given a matrix or
squash all the Summary.data.frame methods as well.

More comments in-line

On 22 August 2014 02:23, Martin Maechler  wrote:

> > Gavin Simpson 
> > on Thu, 21 Aug 2014 12:32:31 -0600 writes:
>
 

> >> mean(df)
> > [1] NA Warning message: In mean.default(df) : argument is
> > not numeric or logical: returning NA
>
> I would tend to agree (:-) that mean() should rather give an error here
> (and read on).
>
> > I recall the times where `mean(df)` would give
> > `colMeans(df)` and this behaviour was deemed
> > inconsistent.
>
> > It seems though that the change has removed one
> > inconsistency and replaced it with another.
>
> The whole idea of removing the mean method for data frames was
> that there are many more summary functions, e.g. median, and it
> seems wrong to write a data frame method for each of them; then
> why for *some* of them.
> So we *did* keep the  Summary.data.frame  group method,
> and that's why min(), max(), sum(),.. work  {though sum() will be
> slightly slower than colSums()}.
>

and gives a different answer, unless you meant sum(colSums(df)) == sum(df)?


> When teaching R, the audience should learn to use  apply() or
> similar functions, e.g. from the hadleyverse,
> because that is the general approach of dealing with matrix-like
> objects that is indeed how I think users should start thinking
> of data frames.


This actually came up because someone was wanting the mean over all columns
(of a dataset where columns represented repeated measures per patient,
rows), hence `apply()` is not really suitable here and we've switched the
example to do `mean(as.matrix(df))` to get what they wanted.

I wasn't suggesting having `mean()` do anything like `colMeans()` or the
`mean.data.frame` of old.

I was wondering why we couldn't gain some semblance of consistency by
making *all* (although I didn't mention them) these related functions work
on a data frame (with all numeric columns) as if it were a matrix, just
like `min()`, `max()`, `range()` etc do now.

> Am I missing good reasons why there couldn't be a
> > `mean.data.frame()` method which worked like `max()` etc
> > when given a data frame?
> yes, see above.
> [ There's no consistent end after that: Why is median() different, why
> would
>  sd(), var(), ... not work ?]


I don't see why they shouldn't if `max()` etc work *for an entirely numeric
data frame*.


> >  Namely that they return the

> required statistic *only* when presented with a data frame
> > of all numeric variables? E.g.
>


> > I just can't see the sense in having `mean` work the way
> > it does now?
>
> I agree. It would be better to give an error.
> E.g.,  mean.default could start with
>
> if(is.object(x))
>stop("there is no mean() method for ", class(x)[1], " objects")


That would give a nicer error message but wouldn't solve the deeper issue
of a lack of consistency, which *is* an issue for people when trying to
learn R.

So, can't we either kill off the summary group method for data frames or
identify a set of functions which should work similarly to the existing
summary group method members? Assuming that a patch would be forthcoming
with documentation rather than relying on RCore to do this manually?


> > Thanks,
> > Gavin
>
> > --
>
> > Gavin Simpson, PhD
>
> >   [[alternative HTML version deleted]]
> ^
>  ( hmmm... and that on R-devel ... )
>

Yeah, sorry. Hopefully fixed now!


G

-- 
Gavin Simpson, PhD

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Marius Hofert
Hi,

Both under the current R-devel (r66456) and a version from about 3
months ago, I experience the following behavior:

> parallel::detectCores(TRUE)
Error in system(cmd, TRUE) : error in running command
> traceback()
3: system(cmd, TRUE)
2: gsub("^ +", "", system(cmd, TRUE)[1])
1: parallel::detectCores(TRUE)
>

This is on Ubuntu 14.04. Does anybody else see this? [I currently have
quite a heavy workload, otherwise I would have installed and tested it
also under 3.1.1]

Cheers,

Marius

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Tobias Verbeke
- Original Message -
> From: "Marius Hofert" 
> To: "R-devel" 
> Sent: Friday, August 22, 2014 10:03:13 PM
> Subject: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : 
> error in running command
> 
> Hi,
> 
> Both under the current R-devel (r66456) and a version from about 3
> months ago, I experience the following behavior:
> 
> > parallel::detectCores(TRUE)
> Error in system(cmd, TRUE) : error in running command
> > traceback()
> 3: system(cmd, TRUE)
> 2: gsub("^ +", "", system(cmd, TRUE)[1])
> 1: parallel::detectCores(TRUE)
> >
> 
> This is on Ubuntu 14.04. Does anybody else see this? [I currently have
> quite a heavy workload, otherwise I would have installed and tested it
> also under 3.1.1]

Same under R 3.1.1

> parallel::detectCores(TRUE)
Error in system(cmd, TRUE) : error in running command

Best,
Tobias

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Rui Barradas

Hello,

Inline.

Em 22-08-2014 22:18, Tobias Verbeke escreveu:

- Original Message -

From: "Marius Hofert" 
To: "R-devel" 
Sent: Friday, August 22, 2014 10:03:13 PM
Subject: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : 
error in running command

Hi,

Both under the current R-devel (r66456) and a version from about 3
months ago, I experience the following behavior:


parallel::detectCores(TRUE)

Error in system(cmd, TRUE) : error in running command

traceback()

3: system(cmd, TRUE)
2: gsub("^ +", "", system(cmd, TRUE)[1])
1: parallel::detectCores(TRUE)




This is on Ubuntu 14.04. Does anybody else see this? [I currently have
quite a heavy workload, otherwise I would have installed and tested it
also under 3.1.1]


Same under R 3.1.1


parallel::detectCores(TRUE)

Error in system(cmd, TRUE) : error in running command


I'm Using R 3.1.1 on Windows 7 and it works.

> parallel::detectCores(TRUE)
[1] 4
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 


[5] LC_TIME=Portuguese_Portugal.1252

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

loaded via a namespace (and not attached):
[1] parallel_3.1.1

Rui Barradas


Best,
Tobias

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread William Dunlap
The same is true in R-2.14.1 on  Ubuntu 12.04.4 LTS .  Put a trace on
system with
  trace(system, quote(print(command)))
  parallel::detectCores(TRUE)
and you will see the offending shell command.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Aug 22, 2014 at 1:03 PM, Marius Hofert
 wrote:
> Hi,
>
> Both under the current R-devel (r66456) and a version from about 3
> months ago, I experience the following behavior:
>
>> parallel::detectCores(TRUE)
> Error in system(cmd, TRUE) : error in running command
>> traceback()
> 3: system(cmd, TRUE)
> 2: gsub("^ +", "", system(cmd, TRUE)[1])
> 1: parallel::detectCores(TRUE)
>>
>
> This is on Ubuntu 14.04. Does anybody else see this? [I currently have
> quite a heavy workload, otherwise I would have installed and tested it
> also under 3.1.1]
>
> Cheers,
>
> Marius
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread David Winsemius

On Aug 22, 2014, at 2:53 PM, Rui Barradas wrote:

> Hello,
> 
> Inline.
> 
> Em 22-08-2014 22:18, Tobias Verbeke escreveu:
>> - Original Message -
>>> From: "Marius Hofert" 
>>> To: "R-devel" 
>>> Sent: Friday, August 22, 2014 10:03:13 PM
>>> Subject: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) 
>>> : error in running command
>>> 
>>> Hi,
>>> 
>>> Both under the current R-devel (r66456) and a version from about 3
>>> months ago, I experience the following behavior:
>>> 
 parallel::detectCores(TRUE)
>>> Error in system(cmd, TRUE) : error in running command
 traceback()
>>> 3: system(cmd, TRUE)
>>> 2: gsub("^ +", "", system(cmd, TRUE)[1])
>>> 1: parallel::detectCores(TRUE)
 
>>> 
>>> This is on Ubuntu 14.04. Does anybody else see this? [I currently have
>>> quite a heavy workload, otherwise I would have installed and tested it
>>> also under 3.1.1]
>> 
>> Same under R 3.1.1
>> 
>>> parallel::detectCores(TRUE)
>> Error in system(cmd, TRUE) : error in running command
> 
> I'm Using R 3.1.1 on Windows 7 and it works.
> 
> > parallel::detectCores(TRUE)
> [1] 4
> > sessionInfo()
> R version 3.1.1 (2014-07-10)
> Platform: x86_64-w64-mingw32/x64 (64-bit)

Works on a 6 year-old MacPro with R 3.1.0

>  parallel::detectCores(TRUE)
[1] 8

>  sessionInfo()
R version 3.1.0 Patched (2014-04-21 r65431)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

-- 
david.

> 


David Winsemius
Alameda, CA, USA

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread William Dunlap
There is no /usr/sbin/sysctl on my Ubuntu 12.04 machine.  There is a
/sbin/sysctl, but it does not accept the '-n hw.ncpu' arguments.  Its
/usr/bin/nproc [-all] will tell the number of available [installed]
processing units and 'cat /proc/cpuinfo | grep processor | wc -l' will
also give the number of installed processing units.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Aug 22, 2014 at 3:17 PM, Marius Hofert
 wrote:
> Thanks, Bill. The output is:
>
>> trace(system, quote(print(command)))
>   parallel::detectCores(TRUE)
> Tracing function "system" in package "base"
> [1] "system"
>>
> Tracing system(cmd, TRUE) on entry
> [1] "/usr/sbin/sysctl -n hw.ncpu 2>/dev/null"
> Error in system(cmd, TRUE) : error in running command
>>
>
> On Fri, Aug 22, 2014 at 6:13 PM, William Dunlap  wrote:
>> The same is true in R-2.14.1 on  Ubuntu 12.04.4 LTS .  Put a trace on
>> system with
>>   trace(system, quote(print(command)))
>>   parallel::detectCores(TRUE)
>> and you will see the offending shell command.
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>>
>> On Fri, Aug 22, 2014 at 1:03 PM, Marius Hofert
>>  wrote:
>>> Hi,
>>>
>>> Both under the current R-devel (r66456) and a version from about 3
>>> months ago, I experience the following behavior:
>>>
 parallel::detectCores(TRUE)
>>> Error in system(cmd, TRUE) : error in running command
 traceback()
>>> 3: system(cmd, TRUE)
>>> 2: gsub("^ +", "", system(cmd, TRUE)[1])
>>> 1: parallel::detectCores(TRUE)

>>>
>>> This is on Ubuntu 14.04. Does anybody else see this? [I currently have
>>> quite a heavy workload, otherwise I would have installed and tested it
>>> also under 3.1.1]
>>>
>>> Cheers,
>>>
>>> Marius
>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Mauricio Zambrano-Bigiarini



On 22/08/14 16:03, Marius Hofert wrote:

Hi,

Both under the current R-devel (r66456) and a version from about 3
months ago, I experience the following behavior:


parallel::detectCores(TRUE)

Error in system(cmd, TRUE) : error in running command

traceback()

3: system(cmd, TRUE)
2: gsub("^ +", "", system(cmd, TRUE)[1])
1: parallel::detectCores(TRUE)




This is on Ubuntu 14.04. Does anybody else see this? [I currently have
quite a heavy workload, otherwise I would have installed and tested it
also under 3.1.1]


I also get the same error:

Error in system(cmd, TRUE) : error in running command


R 3.1.1 on Linux Mint 17 (based on Ubuntu 14.04)

sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] raster_2.2-31 sp_1.0-15

loaded via a namespace (and not attached):
[1] grid_3.1.1  lattice_0.20-29 tools_3.1.1

Cheers,

Mauricio

--
===
Assistant Professor,
Faculty of Environmental Sciences and EULA-Chile Centre
University of Concepcion, Concepcion, Chile
===
"The only things in life you regret, are
the risks that you didn't take" (Anonymous)
===
Linux user #454569 -- Linux Mint user
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Marius Hofert
Thanks, Bill. The output is:

> trace(system, quote(print(command)))
  parallel::detectCores(TRUE)
Tracing function "system" in package "base"
[1] "system"
>
Tracing system(cmd, TRUE) on entry
[1] "/usr/sbin/sysctl -n hw.ncpu 2>/dev/null"
Error in system(cmd, TRUE) : error in running command
>

On Fri, Aug 22, 2014 at 6:13 PM, William Dunlap  wrote:
> The same is true in R-2.14.1 on  Ubuntu 12.04.4 LTS .  Put a trace on
> system with
>   trace(system, quote(print(command)))
>   parallel::detectCores(TRUE)
> and you will see the offending shell command.
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Fri, Aug 22, 2014 at 1:03 PM, Marius Hofert
>  wrote:
>> Hi,
>>
>> Both under the current R-devel (r66456) and a version from about 3
>> months ago, I experience the following behavior:
>>
>>> parallel::detectCores(TRUE)
>> Error in system(cmd, TRUE) : error in running command
>>> traceback()
>> 3: system(cmd, TRUE)
>> 2: gsub("^ +", "", system(cmd, TRUE)[1])
>> 1: parallel::detectCores(TRUE)
>>>
>>
>> This is on Ubuntu 14.04. Does anybody else see this? [I currently have
>> quite a heavy workload, otherwise I would have installed and tested it
>> also under 3.1.1]
>>
>> Cheers,
>>
>> Marius
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Prof Brian Ripley
But parallel::detectCores(TRUE) is a call of desparation: this ran 
code intended for FreeBSD.


If all else fails read the help:

 It has methods to do so for Linux, OS X, FreeBSD, Solaris, Irix
 and Windows.  ‘detectCores(TRUE)’ could be tried on other
 Unix-alike systems.


On Fri, 22 Aug 2014, Marius Hofert wrote:


Thanks, Bill. The output is:


trace(system, quote(print(command)))

 parallel::detectCores(TRUE)
Tracing function "system" in package "base"
[1] "system"



Tracing system(cmd, TRUE) on entry
[1] "/usr/sbin/sysctl -n hw.ncpu 2>/dev/null"
Error in system(cmd, TRUE) : error in running command




On Fri, Aug 22, 2014 at 6:13 PM, William Dunlap  wrote:

The same is true in R-2.14.1 on  Ubuntu 12.04.4 LTS .  Put a trace on
system with
  trace(system, quote(print(command)))
  parallel::detectCores(TRUE)
and you will see the offending shell command.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Aug 22, 2014 at 1:03 PM, Marius Hofert
 wrote:

Hi,

Both under the current R-devel (r66456) and a version from about 3
months ago, I experience the following behavior:


parallel::detectCores(TRUE)

Error in system(cmd, TRUE) : error in running command

traceback()

3: system(cmd, TRUE)
2: gsub("^ +", "", system(cmd, TRUE)[1])
1: parallel::detectCores(TRUE)




This is on Ubuntu 14.04. Does anybody else see this? [I currently have
quite a heavy workload, otherwise I would have installed and tested it
also under 3.1.1]

Cheers,

Marius

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel