Re: [R] Space between axis title and tick labels in persp plot in R (using vis.gam)

2022-07-07 Thread Uwe Ligges
R does not provide a native 3D coordinate syytem in base graphics. 
Therefore, persp() is rather a hack that plots everything based on its 
internal code into the device.
Labels are not in the marhings of the 2D coordinate system, hence the 
related par() are not functional.


I'd suggest to add the axis titles manually after the plot and keep the 
rest unless you want to look fpr alternatives to persp().


Best,
Uwe Ligges

On 06.07.2022 19:22, jade.shodan--- via R-help wrote:

Dear list,

I am making a perspective plot of my generalised additive model (GAM)
named a1b, using vis.gam() in mgcv, which in turn makes use of the
persp function in base R.

Code is as follows:

library(mgcv)
vis.gam(x = a1b,
 view = c("wbgt_max", "lag"),
 plot.type = "persp",
 xlab = "max WBGT (°C)",
 ylab = "lag (days)",
 zlab = "deaths",
 theta = 60,
 phi = 15,
 r = sqrt(3),
 d = 1,
 type = "response",
 ticktype = "detailed")

The plot can be found here:
https://stackoverflow.com/questions/72884763/space-between-axis-title-and-tick-labels-in-persp-plot-in-r-using-vis-gam

On the x and z-axes, the axis title and axis labels are plotted over each other.


I would like to:

1) increase the space between the axis titles and the tick labels for
the x and z- axes (WBGT and deaths) and
2) increase the space between the ticks and the tick labels.

I've looked up similar posts on StackOverflow, which suggest adding
the following code to the plot (and change the values for the
currently stated defaults):

par(mgp=c(3,1,0))

like

