[R-es] Error al instalar paquete rgl en R 4.0.0 en Windows 10

2020-06-26 Thread Camila Martínez Ávila
Buenas noches.
Al intentar descargar e instalar el paquete "rgl" me indica que hay un
error en inDL y dice que no se pudo encontrar el objeto compartido y no se
puede cargar el paquete "shiny".
No sé cómo resolverlo.
Gracias, saludos.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] doParallel cores HPC

2020-06-26 Thread Henrik Bengtsson
> On the other hand, [...], you can spawn 20 workers on each of the 10 hosts:
>
> makePSOCKcluster(names = rep(c('Host01', ..., 'Host10'), each = 20))

Unfortunately, this will most likely not work because it will require
200 open connections - one for each worker - but R limits you to 125
(see ?base::connections):

> A maximum of 128 connections can be allocated (not necessarily open) at any 
> one time. Three of these are pre-allocated (see stdout). The OS will impose 
> limits on the numbers of connections of various types, but these are usually 
> larger than 125.

Depending on the system, you might be able to increase this by
rebuilding R from source after editing a hard-coded constant.  I've
verified that this worked on a local Ubuntu 16.04 system.  See
https://github.com/HenrikBengtsson/Wishlist-for-R/issues/28 for
details about this problem.

/Henrik

On Fri, Jun 26, 2020 at 12:11 AM Ivan Krylov  wrote:
>
> On Thu, 25 Jun 2020 00:29:42 +
> "Silva, Eder David Borges da"  wrote:
>
> > I have the HPC, with 10 nodes, and each node with 20 cores in UNIX OS.
>
> > cl <- makePSOCKcluster(names=c('Host01', ... , 'Host10)
>
> > This code is the best way for use all machine power?
>
> The code as written will create one worker _process_ on each of the
> hosts. What happens next depends on the code to be running and the way
> R is installed.
>
> The code may or may not be written to take advantage of multi-core CPUs
> (e.g. using OpenMP). In particular, if R is linked with a
> multi-threaded BLAS (such as OpenBLAS or MKL) and uses matrix algebra
> during the computation, it may spawn multiple _threads_ to utilise the
> CPU better. Whether it succeeds depends on multiple factors, including
> the size of the task. On occasion I noticed OpenBLAS threads spending
> most of their time in sched_yield() system call, making the kernel do a
> lot of unnecessary work, and set the environment variable
> OPENBLAS_NUM_THREADS=1 to use only one thread instead.
>
> On the other hand, if the computation is purely single-threaded (or you
> disabled the multi-threaded behaviour of OpenMP or BLAS for some
> reason), you can spawn 20 workers on each of the 10 hosts:
>
> makePSOCKcluster(names = rep(c('Host01', ..., 'Host10'), each = 20))
>
> You can also try to combine the two approaches by limiting the number
> of working threads to a sensible value which results in the threads
> spending most of the time computing things (instead of waiting for more
> work busy-looping on sched_yield()), then spawning as many processes as
> required to utilise all of the cores.
>
> --
> Best regards,
> Ivan
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R-es] Quedarse con las muestras de una BD que están presentes otra, basado en dos variables

2020-06-26 Thread Manuel Mendoza
Buenas tardes, quedarme con las muestras de una BD (data) que están
presentes en otra (datax), cuando se tiene una variable que nunca se repite
(Key) es fácil: data <- subset(data,data$Key %in% datax$Key).
Mi problema es cuando la exclusividad viene dada por dos variables. P.e.,
las coordenadas de un mapa: lon y lat.
¿Como puedo quedarme con las muestras de una df cuya lon y lat son iguales
a la de otra?
Gracias, como siempre,
Manuel

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Problema con un loop for

2020-06-26 Thread Manuel Mendoza
  Gracias Carlos, resuelto. Como dices, el problema era que dentro del loop
se suspendía la función print que partial trae por defecto, y lo único que
había que hacer es indicársela.

  predictores <- c("frg","omn","bc","co","pr","gg","fg","mf","br","hc")

  for(i in 1:length(predictores)){
windows()
print(partial(RFfit, pred.var = predictores[i], which.class = "Ard",
plot = T,
prob = T, chull=T, type="classification",plot.engine =
"ggplot2", rug=T))
  }


El mié., 24 jun. 2020 a las 19:54, Manuel Mendoza (<
>>> mmend...@fulbrightmail.org>) escribió:
>>>
 Gracias Carlos.
 Partial es del paquete pdp, que utiliza un objeto obtenido con el
 paquete randomforest
 Te copio un resumen del script que funciona todo menos el for final,
 aunque sí su interior si le doy a i un valor como 1

 library(randomForest)
 RFfit<- randomForest(ecsta ~ ., data=data)
 predictores <- c("frg","omn","bc","co","pr","gg","fg","mf","br","hc")

   for(i in 1:length(predictores)){
 windows()
 partial(RFfit, pred.var = predictores[i], which.class = "Ard", plot
 = T,
 prob = T, chull=T, type="classification",plot.engine =
 "ggplot2", rug=T)
   }


> El mié., 24 jun. 2020 a las 19:03, Manuel Mendoza (<
> mmend...@fulbrightmail.org>) escribió:
>
>> Vuelvo al ataque, pues ya os lo pregunté.  Javier Rubén me dió una
>> posible
>> explicación, pero finalmente no me resolvió el problema. Así que lo
>> vuelvo
>> a intentar, a ver si hay más suerte.
>>
>> Si hago, p.e., i = 1 y corro las 2 filas de dentro del loop que pongo
>> abajo, me abre una ventana y me hace el
>> partial() de frg, es decir, lo hace bien, pero si corro todo el loop,
>> me
>> abre las 9 ventanas (de 9 predictores) pero las deja vacías.
>>
>> predictores <- c("frg","omn","bc","co","pr","gg","fg","mf","br","hc")
>>
>> for(i in 1:length(predictores)){
>> windows()
>> partial(RFfit, pred.var = predictores[i], which.class = "Ard",
>> plot = T,
>> prob = T, chull=T, type="classification",plot.engine = "ggplot2",
>> rug=T)
>>   }
>>
>> Esto está, a su vez, dentro de otro loop con varias categorías, por
>> lo que
>> al final son 36 gráficos, que debo hacer con distintos parámetros,
>> por lo
>> que me sería muy útil solucionar el problema, que debe ser una
>> chorrada.
>>
>> Gracias por vuestra ayuda,
>> Manuel
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>

>>>
>>> --
>>> Saludos,
>>> Carlos Ortega
>>> www.qualityexcellence.es
>>>
>>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] doParallel cores HPC

