[Rd] R CMD check

2005-09-14 Thread jing hua zhao
Dear r-devel members,

I tried to build R packages on a PC running Windows XP but experience 
problems. However, it is ok when there is no inst directory in a package.

Any help would be appreciated.

The following is an example,

C:\work>R CMD check VR_7.2-19.tar.gz
* checking for working latex ... OK
* using log directory 'C:/work/VR.Rcheck'
* using R version 2.1.1, 2005-06-20
* checking for file 'VR/DESCRIPTION' ... OK
* looks like 'VR' is a package bundle
* this is bundle 'VR' version '7.2-19'
* checking if this is a source bundle ... OK

installing R.css in C:/work/VR.Rcheck

Looks like `C:/work/VR.Rcheck/00_pkg_src/VR' is a package bundle


-- Making package MASS 
  adding build stamp to DESCRIPTION
  installing NAMESPACE file and metadata
  making DLL ...
making MASS.d from MASS.c
making lqs.d from lqs.c
gcc   -Ic:/PROGRA~1/r/rw2011/include -Wall -O2   -c MASS.c -o MASS.o
gcc   -Ic:/PROGRA~1/r/rw2011/include -Wall -O2   -c lqs.c -o lqs.o
ar cr MASS.a MASS.o lqs.o
ranlib MASS.a
windres --include-dir c:/PROGRA~1/r/rw2011/include  -i MASS_res.rc -o 
MASS_res.

gcc  --shared -s  -o MASS.dll MASS.def MASS.a MASS_res.o  
-c:/PROGRA~1/r/rw201/src/gnuwin32   -lg2c -lR
  ... DLL made
  installing DLL
  installing R files
  installing inst files
FIND: Parameter format not correct
make[2]: *** [C:/work/VR.Rcheck/MASS/inst] Error 2
make[1]: *** [all] Error 2
make: *** [pkg-MASS] Error 2
*** Installation of MASS failed ***

ERROR
Installation failed.

C:\work> path

PATH=C:\texmf\miktex\bin;C:\Perl\bin\;C:\Program 
Files\Insightful\splus62\;C:\WI
NDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
Files\Hummingbird\
Connectivity\9.00\Accessories\;C:\Program Files\Common 
Files\GTK\2.0\bin;C:\Prog
ram Files\WinSCP3\;C:\Program Files\PC-Pine



Jing Hua Zhao

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


Re: [Rd] R CMD check

2005-09-14 Thread jing hua zhao
yes, it does work now by putting the R environments in front of the original 
%path%.


>From: Duncan Murdoch <[EMAIL PROTECTED]>
>To: jing hua zhao <[EMAIL PROTECTED]>
>CC: r-devel@r-project.org
>Subject: Re: [Rd] R CMD check
>Date: Wed, 14 Sep 2005 07:04:57 -0400
>
>jing hua zhao wrote:
>>Dear r-devel members,
>>
>>I tried to build R packages on a PC running Windows XP but experience 
>>problems. However, it is ok when there is no inst directory in a package.
>>
>>Any help would be appreciated.
>>
>>The following is an example,
>>
>>C:\work>R CMD check VR_7.2-19.tar.gz
>>* checking for working latex ... OK
>>* using log directory 'C:/work/VR.Rcheck'
>>* using R version 2.1.1, 2005-06-20
>>* checking for file 'VR/DESCRIPTION' ... OK
>>* looks like 'VR' is a package bundle
>>* this is bundle 'VR' version '7.2-19'
>>* checking if this is a source bundle ... OK
>>
>>installing R.css in C:/work/VR.Rcheck
>>
>>Looks like `C:/work/VR.Rcheck/00_pkg_src/VR' is a package bundle
>>
>>
>>-- Making package MASS 
>>   adding build stamp to DESCRIPTION
>>   installing NAMESPACE file and metadata
>>   making DLL ...
>>making MASS.d from MASS.c
>>making lqs.d from lqs.c
>>gcc   -Ic:/PROGRA~1/r/rw2011/include -Wall -O2   -c MASS.c -o MASS.o
>>gcc   -Ic:/PROGRA~1/r/rw2011/include -Wall -O2   -c lqs.c -o lqs.o
>>ar cr MASS.a MASS.o lqs.o
>>ranlib MASS.a
>>windres --include-dir c:/PROGRA~1/r/rw2011/include  -i MASS_res.rc -o 
>>MASS_res.
>>
>>gcc  --shared -s  -o MASS.dll MASS.def MASS.a MASS_res.o  
>>-c:/PROGRA~1/r/rw201/src/gnuwin32   -lg2c -lR
>>   ... DLL made
>>   installing DLL
>>   installing R files
>>   installing inst files
>>FIND: Parameter format not correct
>
>Looks like a path problem.  There's a find command in the R tools, and a 
>completely different one in Windows.  You need to set your path to find the 
>R one first.
>
>Duncan Murdoch
>
>>make[2]: *** [C:/work/VR.Rcheck/MASS/inst] Error 2
>>make[1]: *** [all] Error 2
>>make: *** [pkg-MASS] Error 2
>>*** Installation of MASS failed ***
>>
>>ERROR
>>Installation failed.
>>
>>C:\work> path
>>
>>PATH=C:\texmf\miktex\bin;C:\Perl\bin\;C:\Program 
>>Files\Insightful\splus62\;C:\WI
>>NDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
>>Files\Hummingbird\
>>Connectivity\9.00\Accessories\;C:\Program Files\Common 
>>Files\GTK\2.0\bin;C:\Prog
>>ram Files\WinSCP3\;C:\Program Files\PC-Pine
>>
>>
>>
>>Jing Hua Zhao
>>
>>__
>>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


[Rd] R 2.2.0 + Oracle 10g + Windows XP

2005-12-14 Thread jing hua zhao
Dear R-devlopers,

I am experiencing problem with R 2.2.0 after installing Oracle 10g on my 
Windows XP system. It simply crashes but Rgui appears to be functioning. 
After I deinstalling Oracle 10g, R.exe start to function again. Any idea how 
to make them both working?

Many thanks,


Jinghua

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


Re: [Rd] [R] consider running tools::compactPDF(gs_quality = "ebook")

2018-07-08 Thread jing hua zhao

Idid this inside R; not ideal but worked.


From: R-devel  on behalf of Søren Højsgaard 

Sent: 08 July 2018 15:46
To: r-devel@r-project.org
Subject: Re: [Rd] [R] consider running tools::compactPDF(gs_quality = "ebook")

Dear all,

I run

R CMD build --compact-vignettes="both"  gRbase

and/or

R CMD build --compact-vignettes="gs+qpdf"  gRbase

and in the log from r-devel (on winbuilder) I get

* checking sizes of PDF files under 'inst/doc' ... WARNING
  'gs+qpdf' made some significant size reductions:
 compacted 'gRbase-arrays.pdf' from 421Kb to 115Kb
  consider running tools::compactPDF(gs_quality = "ebook") on these files

According to "writing R extensions" things should be fine (I have gs and qpdf 
on my system):