library(mgcv)
par(mgp=c(20,20,20))
vis.gam(x = a1b,
 view = c("wbgt_max", "lag"),
 etc.

However, this changes nothing at all to the plot. (I tried with c(20,
20, 20) , smaller values and larger ones).

Would be grateful for any suggestions!

Jade

__
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.


Re: [R] byte coding compiling.....

2022-07-07 Thread akshay kulkarni
Dear Uwe,
  I have attached the info from the parallel package 
description from my Rstudio IDE:

Package: parallel
Version: 4.1.2
Priority: base
Title: Support for Parallel computation in R
Author: R Core Team
Maintainer: R Core Team 
Contact: R-help mailing list 
Description: Support for parallel computation, including by forking
   (taken from package multicore), by sockets (taken from package snow)
   and random-number generation.
License: Part of R 4.1.2
Imports: tools, compiler
Suggests: methods
Enhances: snow, nws, Rmpi
NeedsCompilation: yes
Built: R 4.1.2; x86_64-w64-mingw32; 2021-11-01 18:38:05 UTC; windows

It says: NeedsCompilation: yes

How about it?

Yours sincerely,
AKSHAY M KULKARNI


From: Uwe Ligges 
Sent: Thursday, July 7, 2022 4:08 PM
To: akshay kulkarni ; Bert Gunter 

Cc: R help Mailing list 
Subject: Re: [R] byte coding compiling.



On 06.07.2022 19:54, akshay kulkarni wrote:
> Dear Bert,
>   Thanks for your reply...
>
> So
>> cmpfun(mclapply)

mclapply is already byte compiled as it is in a package.

You may want to
cmpfun(yourFunction)
the function that you use in the mclapply call.

Best,
Uwe Ligges


>
> should  do the job right?
>
> By the by, how can I give a reprex? Reprex of the code that I am giving to 
> mclapply (as FUN argument)?
>
> Yours sincerely,
> AKSHAY M KULKARNI
> 
> From: Bert Gunter 
> Sent: Wednesday, July 6, 2022 10:32 PM
> To: akshay kulkarni 
> Cc: R help Mailing list 
> Subject: Re: [R] byte coding compiling.
>
> Unlikely
>
> See here:
>   
> https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/
>
> Byte code compilation should be automatic in both cases, as I understand it. 
> Of course, I could be wrong due to special features of parallel  programming, 
> etc.
>
> A reprex might be helpful here.
>
> Cheers,
> Bert
>
>
> On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni 
> mailto:akshay...@hotmail.com>> wrote:
> Dear members,
>I am using pbmclapply, the progress bar version of 
> mclapply, from the parallel package. The point is, pbmclapply is three times 
> faster than mclapply, and I think the most probable reason would be that 
> pbmclapply is byte code compiled (I can think of no other reason).
>
> I know the cmpfun function from compiler package. If I do:
>
>> cmpfun(mclapply)
>
> will the job be done? The point is mclapply may look for other functions in 
> the parallel package. So I have to compile the whole package right? How do 
> you do that? or in general, how do you byte code compile a whole package?
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
>  [[alternative HTML version deleted]]
>
> __
> 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.
>
>[[alternative HTML version deleted]]
>
> __
> 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.

[[alternative HTML version deleted]]

__
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.


Re: [R] byte coding compiling.....

2022-07-07 Thread Rui Barradas

Hello,

Sorry to intrude in this thread but what NeedsCompilation means is that 
the package contains C, C++ or Fortran native code in a directory named src.


From the documentation, Writing R Extensions, section 1.1.1 The 
DESCRIPTION file:



The ‘NeedsCompilation’ field should be set to "yes" if the package 
contains native code which needs to be compiled, otherwise "no" (when 
the package could be installed from source on any platform without 
additional tools). This is used by install.packages(type = "both") in R 
>= 2.15.2 on platforms where binary packages are the norm: it is 
normally set by R CMD build or the repository assuming compilation is 
required if and only if the package has a src directory.



And package parallel does have a src directory with C code.


[1] 
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#The-DESCRIPTION-file



Hope this helps,

Rui Barradas

Às 16:38 de 07/07/2022, akshay kulkarni escreveu:

Dear Uwe,
   I have attached the info from the parallel package 
description from my Rstudio IDE:

Package: parallel
Version: 4.1.2
Priority: base
Title: Support for Parallel computation in R
Author: R Core Team
Maintainer: R Core Team 
Contact: R-help mailing list 
Description: Support for parallel computation, including by forking
(taken from package multicore), by sockets (taken from package snow)
and random-number generation.
License: Part of R 4.1.2
Imports: tools, compiler
Suggests: methods
Enhances: snow, nws, Rmpi
NeedsCompilation: yes
Built: R 4.1.2; x86_64-w64-mingw32; 2021-11-01 18:38:05 UTC; windows

It says: NeedsCompilation: yes

How about it?

Yours sincerely,
AKSHAY M KULKARNI


From: Uwe Ligges 
Sent: Thursday, July 7, 2022 4:08 PM
To: akshay kulkarni ; Bert Gunter 

Cc: R help Mailing list 
Subject: Re: [R] byte coding compiling.



On 06.07.2022 19:54, akshay kulkarni wrote:

Dear Bert,
   Thanks for your reply...

So

cmpfun(mclapply)


mclapply is already byte compiled as it is in a package.

You may want to
cmpfun(yourFunction)
the function that you use in the mclapply call.

Best,
Uwe Ligges




should  do the job right?

By the by, how can I give a reprex? Reprex of the code that I am giving to 
mclapply (as FUN argument)?

Yours sincerely,
AKSHAY M KULKARNI

From: Bert Gunter 
Sent: Wednesday, July 6, 2022 10:32 PM
To: akshay kulkarni 
Cc: R help Mailing list 
Subject: Re: [R] byte coding compiling.

Unlikely

See here:
   
https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/

Byte code compilation should be automatic in both cases, as I understand it. Of 
course, I could be wrong due to special features of parallel  programming, etc.

A reprex might be helpful here.

Cheers,
Bert


On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni 
mailto:akshay...@hotmail.com>> wrote:
Dear members,
I am using pbmclapply, the progress bar version of 
mclapply, from the parallel package. The point is, pbmclapply is three times 
faster than mclapply, and I think the most probable reason would be that 
pbmclapply is byte code compiled (I can think of no other reason).

I know the cmpfun function from compiler package. If I do:


cmpfun(mclapply)


will the job be done? The point is mclapply may look for other functions in the 
parallel package. So I have to compile the whole package right? How do you do 
that? or in general, how do you byte code compile a whole package?

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI

  [[alternative HTML version deleted]]

__
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.

[[alternative HTML version deleted]]

__
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.


[[alternative HTML version deleted]]

__
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.


Re: [R] byte coding compiling.....

2022-07-07 Thread Jeff Newmiller
That item refers to the package having some compiled language (e.g. C, C++, 
Fortran, etc) components. The very fact that it got installed confirms that 
compilation occurred... it would not be usable otherwise.

On July 7, 2022 8:38:49 AM PDT, akshay kulkarni  wrote:
>Dear Uwe,
>  I have attached the info from the parallel package 
> description from my Rstudio IDE:
>
>Package: parallel
>Version: 4.1.2
>Priority: base
>Title: Support for Parallel computation in R
>Author: R Core Team
>Maintainer: R Core Team 
>Contact: R-help mailing list 
>Description: Support for parallel computation, including by forking
>   (taken from package multicore), by sockets (taken from package snow)
>   and random-number generation.
>License: Part of R 4.1.2
>Imports: tools, compiler
>Suggests: methods
>Enhances: snow, nws, Rmpi
>NeedsCompilation: yes
>Built: R 4.1.2; x86_64-w64-mingw32; 2021-11-01 18:38:05 UTC; windows
>
>It says: NeedsCompilation: yes
>
>How about it?
>
>Yours sincerely,
>AKSHAY M KULKARNI
>
>
>From: Uwe Ligges 
>Sent: Thursday, July 7, 2022 4:08 PM
>To: akshay kulkarni ; Bert Gunter 
>
>Cc: R help Mailing list 
>Subject: Re: [R] byte coding compiling.
>
>
>
>On 06.07.2022 19:54, akshay kulkarni wrote:
>> Dear Bert,
>>   Thanks for your reply...
>>
>> So
>>> cmpfun(mclapply)
>
>mclapply is already byte compiled as it is in a package.
>
>You may want to
>cmpfun(yourFunction)
>the function that you use in the mclapply call.
>
>Best,
>Uwe Ligges
>
>
>>
>> should  do the job right?
>>
>> By the by, how can I give a reprex? Reprex of the code that I am giving to 
>> mclapply (as FUN argument)?
>>
>> Yours sincerely,
>> AKSHAY M KULKARNI
>> 
>> From: Bert Gunter 
>> Sent: Wednesday, July 6, 2022 10:32 PM
>> To: akshay kulkarni 
>> Cc: R help Mailing list 
>> Subject: Re: [R] byte coding compiling.
>>
>> Unlikely
>>
>> See here:
>>   
>> https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/
>>
>> Byte code compilation should be automatic in both cases, as I understand it. 
>> Of course, I could be wrong due to special features of parallel  
>> programming, etc.
>>
>> A reprex might be helpful here.
>>
>> Cheers,
>> Bert
>>
>>
>> On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni 
>> mailto:akshay...@hotmail.com>> wrote:
>> Dear members,
>>I am using pbmclapply, the progress bar version 
>> of mclapply, from the parallel package. The point is, pbmclapply is three 
>> times faster than mclapply, and I think the most probable reason would be 
>> that pbmclapply is byte code compiled (I can think of no other reason).
>>
>> I know the cmpfun function from compiler package. If I do:
>>
>>> cmpfun(mclapply)
>>
>> will the job be done? The point is mclapply may look for other functions in 
>> the parallel package. So I have to compile the whole package right? How do 
>> you do that? or in general, how do you byte code compile a whole package?
>>
>> Thanking you,
>> Yours sincerely,
>> AKSHAY M KULKARNI
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> 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.
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> 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.
>
>   [[alternative HTML version deleted]]
>
>__
>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.

-- 
Sent from my phone. Please excuse my brevity.

__
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.