2020-06-26 Thread Ivan Krylov
On Thu, 25 Jun 2020 00:29:42 +
"Silva, Eder David Borges da"  wrote:

> I have the HPC, with 10 nodes, and each node with 20 cores in UNIX OS.

> cl <- makePSOCKcluster(names=c('Host01', ... , 'Host10)
 
> This code is the best way for use all machine power?

The code as written will create one worker _process_ on each of the
hosts. What happens next depends on the code to be running and the way
R is installed.

The code may or may not be written to take advantage of multi-core CPUs
(e.g. using OpenMP). In particular, if R is linked with a
multi-threaded BLAS (such as OpenBLAS or MKL) and uses matrix algebra
during the computation, it may spawn multiple _threads_ to utilise the
CPU better. Whether it succeeds depends on multiple factors, including
the size of the task. On occasion I noticed OpenBLAS threads spending
most of their time in sched_yield() system call, making the kernel do a
lot of unnecessary work, and set the environment variable
OPENBLAS_NUM_THREADS=1 to use only one thread instead.

On the other hand, if the computation is purely single-threaded (or you
disabled the multi-threaded behaviour of OpenMP or BLAS for some
reason), you can spawn 20 workers on each of the 10 hosts:

makePSOCKcluster(names = rep(c('Host01', ..., 'Host10'), each = 20))

You can also try to combine the two approaches by limiting the number
of working threads to a sensible value which results in the threads
spending most of the time computing things (instead of waiting for more
work busy-looping on sched_yield()), then spawning as many processes as
required to utilise all of the cores.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.