"The --compact-vignettes option will run tools::compactPDF over the PDF files 
in inst/doc (and its subdirectories) to losslessly compress them. This is not 
enabled by default (it can be selected by environment variable 
_R_BUILD_COMPACT_VIGNETTES_) and needs qpdf (http://qpdf.sourceforge.net/) to 
be available. "
QPDF: A Content-Preserving PDF Transformation 
System
qpdf.sourceforge.net
What is QPDF? QPDF is a command-line program that does structural, 
content-preserving transformations on PDF files. It could have been called 
something like pdf-to-pdf.



Can anyone please tell me what to do?

Best regards
S�ren

---

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.

6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

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

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

other attached packages:
[1] Rcpp_0.12.17shtools_1.0 markdown_0.8knitr_1.20
[5] rmarkdown_1.10  devtools_1.13.5

loaded via a namespace (and not attached):
 [1] lattice_0.20-35 digest_0.6.15   withr_2.1.2
 [4] rprojroot_1.3-2 grid_3.4.4  backports_1.1.2
 [7] magrittr_1.5evaluate_0.10.1 stringi_1.2.3
[10] curl_3.2RcppArmadillo_0.8.500.0 Matrix_1.2-14
[13] tools_3.4.4 RcppEigen_0.3.3.4.0 stringr_1.3.1
[16] compiler_3.4.4  memoise_1.1.0   htmltools_0.3.6




[[alternative HTML version deleted]]


[[alternative HTML version deleted]]

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


Re: [Rd] [R] consider running tools::compactPDF(gs_quality = "ebook")

2018-07-08 Thread jing hua zhao
A bit clarification -- tools::compactPDF() worked on the PDF at the current 
directory for me -- not sure about building PDF on the fly.


From: R-devel  on behalf of jing hua zhao 

Sent: 08 July 2018 16:00
To: Søren Højsgaard; r-devel@r-project.org
Subject: Re: [Rd] [R] consider running tools::compactPDF(gs_quality = "ebook")


Idid this inside R; not ideal but worked.


From: R-devel  on behalf of Søren Højsgaard 

Sent: 08 July 2018 15:46
To: r-devel@r-project.org
Subject: Re: [Rd] [R] consider running tools::compactPDF(gs_quality = "ebook")

Dear all,

I run

R CMD build --compact-vignettes="both"  gRbase

and/or

R CMD build --compact-vignettes="gs+qpdf"  gRbase

and in the log from r-devel (on winbuilder) I get

* checking sizes of PDF files under 'inst/doc' ... WARNING
  'gs+qpdf' made some significant size reductions:
 compacted 'gRbase-arrays.pdf' from 421Kb to 115Kb
  consider running tools::compactPDF(gs_quality = "ebook") on these files

According to "writing R extensions" things should be fine (I have gs and qpdf 
on my system):

"The --compact-vignettes option will run tools::compactPDF over the PDF files 
in inst/doc (and its subdirectories) to losslessly compress them. This is not 
enabled by default (it can be selected by environment variable 
_R_BUILD_COMPACT_VIGNETTES_) and needs qpdf (http://qpdf.sourceforge.net/) to 
be available. "
QPDF: A Content-Preserving PDF Transformation 
System<http://qpdf.sourceforge.net/>
qpdf.sourceforge.net
What is QPDF? QPDF is a command-line program that does structural, 
content-preserving transformations on PDF files. It could have been called 
something like pdf-to-pdf.


QPDF: A Content-Preserving PDF Transformation 
System<http://qpdf.sourceforge.net/>
qpdf.sourceforge.net
What is QPDF? QPDF is a command-line program that does structural, 
content-preserving transformations on PDF files. It could have been called 
something like pdf-to-pdf.



Can anyone please tell me what to do?

Best regards
S�ren

---

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.

6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

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

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

other attached packages:
[1] Rcpp_0.12.17shtools_1.0 markdown_0.8knitr_1.20
[5] rmarkdown_1.10  devtools_1.13.5

loaded via a namespace (and not attached):
 [1] lattice_0.20-35 digest_0.6.15   withr_2.1.2
 [4] rprojroot_1.3-2 grid_3.4.4  backports_1.1.2
 [7] magrittr_1.5evaluate_0.10.1 stringi_1.2.3
[10] curl_3.2RcppArmadillo_0.8.500.0 Matrix_1.2-14
[13] tools_3.4.4 RcppEigen_0.3.3.4.0 stringr_1.3.1
[16] compiler_3.4.4  memoise_1.1.0   htmltools_0.3.6




[[alternative HTML version deleted]]


[[alternative HTML version deleted]]

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

[[alternative HTML version deleted]]

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


Re: [Rd] use of buffers in sprintf and snprintf

2019-05-30 Thread jing hua zhao
Hi again,

I realised it is useful to replicate the warnings locally without relying on 
CRAN automatic check; instead of R(-devel)  CMD check --as-cran 
package_version.tar.gz one can use

R CMD check --configure-args=""

and in my case the WARNINGS were initially given with 
https://www.stats.ox.ac.uk/pub/bdr/gcc9/README.txt and those specification 
might as well used in --configure-args above.

Besst regards,


Jing Hua


From: R-devel  on behalf of jing hua zhao 

Sent: 29 May 2019 15:49
To: r-devel@r-project.org
Subject: [Rd] use of buffers in sprintf and snprintf

Dear R-developers,

I am struggling with packaging with sprintf and snprintf() as the following 
WARNINGS from gcc 9.x,

  hap_c.c:380:46: warning: �%d� directive output may be truncated writing 
between 1 and 10 bytes into a region of size between 0 and 127 
[-Wformat-truncation=]
  hap_c.c:392:46: warning: �%d� directive output may be truncated writing 
between 1 and 10 bytes into a region of size between 0 and 127 
[-Wformat-truncation=]

Essentially, I have

#define MAX_FILENAME_LEN 128
char of1name[MAX_FILENAME_LEN],of2name[MAX_FILENAME_LEN], 
tempname[MAX_FILENAME_LEN];

...

 snprintf(tempname,sizeof(tempname),"%s.%d", of1name, j);

It looks I could get around with


#define MAX_FILENAME_LEN 128

#define MAX_FILENAME_LEN2 256

char of1name[MAX_FILENAME_LEN],of2name[MAX_FILENAME_LEN], 
tempname[MAX_FILENAME_LEN2];

...
snprintf(tempname,2*sizeof(tempname)+1,"%s.%d", of1name, j)

It looks a bit waste of resources to me.


Any idea will be greatly appreciated,



Jing Hua

[[alternative HTML version deleted]]


[[alternative HTML version deleted]]

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


[Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-21 Thread jing hua zhao
Dear R-developers,

I am keen to calculate exp(z*z/2) with z=qnorm(p/2) and p is very small. I 
wonder if anyone has experience with this?

Thanks very much in advance,


Jing Hua

[[alternative HTML version deleted]]

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


Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-21 Thread jing hua zhao
Dear Rui,

Thanks for your quick reply -- this allows me to see the bottom of this. I was 
hoping we could have a handle of those p in genmoics such as 1e-300 or smaller.

Best wishes,


Jing Hua


From: Rui Barradas 
Sent: 21 June 2019 15:03
To: jing hua zhao; r-devel@r-project.org
Subject: Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

Hello,

Well, try it:

p <- .Machine$double.eps^seq(0.5, 1, by = 0.05)
z <- qnorm(p/2)

pnorm(z)
# [1] 7.450581e-09 1.22e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
#[11] 1.110223e-16
p/2
# [1] 7.450581e-09 1.22e-09 2.026908e-10 3.343152e-11 5.514145e-12
# [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
#[11] 1.110223e-16

exp(z*z/2)
# [1] 9.184907e+06 5.301421e+07 3.073154e+08 1.787931e+09 1.043417e+10
# [6] 6.105491e+10 3.580873e+11 2.104460e+12 1.239008e+13 7.306423e+13
#[11] 4.314798e+14


p is the smallest possible such that 1 + p != 1 and I couldn't find
anything to worry about.


R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.04

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

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

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

other attached packages:

[many packages loaded]


Hope this helps,

Rui Barradas

�s 15:24 de 21/06/19, jing hua zhao escreveu:
> Dear R-developers,
>
> I am keen to calculate exp(z*z/2) with z=qnorm(p/2) and p is very small. I 
> wonder if anyone has experience with this?
>
> Thanks very much in advance,
>
>
> Jing Hua
>
>[[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

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


Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-21 Thread jing hua zhao
Hi Peter, Rui, Chrstophe and Gabriel,

Thanks for your inputs --  the use of qnorm(., log=TRUE) is a good point in 
line with pnorm with which we devised log(p)  as

log(2) + pnorm(-abs(z), lower.tail = TRUE, log.p = TRUE)

that could do really really well for large z compared to Rmpfr. Maybe I am 
asking too much since

z <-2
> Rmpfr::format(2*pnorm(mpfr(-abs(z),100),lower.tail=TRUE,log.p=FALSE))
[1] "1.660579603192917090365313727164e-86858901"

already gives a rarely seen small p value. I gather I also need a multiple 
precision exp() and their sum since exp(z^2/2) is also a Bayes Factor so I  get 
log(x_i )/sum_i log(x_i) instead. To this point, I am obliged to clarify, see 
https://statgen.github.io/gwas-credible-sets/method/locuszoom-credible-sets.pdf.

I agree many feel geneticists go to far with small p values which I would have 
difficulty to argue againston the other hand it is also expected to see these 
in a non-genetic context. For instance the Framingham study was established in 
1948 just got $34m for six years on phenotypewide association which we would be 
interesting to see.

Best wishes,


Jing Hua



From: peter dalgaard 
Sent: 21 June 2019 16:24
To: jing hua zhao
Cc: Rui Barradas; r-devel@r-project.org
Subject: Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

You may want to look into using the log option to qnorm

e.g., in round figures:

> log(1e-300)
[1] -690.7755
> qnorm(-691, log=TRUE)
[1] -37.05315
> exp(37^2/2)
[1] 1.881797e+297
> exp(-37^2/2)
[1] 5.314068e-298

Notice that floating point representation cuts out at 1e+/-308 or so. If you 
want to go outside that range, you may need explicit manipulation of the log 
values. qnorm() itself seems quite happy with much smaller values:

> qnorm(-5000, log=TRUE)
[1] -99.94475

-pd

> On 21 Jun 2019, at 17:11 , jing hua zhao  wrote:
>
> Dear Rui,
>
> Thanks for your quick reply -- this allows me to see the bottom of this. I 
> was hoping we could have a handle of those p in genmoics such as 1e-300 or 
> smaller.
>
> Best wishes,
>
>
> Jing Hua
>
> ________
> From: Rui Barradas 
> Sent: 21 June 2019 15:03
> To: jing hua zhao; r-devel@r-project.org
> Subject: Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z
>
> Hello,
>
> Well, try it:
>
> p <- .Machine$double.eps^seq(0.5, 1, by = 0.05)
> z <- qnorm(p/2)
>
> pnorm(z)
> # [1] 7.450581e-09 1.22e-09 2.026908e-10 3.343152e-11 5.514145e-12
> # [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
> #[11] 1.110223e-16
> p/2
> # [1] 7.450581e-09 1.22e-09 2.026908e-10 3.343152e-11 5.514145e-12
> # [6] 9.094947e-13 1.500107e-13 2.474254e-14 4.080996e-15 6.731134e-16
> #[11] 1.110223e-16
>
> exp(z*z/2)
> # [1] 9.184907e+06 5.301421e+07 3.073154e+08 1.787931e+09 1.043417e+10
> # [6] 6.105491e+10 3.580873e+11 2.104460e+12 1.239008e+13 7.306423e+13
> #[11] 4.314798e+14
>
>
> p is the smallest possible such that 1 + p != 1 and I couldn't find
> anything to worry about.
>
>
> R version 3.6.0 (2019-04-26)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 19.04
>
> Matrix products: default
> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
>
> locale:
>  [1] LC_CTYPE=pt_PT.UTF-8   LC_NUMERIC=C
>  [3] LC_TIME=pt_PT.UTF-8LC_COLLATE=pt_PT.UTF-8
>  [5] LC_MONETARY=pt_PT.UTF-8LC_MESSAGES=pt_PT.UTF-8
>  [7] LC_PAPER=pt_PT.UTF-8   LC_NAME=C
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=pt_PT.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods
> [7] base
>
> other attached packages:
>
> [many packages loaded]
>
>
> Hope this helps,
>
> Rui Barradas
>
> �s 15:24 de 21/06/19, jing hua zhao escreveu:
>> Dear R-developers,
>>
>> I am keen to calculate exp(z*z/2) with z=qnorm(p/2) and p is very small. I 
>> wonder if anyone has experience with this?
>>
>> Thanks very much in advance,
>>
>>
>> Jing Hua
>>
>>   [[alternative HTML version deleted]]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>[[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com










[[alternative HTML version deleted]]

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


Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread jing hua zhao
Hi All,

Thanks for all your comments which allows me to appreciate more of these in 
Python and R.

I just came across the matrixStats package,


## EXAMPLE #1
lx <- c(1000.01, 1000.02)
y0 <- log(sum(exp(lx)))
print(y0) ## Inf

y1 <- logSumExp(lx)
print(y1) ## 1000.708

and

> ly <- lx*10
> ly
[1] 11000 12000
> y1 <- logSumExp(ly)
> print(y1)
[1] 12000
> logSumExp
function (lx, idxs = NULL, na.rm = FALSE, ...)
{
has_na <- TRUE
.Call(C_logSumExp, as.numeric(lx), idxs, as.logical(na.rm),
has_na)
}



Maybe this is rather close?

Best wishes,


Jing Hua


From: R-devel  on behalf of Martin Maechler 

Sent: 24 June 2019 08:37
To: William Dunlap
Cc: r-devel@r-project.org
Subject: Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:

> include/Rmath.h declares a set of 'logspace' functions for use at the C
> level.  I don't think there are core R functions that call them.

> /* Compute the log of a sum or difference from logs of terms, i.e.,
> *
> * log (exp (logx) + exp (logy))
> * or  log (exp (logx) - exp (logy))
> *
> * without causing overflows or throwing away too much accuracy:
> */
> double  Rf_logspace_add(double logx, double logy);
> double  Rf_logspace_sub(double logx, double logy);
> double  Rf_logspace_sum(const double *logx, int nx);

> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com

Yes, indeed, thank you, Bill!

But they *have* been in use by core R functions for a long time
in pgamma, pbeta and related functions.

[and I have had changes in *hyper.c where logspace_add() is used too,
 for several years now (since 2015) but I no longer know which
 concrete accuracy problem that addresses, so have not yet committed it]


Martin Maechler
ETH Zurich and R Core Team



> On Sun, Jun 23, 2019 at 1:40 AM Ben Bolker  wrote:

>>
>> I agree with many the sentiments about the wisdom of computing very
>> small p-values (although the example below may win some kind of a prize:
>> I've seen people talking about p-values of the order of 10^(-2000), but
>> never 10^(-(10^8)) !).  That said, there are a several tricks for
>> getting more reasonable sums of very small probabilities.  The first is
>> to scale the p-values by dividing the *largest* of the probabilities,
>> then do the (p/sum(p)) computation, then multiply the result (I'm sure
>> this is described/documented somewhere).  More generally, there are
>> methods for computing sums on the log scale, e.g.
>>
>>
>> 
https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.misc.logsumexp.html
>>
>> I don't know where this has been implemented in the R ecosystem, but
>> this sort of computation is the basis of the "Brobdingnag" package for
>> operating on very large ("Brobdingnagian") and very small
>> ("Lilliputian") numbers.
>>
>>
>> On 2019-06-21 6:58 p.m., jing hua zhao wrote:
>> > Hi Peter, Rui, Chrstophe and Gabriel,
>> >
>> > Thanks for your inputs --  the use of qnorm(., log=TRUE) is a good 
point
>> in line with pnorm with which we devised log(p)  as
>> >
>> > log(2) + pnorm(-abs(z), lower.tail = TRUE, log.p = TRUE)
>> >
>> > that could do really really well for large z compared to Rmpfr. Maybe I
>> am asking too much since
>> >
>> > z <-2
>> >> Rmpfr::format(2*pnorm(mpfr(-abs(z),100),lower.tail=TRUE,log.p=FALSE))
>> > [1] "1.660579603192917090365313727164e-86858901"
>> >
>> > already gives a rarely seen small p value. I gather I also need a
>> multiple precision exp() and their sum since exp(z^2/2) is also a Bayes
>> Factor so I  get log(x_i )/sum_i log(x_i) instead. To this point, I am
>> obliged to clarify, see
>> 
https://statgen.github.io/gwas-credible-sets/method/locuszoom-credible-sets.pdf
>> .
>> >
>> > I agree many feel geneticists go to far with small p values which I
>> would have difficulty to argue againston the other hand it is also 
expected
>> to see these in a non-genetic context. For instance the Framingham study
>> was established in 1948 just got $34m for six years on phenotypewide
>> associa

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-24 Thread jing hua zhao
Hi Martin,

Thanks for another tips -- it will be hard for me to comprehend fully your 
implementation of Rmpfr. I will look at these instead. I realised what I 
thought was a difficult problem turned to be a popular one. I managed to get a 
Python version here for information.

# http://bayesjumping.net/log-sum-exp-trick/
import numpy as np
def logSumExp(ns):
max = np.max(ns)
ds = ns - max
sumOfExp = np.exp(ds).sum()
return max + np.log(sumOfExp)

x = [11000, 12000]
logSumExp(x)

from scipy.misc import logsumexp
logsumexp(x)

import numpy as np;
prob1 = np.log(1e-50)
prob2 = np.log(2.5e-50)
prob12 = np.logaddexp(prob1, prob2)
prob12
np.exp(prob12)

As expected they are in good agreement with R.

Best regards,


Jing Hua


From: Martin Maechler 
Sent: 24 June 2019 09:29
To: jing hua zhao
Cc: William Dunlap; Martin Maechler; r-devel@r-project.org
Subject: Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

>>>>> jing hua zhao
>>>>> on Mon, 24 Jun 2019 08:51:43 + writes:

> Hi All,
> Thanks for all your comments which allows me to appreciate more of these 
in Python and R.

> I just came across the matrixStats package,


> ## EXAMPLE #1
> lx <- c(1000.01, 1000.02)
> y0 <- log(sum(exp(lx)))
> print(y0) ## Inf

> y1 <- logSumExp(lx)
> print(y1) ## 1000.708

> and

>> ly <- lx*10
>> ly
> [1] 11000 12000
>> y1 <- logSumExp(ly)
>> print(y1)
> [1] 12000
>> logSumExp
> function (lx, idxs = NULL, na.rm = FALSE, ...)
> {
> has_na <- TRUE
> .Call(C_logSumExp, as.numeric(lx), idxs, as.logical(na.rm),
> has_na)
> }
> 
> 

> Maybe this is rather close?

Thank you  Jing Hua,

indeed the issue of sums of (very large or very small)
exponentials is a special case, that can well be treated
specially
 - as it is not so infrequent
 - via "obvious" simplifications can be implemented even more accurately

We (authors of the R package 'copula') have had a need for
these as well, in likelihood computation for Archimedean
copulas, and
have efficient R level implementations, both for your case  and
the -- even more delicate -- case of e.g., alternating signs of
exponential terms.

"Unfortunately", we had never exported the functions from the
package, so you'd need

 copula:::lsum()   # log  sum {of exponentials in log scale}
or
 copula:::lssum()  # log *s*igned sum {of exponentials in log scale}

for the 2nd case.

The advantage is it's simple R code implemented quite
efficiently for the vector and matrices cases,

Source code from source file copula/R/special-func.R

 (in svn at R-forge :
   -->
   
https://r-forge.r-project.org/scm/viewvc.php/pkg/copula/R/special-func.R?view=markup&root=copula
 )

{Yes, this GPL-2 licenced  {with Copyright, see file, please
 keep this one line}
## Copyright (C) 2012 Marius Hofert, Ivan Kojadinovic, Martin Maechler, and Jun 
Y
}

--

##' Properly compute log(x_1 + .. + x_n) for a given (n x d)-matrix of n row
##' vectors log(x_1),..,log(x_n) (each of dimension d)
##' Here, x_i > 0  for all i
##' @title Properly compute the logarithm of a sum
##' @param lx (n,d)-matrix containing the row vectors log(x_1),..,log(x_n)
##'each of dimension d
##' @param l.off the offset to subtract and re-add; ideally in the order of
##'the maximum of each column
##' @return log(x_1 + .. + x_n) [i.e., OF DIMENSION d!!!] computed via
##' log(sum(x)) = log(sum(exp(log(x
##' = log(exp(log(x_max))*sum(exp(log(x)-log(x_max
##' = log(x_max) + log(sum(exp(log(x)-log(x_max)
##' = lx.max + log(sum(exp(lx-lx.max)))
##' => VECTOR OF DIMENSION d
##' @author Marius Hofert, Martin Maechler
lsum <- function(lx, l.off) {
rx <- length(d <- dim(lx))
if(mis.off <- missing(l.off)) l.off <- {
if(rx <= 1L)
max(lx)
else if(rx == 2L)
apply(lx, 2L, max)
}
if(rx <= 1L) { ## vector
if(is.finite(l.off))
l.off + log(sum(exp(lx - l.off)))
else if(mis.off || is.na(l.off) || l.off == max(lx))
l.off # NA || NaN or all lx == -Inf, or max(.) == Inf
else
stop("'l.off  is infinite but not == max(.)")
} else if(rx == 2L) { ## matrix
if(any(x.off <- !is.finite(l.off))) {
if(mis.off || isTRUE(all.equal(l.off, apply(lx, 2L, max {
## we know l.off = colMax(.)
if(all(x.off)) return(l.off)
r <- l.o

[Rd] Error during wrapup: Bootstrapping failed

2010-08-11 Thread jing hua zhao

Dear DevelopeRs,

We are performing some analysis/simulation involving dense genetic data with 
plspm. Owing to the high collinearity of the neighboring SNPs (independent 
variables) the function would fail frequently if bootstrap option is used. In 
some cases I can catch this as error via options(error=expression()) but not so 
when R prompts "Error during wrapup: Bootstrapping failed". Is it possible to 
catch that?

Many thanks for your help,


Jinghua
  
[[alternative HTML version deleted]]

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


[Rd] bookmarks with PDF()

2011-08-12 Thread jing hua zhao

Dear R-developers,

I am wondering if it is possible to add bookmarks automatically to individual 
figures for pdf() when multiple figures are produced? If so, it would be very 
handy.

Best regards,


Jing Hua
  
[[alternative HTML version deleted]]

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


Re: [Rd] issue with unz()?

2017-02-09 Thread jing hua zhao
The 2015 does contain three files.


From: jing hua zhao 
Sent: 10 February 2017 00:13
To: r-devel@r-project.org
Subject: issue with unz()?


Dear R-devel,





url0514 <- 
"http://data.dft.gov.uk.s3.amazonaws.com/road-accidents-safety-data/Stats19_Data_2005-2014.zip";
file0514 <- c("Vehicles0514.csv","Casualties0514.csv","Accidents0514.csv")

temp <- tempfile()
download.file(url0514,temp)
a0514 <<- read.csv(unz(temp, file0514[3]))

c0514 <<- read.csv(unz(temp, file0514[2]))

v0514 <<- read.csv(unz(temp, file0514[1]))



cts [a|c|v]0514, but this is not the case if zip file contains only one file, 
i.e.,

file2015 <- c("Vehicles_2015.csv","Casualties_2015.csv","Accidents_2015.csv")
url2015 <- 
"http://data.dft.gov.uk/road-accidents-safety-data/RoadSafetyData_2015.zip";
download.file(url2015,temp)
v2015 <<- read.csv(unz(temp, file2015[1]))
c2015 <<- read.csv(unz(temp, file2015[2]))
a2015 <<- read.csv(unz(temp, file2015[3]))


so to combine [a|c|v]0514 and [a|c|v]2015, I need to add something like


names(a0514)[names(a0514)=="�..Accident_Index"] <- "Accident_Index"
names(c0514)[names(c0514)=="�..Accident_Index"] <- "Accident_Index"
names(v0514)[names(v0514)=="�..Accident_Index"] <- "Accident_Index"


This is unnecessary under Linux (RHEL), since those i..Accident_Index have no 
i.. prefix.


Do I miss anything here?


Many thanks,




Jing Hua Zhao

[[alternative HTML version deleted]]

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

[Rd] Help on mapping memory

2020-11-10 Thread jing hua zhao
Dear everyone,

I have maintained JL Schafer's package 'pan' for a while and recently been 
contacted for the possibility to fix a crash but it turned to be elusive -- I 
am wondering what is the best to resolve this.

First, the error message is as follows,

*** caught segfault ***
address 0x1b001b3, cause 'memory not mapped'
Traceback:
1: pan(test$Y1, test$ID, X, 1:4, 4, prior, seed = m, iter = 100)
An irrecoverable exception occurred. R is aborting now ...

and I gather this is to do with R/fortran mismatch nevertheless the tricky 
thing is that it works fine with the documentation data and even with this data 
there were times it could be tweaked to work (therefore PAN.txt, test.rda and 
test.log were as intended there). I have extracted the pan.f, pan.R from the 
package and leave the Bash/R scripts all here, 
https://github.com/jinghuazhao/R/tree/master/tests, short of adding a driver 
program to pan.f and debug without R but before doing that any idea/insight 
would be greatly appreciated.

Thank you so much,


Jing Hua Zhao



[[alternative HTML version deleted]]

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


[Rd] Compiling error with glmnet and nloptr

2022-03-10 Thread jing hua zhao
Dear All,

I haven't been able to compile the latest glmnet and nloptr from CRAN wth the 
following error messages,

glmnet:

elnet_exp.cpp:141:59:   required from here
glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp:90:39: error: 
'self' was not declared in this scope
 [=](auto k) { self().template 
update(k, ab, dem); },
...
make: *** [elnet_exp.o] Error 1
ERROR: compilation failed for package �glmnet�
* removing �/rds/user/jhz22/hpc-work/R/glmnet�
* restoring previous �/rds/user/jhz22/hpc-work/R/glmnet�

nloptr:

test-C-API.cpp:108:35: error: call of overloaded 
'abs(__gnu_cxx::__alloc_traits >::value_type)' is 
ambiguous
 expect_true(abs(res[1] - 8./27) < 1.0e-4);
 ...
/usr/local/software/archive/linux-scientific7-x86_64/gcc-9/gcc-6.5.0-dtb6lagchexqdijlx6xgkin3zlfddpzi/include/c++/6.5.0/cstdlib:172:3:
 note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
make: *** [test-C-API.o] Error 1
ERROR: compilation failed for package �nloptr�

Any suggestions to fix these? I use gcc/6 and have

$ uname -a
Linux login-e-16 3.10.0-1160.59.1.el7.x86_64 #1 SMP Tue Feb 22 10:57:56 CST 
2022 x86_64 x86_64 x86_64 GNU/Linux

Many thanks in advance,


Jing Hua


[[alternative HTML version deleted]]

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


Re: [Rd] Compiling error with glmnet and nloptr

2022-03-10 Thread jing hua zhao
Also for now, I commented on self().template update at lines 
59,90 of glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp and 
glmnet also passed , so example(glmnet) gives the familiar results. Ideally, 
some better solution is preferable. Jing Hua

From: jing hua zhao 
Sent: 10 March 2022 10:45
To: R-devel 
Subject: Re: Compiling error with glmnet and nloptr

Just a note that I used R 4.1.2 and with R 4.1.3 I had the same issues 
nevertheless I was able to go through with (not entirely sure preferable) 
nloptr once abs() is changed into fabs() within �src/test-C-API.cpp. Thanks. 
Jing Hua


From: jing hua zhao 
Sent: 10 March 2022 09:22
To: R-devel 
Subject: Compiling error with glmnet and nloptr

Dear All,

I haven't been able to compile the latest glmnet and nloptr from CRAN wth the 
following error messages,

glmnet:

elnet_exp.cpp:141:59:   required from here
glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp:90:39: error: 
'self' was not declared in this scope
 [=](auto k) { self().template 
update(k, ab, dem); },
...
make: *** [elnet_exp.o] Error 1
ERROR: compilation failed for package �glmnet�
* removing �/rds/user/jhz22/hpc-work/R/glmnet�
* restoring previous �/rds/user/jhz22/hpc-work/R/glmnet�

nloptr:

test-C-API.cpp:108:35: error: call of overloaded 
'abs(__gnu_cxx::__alloc_traits >::value_type)' is 
ambiguous
 expect_true(abs(res[1] - 8./27) < 1.0e-4);
 ...
/usr/local/software/archive/linux-scientific7-x86_64/gcc-9/gcc-6.5.0-dtb6lagchexqdijlx6xgkin3zlfddpzi/include/c++/6.5.0/cstdlib:172:3:
 note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
make: *** [test-C-API.o] Error 1
ERROR: compilation failed for package �nloptr�

Any suggestions to fix these? I use gcc/6 and have

$ uname -a
Linux login-e-16 3.10.0-1160.59.1.el7.x86_64 #1 SMP Tue Feb 22 10:57:56 CST 
2022 x86_64 x86_64 x86_64 GNU/Linux

Many thanks in advance,


Jing Hua


[[alternative HTML version deleted]]

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


[Rd] read.csv

2024-04-16 Thread jing hua zhao
Dear R-developers,

I came to a somewhat unexpected behaviour of read.csv() which is trivial but 
worthwhile to note -- my data involves a protein named "1433E" but to save 
space I drop the quote so it becomes,

Gene,SNP,prot,log10p
YWHAE,13:62129097_C_T,1433E,7.35
YWHAE,4:72617557_T_TA,1433E,7.73

Both read.cv() and readr::read_csv() consider prot(ein) name as (possibly 
confused by scientific notation) numeric 1433 which only alerts me when I tried 
to combine data,

all_data <- data.frame()
for (protein in proteins[1:7])
{
   cat(protein,":\n")
   f <- paste0(protein,".csv")
   if(file.exists(f))
   {
 p <- read.csv(f)
 print(p)
 if(nrow(p)>0) all_data  <- bind_rows(all_data,p)
   }
}

proteins[1:7]
[1] "1433B" "1433E" "1433F" "1433G" "1433S" "1433T" "1433Z"

dplyr::bind_rows() failed to work due to incompatible types nevertheless 
rbind() went ahead without warnings.

Best wishes,


Jing Hua

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


[Rd] CRAN package submission

2024-08-26 Thread jing hua zhao
Dear CRAN / All,

I appeared not to receive any email notification after upload a package update 
(to furnish the confirmation) -- is the system down?

Many thanks,



Jing Hua

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


Re: [Rd] CRAN package submission

2024-08-26 Thread jing hua zhao
Thanks for the suggestion - I gather I might have done something wrong , since 
I can see,

>cran_incoming() |> data.frame()
 package  version cran_foldertime size
1   ghyp1.6.5 pretest 2024-08-26 12:54:00 1.8M
...

It is nice to know about the package and in my case I didn't receive email (so 
as to click) to proceed to Step 3 of the submission.

From: Ben Bolker 
Sent: Monday, August 26, 2024 11:43 AM
To: jing hua zhao 
Cc: R-devel 
Subject: Re: [Rd] CRAN package submission


Try the foghorn package for checking the status of your submission in the CRAN 
queue?

On Mon, Aug 26, 2024, 4:46 AM jing hua zhao 
mailto:jinghuaz...@hotmail.com>> wrote:
Dear CRAN / All,

I appeared not to receive any email notification after upload a package update 
(to furnish the confirmation) -- is the system down?

Many thanks,



Jing Hua

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

[[alternative HTML version deleted]]

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


Re: [Rd] CRAN package submission

2024-08-26 Thread jing hua zhao
Hi Ben / All,

It turned out to be the most basic - I found message from CRAN in the junk 
email folder (we have emails on MicroSoft server from which I still received 
the confirmation in Inbox!). As expected, I can see from foghorn,

> cran_incoming()
# A tibble: 108 � 5
   package versioncran_folder timesize

1 gap 1.6pretest 2024-08-26 23:53:00 4.3M
2 dst 1.7.1  pretest 2024-08-26 23:33:00 494K
3 cpp11   0.5.0  pretest 2024-08-26 23:20:00 263K
4 GPEMR   0.1.0  pretest 2024-08-26 23:13:00 277K
...

Best wishes,


Jing Hua


From: jing hua zhao
Sent: Monday, August 26, 2024 12:05 PM
To: Ben Bolker 
Cc: R-devel 
Subject: RE: [Rd] CRAN package submission

Thanks for the suggestion - I gather I might have done something wrong , since 
I can see,

>cran_incoming() |> data.frame()
 package  version cran_foldertime size
1   ghyp1.6.5 pretest 2024-08-26 12:54:00 1.8M
...

It is nice to know about the package and in my case I didn't receive email (so 
as to click) to proceed to Step 3 of the submission.

From: Ben Bolker mailto:bbol...@gmail.com>>
Sent: Monday, August 26, 2024 11:43 AM
To: jing hua zhao mailto:jinghuaz...@hotmail.com>>
Cc: R-devel mailto:R-devel@r-project.org>>
Subject: Re: [Rd] CRAN package submission


Try the foghorn package for checking the status of your submission in the CRAN 
queue?

On Mon, Aug 26, 2024, 4:46 AM jing hua zhao 
mailto:jinghuaz...@hotmail.com>> wrote:
Dear CRAN / All,

I appeared not to receive any email notification after upload a package update 
(to furnish the confirmation) -- is the system down?

Many thanks,



Jing Hua

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

[[alternative HTML version deleted]]

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


Re: [Rd] CRAN policies

2012-03-28 Thread jing hua zhao

> From: x...@yihui.name
> Date: Tue, 27 Mar 2012 16:40:04 -0500
> To: r-devel@r-project.org
> Subject: Re: [Rd] CRAN policies
> 
> I have been wondering if it is possible to automate the checking
> process to reduce human efforts, e.g. automatically check the packages
> submitted to FTP, and send the package maintainer an email in case of
> warnings or errors (otherwise just move it to CRAN); package
> maintainers can appeal for a manual check by CRAN maintainers in case
> of false positives. As a package author, I really hate to bother CRAN
> maintainers each time I upload a new version and it passes R CMD check
> successfully, in which case I should have received an automatic email
> instead of Kurt's "hand-writing" "thanks, on CRAN now". Frankly
> speaking, it makes me feel guilty sometimes to update my packages,
> thinking of other 3700 packages on CRAN and how much time you CRAN
> maintainers are spending on checking the packages.
> 


Indeed it is a good summary of how I felt for so long and in particular my 
recent experience, which involved Kurt, Brian,  and Uwe.



I think win-builder certainly helps, but it is feasible with a Linux 
counterpart "to have a final say"?



> I do not know how many package authors actually read this mailing
> list, so these policies may not really reach some authors at all.
> 
Certainly more colleagues read the list than  have been revealed by the 
postings.

Kind regards,





Jing Hua



> Regards,
> Yihui
> --
> Yihui Xie 
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
  
[[alternative HTML version deleted]]

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


[Rd] Query over .Fortran call

2013-02-21 Thread jing hua zhao

Dear All,

I would like to seek advice regarding .Fortran as I was referred to a query 
about package pan that the sets of results may alternate between iterations. 
For reference I have extracted the relevant Fortran as with the R code below.

Note several packages based on JL Schafter's S-PLUS counterparts involve this. 
In the following elements in x-ximp are not all zeros suggesting the 
rangen function in mix.f is not totally under control of the rngs and 
therefore rngseed routine.

library(mix)
 data(stlouis)
 s <- prelim.mix(stlouis,3)# do preliminary manipulations
 thetahat <- em.mix(s)   # ML estimate for unrestricted model
 rngseed(1234567) # set random number generator seed
 newtheta <- da.mix(s,thetahat,steps=100) # data augmentation
 x<- imp.mix(s, newtheta, stlouis)  # impute under newtheta
 
 data(stlouis)
 s <- prelim.mix(stlouis,3)# do preliminary manipulations
 thetahat <- em.mix(s)   # ML estimate for unrestricted model
 rngseed(1234567) # set random number generator seed
 newtheta <- da.mix(s,thetahat,steps=100) # data augmentation
 ximp <- imp.mix(s, newtheta, stlouis)  # impute under newtheta

Many thanks,


Jing Hua

rangen.f seems to work,

integer i
real u
c call rngs() is necessary to kickstart
call rngs(1234567)
do i=1,10
   u=rangen(0)
enddo
end
C***
real function rangen(init)
integer a,p,ix,b15,b16,xhi,xalo,leftflo,fhi,k,init
data a/16807/,b15/32768/,b16/65536/,p/2147483647/
save ix
if(init.ne.0) ix=init
xhi=ix/b16
xalo=(ix-xhi*b16)*a
leftflo=xalo/b16
fhi=xhi*a+leftflo
k=fhi/b15
ix=(((xalo-leftflo*b16)-p)+(fhi-k*b15)*b16)+k
if (ix.lt.0)ix=ix+p
rangen=float(ix)*4.656612875E-10
write(*,'(3hix=,I20,F20.10)') ix,rangen
return
end
C***
subroutine rngs(seed)
C initializes rangen with seed
integer seed
tmp=rangen(seed)
write(*,'(7h begin,,I6,2x,F20.10)') seed,tmp
return
end
C***

pan_seed_problem.r

library(pan)

##set up of small example data

#y the target variable
y <- c(1, 2, 3, 4, NA, 11, 12, 13, 14, NA)

#subj the cluster identificator
subj <- c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2)

#the explaining variables
pred <- matrix(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 2, 1, 4, 3, 6, 12, 11, 14, 13, 16), ncol = 2)

#which variables shall be used to explain fixed and random effects
xcol <- 1:2
zcol <- 1:2

#primitive priori
prior <- list(a = 1, Binv = 1, c = 1, Dinv = diag(1, 2))

#set a seed, run pan and show the summary of the completed y
set.seed(1)
imp.pan <- pan(y = y, subj = subj,
   pred = pred, xcol = xcol, zcol = zcol,
   prior = prior, seed = 72, iter = 2)

summary(imp.pan$y)
mean1 <- mean(imp.pan$y)

#set the same seed again, run pan and show the summary of the completed y
set.seed(1)
imp.pan <- pan(y = y, subj = subj, pred = pred, xcol = xcol, zcol = zcol,
prior = prior, seed = 72, iter = 2)

summary(imp.pan$y)
mean2 <- mean(imp.pan$y)

##the mean of the completed y differs
mean1 == mean2



  
[[alternative HTML version deleted]]

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


Re: [Rd] Deferred Default Marker

2010-04-26 Thread jing hua zhao


Hi Terry,

Not aware about the issue, e.g., from

$ uname -a
Linux c06.mrc-epid.private.cam.ac.uk 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 
23:27:13 EST 2010 x86_64 x86_64 x86_64 GNU/Linux

I got

> library(kinship)
Loading required package: survival
Loading required package: splines
Loading required package: nlme
Loading required package: lattice
[1] "kinship is loaded"
> temp <- matrix(runif(50), ncol=2)
> temp <- matrix(runif(50), ncol=2)
> t(temp) %*% temp
 [,1] [,2]
[1,] 8.327462 6.531409
[2,] 6.531409 9.129242
> t(temp) %*% temp
 [,1] [,2]
[1,] 8.327462 6.531409
[2,] 6.531409 9.129242
> version
   _
platform   x86_64-unknown-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  11.0
year   2010
month  04
day22
svn rev51801
language   R
version.string R version 2.11.0 (2010-04-22)

or 

 $ /genetics/data/software/R-2.11.0/bin/R --vanilla

R version 2.11.0 (2010-04-22)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> temp <- matrix(runif(50), ncol=2)
> t(temp) %*% temp
 [,1] [,2]
[1,] 9.379705 7.471682
[2,] 7.471682 9.046881
> library(kinship)
Loading required package: survival
Loading required package: splines
Loading required package: nlme
Loading required package: lattice
[1] "kinship is loaded"
> t(temp) %*% temp
 [,1] [,2]
[1,] 9.379705 7.471682
[2,] 7.471682 9.046881


I look forward to the availability of a complete replacement of 
bdsmatrix/coxme/pedigree packages. There have been simple yet sticky issues 
such as allowing for unknown status in the affection status which would benefit 
from an overhaul implementation than revising the present one.

Jing Hua


> From: thern...@mayo.edu
> To: r-devel@r-project.org
> Date: Fri, 23 Apr 2010 10:20:39 -0500
> Subject: [Rd] Deferred Default Marker
> 
> I've finally narrowed down a puzzling problem: here is the short test
> case.
> 
> tmt34% R --vanilla
> 
> R version 2.10.0 (2009-10-26)
> Copyright (C) 2009 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> 
> > temp <- matrix(runif(50), ncol=2)
> > t(temp) %*% temp
>  [,1] [,2]
> [1,] 7.916016 6.049698
> [2,] 6.049698 7.650694
> 
> > library(kinship)
> Loading required package: survival
> Loading required package: splines
> Loading required package: nlme
> Loading required package: lattice
> > t(temp) %*% temp
> `__Deferred_Default_Marker__`
> 
> -
> 
> Within the library is a definition of %*% for bdsmatrix objects, which
> is perhaps the issue.  But I'm only guessing since I don't have a clear
> idea what the error message means.  Any hints are appreciated.
> 
> The new coxme/bsdmatrix packages need only a couple more functions to be
> a complete replacement for kinship, at which point we will depreciate
> it. (Pedigrees and plotting were finished last weekend!)  But I can't
> quite do that yet. The error does not arise with these newer libraries.
> There have been no changes to kinship for some time.
> 
>   Terry Therneau
> 
> 
> > sessionInfo()
> R version 2.10.0 (2009-10-26) 
> x86_64-unknown-linux-gnu 
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C  
>  [3] LC_TIME=en_US.UTF-8LC_COLLATE=C  
>  [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8   
>  [7] LC_PAPER=en_US.UTF-8   LC_NAME=C 
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C   
> 
> attached base packages:
> [1] splines   stats graphics  grDevices utils datasets
> methods  
> [8] base 
> other attached packages:
> [1] kinship_1.1.0-11 lattice_0.17-26  nlme_3.1-96  survival_2.35-9 
> 
> loaded via a namespace (and not attached):
> [1] grid_2.10.0
> >
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
  
_

Do you have a story that started on Hotmail? Tell us now
[[alternative HTML version deleted]]

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


[Rd] some queries over cross-compilation

2010-04-26 Thread jing hua zhao

Dear R developers,

I ran into some problems that I wish to get around.

Following the recommendation from "Building R for Windows" (Duncan's site) I 
was able to obtain some files from Brian's site for relevant tools for 
cross-compile. Initially I was able to cross-compile Windows packages happily 
with the setup I had based on R 2.7.0  (essentially as described in 
cran.r-project.org/doc/contrib/cross-build.pdf) but got it entirely muddled up 
with R 2.11.0. I found this was actually not officially supported from R 2.9.0.

I then found I cannot even remove the Tcl directory (8-5-8) even I move or 
rename it. Is there a way to do that?

I wonder if there is an equivalent of i586-mingw32 (x86_64-w64-mingw32-) or I 
have to customise that myself. I got errors at various stage and at one time  
i586-mingw32-nm could not recognise ch2inv.o that was generated. Perhaps I 
would get some headway with alternative. Perhaps I would need also reestablish 
my R 2.7.0 cross-compile to see if my initial build was just a fake.

Many thanks,


Jing Hua
  
_

We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
[[alternative HTML version deleted]]

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


Re: [Rd] some queries over cross-compilation

2010-04-26 Thread jing hua zhao

Dear Uwe,

Thanks -- I also found Rtools11.exe work very well under my home PC with 
Windows Vista. 

BW,


Jing Hua

> Date: Mon, 26 Apr 2010 14:04:32 +0200
> From: lig...@statistik.tu-dortmund.de
> To: jinghuaz...@hotmail.com
> CC: r-devel@r-project.org
> Subject: Re: [Rd] some queries over cross-compilation
> 
> Cross compiling support has been dropped.
> If you want to have it, please patch the sources yourself.
> If you just want to get a Windows biunary of one package and you do not 
> have a Windows machine around, you may use the service at:
> http://win-builder.r-project.org/
> 
> Uwe Ligges
> 
> 
> 
> On 26.04.2010 12:55, jing hua zhao wrote:
> >
> > Dear R developers,
> >
> > I ran into some problems that I wish to get around.
> >
> > Following the recommendation from "Building R for Windows" (Duncan's site) 
> > I was able to obtain some files from Brian's site for relevant tools for 
> > cross-compile. Initially I was able to cross-compile Windows packages 
> > happily with the setup I had based on R 2.7.0  (essentially as described in 
> > cran.r-project.org/doc/contrib/cross-build.pdf) but got it entirely muddled 
> > up with R 2.11.0. I found this was actually not officially supported from R 
> > 2.9.0.
> >
> > I then found I cannot even remove the Tcl directory (8-5-8) even I move or 
> > rename it. Is there a way to do that?
> >
> > I wonder if there is an equivalent of i586-mingw32 (x86_64-w64-mingw32-) or 
> > I have to customise that myself. I got errors at various stage and at one 
> > time  i586-mingw32-nm could not recognise ch2inv.o that was generated. 
> > Perhaps I would get some headway with alternative. Perhaps I would need 
> > also reestablish my R 2.7.0 cross-compile to see if my initial build was 
> > just a fake.
> >
> > Many thanks,
> >
> >
> > Jing Hua
> > 
> > _
> >
> > We want to hear all your funny, exciting and crazy Hotmail stories. Tell us 
> > now
> > [[alternative HTML version deleted]]
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
  
_

We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
[[alternative HTML version deleted]]

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


Re: [Rd] R260 cross-compilation

2007-10-13 Thread jing hua zhao

Here is what I noted down for our system.
 
To reset src/gnuwin32/MkRules as appropriate
BUILD=CROSS## if cross-building, is this gcc3 or gcc4?CROSS-GCC=gcc3
R_EXE='/home/jhz22/RCrossBuild/LinuxR/bin/R'> Date: Thu, 11 Oct 2007 11:15:08 
+0100> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]> Subject: [Rd] R260 
cross-compilation> > Hi,> > I'm trying to cross compile R260 in a ubuntu 6.06 
linux. I downloaded > the Makefile for 251 and simply replaced the R version by 
260. However > I'm getting an error about mingw.> > [EMAIL 
PROTECTED]:~/ipimar/devel/R/ccompile260$ make R> export > 
PATH=/home/ernesto/ipimar/devel/R/ccompile260/cross-tools/bin:/home/ernesto/ipimar/devel/R/ccompile260/cross-tools/i586-mingw32/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games;
 > \> cd > /home/ernesto/ipimar/devel/R/ccompile260/WinR/R-2.6.0/src/gnuwin32/; 
\> make; \> cd /home/ernesto/ipimar/devel/R/ccompile260/WinR; \> tar zcf 
Win-R-2.6.0.tgz R-2.6.0> make[1]: Entering directory > 
`/home/ernesto/ipimar/devel/R/ccompile260/WinR/R-2.6.0/src/gnuwin32'> make 
--no-print-directory -C front-ends Rpwd> make -C ../../include -f Makefile.win 
version> make Rpwd.exe> i586-mingw32-gcc-sjlj -std=gnu99 -I../../include -O3 
-Wall -pedantic > -c rpwd.c -o rpwd.o> make[4]: i586-mingw32-gcc-sjlj: Command 
not found> make[4]: *** [rpwd.o] Error 127> make[3]: *** [Rpwd] Error 2> 
make[2]: *** [front-ends/Rpwd.exe] Error 2> make[1]: *** [all] Error 2> 
make[1]: Leaving directory > 
`/home/ernesto/ipimar/devel/R/ccompile260/WinR/R-2.6.0/src/gnuwin32'> > How can 
I fix this ? Is there a new Makefile for R260 ?> > Thanks> > EJ> > 
__> R-devel@r-project.org mailing 
list> https://stat.ethz.ch/mailman/listinfo/r-devel
_
100’s of Music vouchers to be won with MSN Music

[[alternative HTML version deleted]]

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


[Rd] pnorm

2008-02-07 Thread jing hua zhao

Dear R list,

I calculated a two-sided p values according to 2*(1-pnorm(8.104474)), which 
gives  4.440892e-16. However, it appears to be  5.30E-16 by a colleague and 
5.2974E-16 from SAS. I tried to get around with mvtnorm package but it turns 
out to be using pnorm for univariate case. I should have missed some earlier 
discussions, but for the moment is there any short answer for a higher 
precision? Somehow these days, statistical geneticists are infatuated with such 
tiny p values!

Many thanks in advance,


Jing Hua

_
Telly addicts unite!

[[alternative HTML version deleted]]

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


Re: [Rd] pnorm

2008-02-08 Thread jing hua zhao

Hi, thanks to all for the helpful information. In fact our colleague is indeed 
keen to check for the difference. More importantly, I was in too much a haste 
to drop the message as I now recalled we got around in a similar way in Stata 
and SAS for a more extreme case before.  JH

> Date: Thu, 7 Feb 2008 13:04:58 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> Subject: Re: [Rd] pnorm
> 
> On Thu, 7 Feb 2008, jing hua zhao wrote:
> >
> > I calculated a two-sided p values according to 2*(1-pnorm(8.104474)), 
> > which gives 4.440892e-16. However, it appears to be 5.30E-16 by a 
> > colleague and 5.2974E-16 from SAS. I tried to get around with mvtnorm 
> > package but it turns out to be using pnorm for univariate case. I should 
> > have missed some earlier discussions, but for the moment is there any 
> > short answer for a higher precision?
> 
> pnorm(8.104474,lower.tail=FALSE)*2 gives the same answer as SAS, and
> pnorm(8.104474,lower.tail=FALSE,log=TRUE)/log(10)+log(2,10)
> gives the (base-10) logarithm of the p-value, which is often the preferred 
> genetics scale. These are much more accurate.
> 
> 
> > Somehow these days, statistical 
> > geneticists are infatuated with such tiny p values!
> 
> Yes, but in my experience they are at least fairly realistic about the 
> lack of difference between 4e-16 and 5e-16.
> 
>   -thomas
> 
> Thomas Lumley Assoc. Professor, Biostatistics
> [EMAIL PROTECTED] University of Washington, Seattle

_
Free games, great prizes - get gaming at Gamesbox. 

[[alternative HTML version deleted]]

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


[Rd] Some compiling problems

2008-04-29 Thread jing hua zhao

Dear R experts,
 
I had some difficulties to build R on Linux (cross-build) and Windows (via 
Rtools) and hope it is appropriate to post for help,
 
Our system has gcc 3.4.6 on RedHat Linux x86_64. With the help of Makefile-rcb 
by Yan and Rossini (setting BUILD=CROSS, R_EXE, F77 and FLIBS to g77 and g2c) I 
was able to build R 2.7.0 but most of the executables failed to initialise 
under Windows XP or Vista. After manually zip on Linux and unzip under Windows, 
all executables work. There appears to be problems with the compression? 
 
Earlier I kept Excel files in inst/doc but would corrupt in Windows packages 
from cross-build. Maybe it is a bad practice to have those anyway?
 
I was able to build R 2.5.1 myself under Windows and with R 2.7.0 this is much 
simpler and led to the point of success but is still stuck with 'make 
distribution' since bitmap directory does not have a proper Makefile as before. 
I do notice they are available from Cross-build or it is possible to build 
outside R framework via Cygwin.
 
Many thanks for your help,
 
 
Jing Hua
 
 
_
Bag extra points with the Walkers Brit Trip Game 

[[alternative HTML version deleted]]

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