Re: [R-pkg-devel] Rmarkdown package vignette that reference online images: how to fail gracefully?

2023-10-06 Thread Vinh Nguyen
>
>
> The parameter responsible for this base64 encoding is called
> self_contained, which defaults to TRUE in the rmarkdown::html_document
> format, which prettydoc::html_pretty inherits from. Set it to FALSE in
> the YAML header of the vignette.
>
> Note that some other scripts and CSS files may be loaded from external
> sources if you do that. As a user, I would prefer this not to be the
> case, but I don't know enough about rmarkdown to set your vignette up
> to bundle everything except the images
>


Thanks for the detailed investigation and analysis, Ivan. For now, I've
followed your suggestion and added the option `self_contained: false`. The
revised package is now on CRAN, and you are correct that css files are no
longer contained for the version sitting on CRAN, so the vignette is less
pretty looking. I'll investigate if there are any other workarounds.

Your assistance is much appreciated.

>

[[alternative HTML version deleted]]

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


[R-pkg-devel] Rmarkdown package vignette that reference online images: how to fail gracefully?

2023-10-04 Thread Vinh Nguyen
Dear members of R-package-devel,

CRAN has the following policy: Packages which use Internet resources
should fail gracefully with an informative message if the resource is
not available or has changed (and not give a check warning nor error).

I have a CRAN-accepted package with vignettes that use Rmarkdown. One
of the vignettes involves a lot of images, so rather than embed the
raw images in the vignette, I reference the images on Flickr (to keep
the package size small enough to be hosted on CRAN). Every half year
or so, I'll get a message from CRAN maintainers that the package is
not failing gracefully on one of their servers due to their build and
testing processes.  The error message looks as follows:

Could not fetch
https://live.staticflickr.com/65535/52281215570_5f9cc90a12_o.png
 HttpExceptionRequest Request {
  host = "live.staticflickr.com"
  port = 443
  secure = True
  requestHeaders = []
  path = "/65535/52281215570_5f9cc90a12_o.png"
  queryString = ""
  method = "GET"
  proxy = Nothing
  rawBody = False
  redirectCount = 10
  responseTimeout = ResponseTimeoutDefault
  requestVersion = HTTP/1.1
 }
  (ConnectionFailure Network.Socket.getAddrInfo (called with
preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG],
addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0,
addrAddress = , addrCanonName = }, host name: Just "live.staticflickr.com", service name: Just
"443"): does not exist (Name or service not known))
 Error: processing vignette
'Ex-04-Webscraping-Online-Data-Files.Rmd' failed with diagnostics:
 pandoc document conversion failed with error 61

What's the recommended way for making this fail gracefully?  Again, I
am pointing to the images online.  I am aware of .Rbuildignore, but
using this would make the vignettes not hosted on the CRAN package
page.

Thanks in advance for your help.

-- Vinh

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


Re: [Rd] R 3.2.2 64 bit compilation error on AIX

2015-10-09 Thread Vinh Nguyen
On Oct 8, 2015 11:36 PM, "Martin Maechler" <maech...@stat.math.ethz.ch>
wrote:
>
> >>>>> Vinh Nguyen <vinhdi...@gmail.com>
> >>>>> on Thu, 8 Oct 2015 20:21:32 -0700 writes:
>
> > Ahh, sorry for not googling the error message.  Found
> > [this](
http://r.789695.n4.nabble.com/Error-compiling-R-2-10-1-on-AIX-td1017862.html
)
> > post that suggests modifying /src/extra/tre/tre-internal.h
> > (
https://r-forge.r-project.org/scm/viewvc.php/patches/aix_R210_tre.patch?view=markup=aix
)
> > for AIX 64 bit.
>
> > Is it possible to add this information to the AIX section
> > of the R-admin manual?  Thanks.
>
> Actually, I think we (R Core) should just apply that patch to the
>  R/src/extras/tre/ sources.

That sould be even better!

>
> But this does not seem to be related to your original problem
> where compilation stopped during tools package building,
> or does it ?

Yes, the patch did fix the error where the tools package was building. It
also fixed it for [others](
http://r.789695.n4.nabble.com/Error-compiling-R-2-10-1-on-AIX-td1017862.html
).

Thanks.

[[alternative HTML version deleted]]

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


Re: [Rd] R 3.2.2 64 bit compilation error on AIX

2015-10-08 Thread Vinh Nguyen
Ahh, sorry for not googling the error message.  Found
[this](http://r.789695.n4.nabble.com/Error-compiling-R-2-10-1-on-AIX-td1017862.html)
post that suggests modifying /src/extra/tre/tre-internal.h
(https://r-forge.r-project.org/scm/viewvc.php/patches/aix_R210_tre.patch?view=markup=aix)
for AIX 64 bit.

Is it possible to add this information to the AIX section of the
R-admin manual?  Thanks.

-- Vinh


On Thu, Oct 8, 2015 at 7:22 PM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
> One other note: I'm also using the latest src/main/dcf.c that was
> giving an issue on AIX previously; see
> [this](https://stat.ethz.ch/pipermail/r-devel/2015-September/071781.html)
> thread.
>
> Thanks.
>
> On Thu, Oct 8, 2015 at 6:51 PM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
>> Please note that if I don't specify those variables, then R 32 bit
>> compiles fine.  Thanks.
>>
>> -- Vinh

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


Re: [Rd] R 3.2.2 64 bit compilation error on AIX

2015-10-08 Thread Vinh Nguyen
Please note that if I don't specify those variables, then R 32 bit
compiles fine.  Thanks.
-- Vinh


On Thu, Oct 8, 2015 at 6:50 PM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
> Dear list,
>
> I'm following the instructions provided here to compile R 64 bit on
> AIX 6.1.  I did
>
> export OBJECT_MODE=64
> export CC="gcc -maix64 -pthread"
> export CXX="g++ -maix64 -pthread"
> export FC="gfortran -maix64 -pthread"
> export F77="gfortran -maix64 -pthread"
> export CFLAGS="-O2 -g -mcpu=power6"
> export FFLAGS="-O2 -g -mcpu=power6"
> export FCFLAGS="-O2 -g -mcpu=power6"
> ./configure
> make -j 16
>
> and it errors out at
>
> gcc -maix64 -pthread -std=gnu99 -I../../../../include -DNDEBUG
> -I../../../include -I../../../../src/include -DHAVE_CONFIG_H
> -I../../../../src/main -I/usr/local/include  -mminimal-toc-O2 -g
> -mcpu=power6  -c gramRd.c -o gramRd.o
>
> gcc -maix64 -pthread -std=gnu99 -shared -Wl,-brtl -Wl,-G -Wl,-bexpall
> -Wl,-bnoentry -lc -L/usr/local/lib -o tools.so text.o init.o Rmd5.o
> md5.o signals.o install.o getfmts.o http.o gramLatex.o gramRd.o -lm
> -lintl
>
> make[6]: Entering directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'
>
> mkdir -p -- ../../../../library/tools/libs
>
> make[6]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'
>
> make[5]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'
>
> make[4]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'
>
> make[4]: Entering directory '/sas/data04/vinh/R-3.2.2/src/library/tools'
>
> installing 'sysdata.rda'
>
> Error: Line starting 'Package: tools ...' is malformed!
>
> Execution halted
>
> ../../../share/make/basepkg.mk:150: recipe for target 'sysdata' failed
>
> make[4]: *** [sysdata] Error 1
>
> make[4]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'
>
> Makefile:30: recipe for target 'all' failed
>
> make[3]: *** [all] Error 2
>
> make[3]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'
>
> Makefile:36: recipe for target 'R' failed
>
> make[2]: *** [R] Error 1
>
> make[2]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library'
>
> Makefile:28: recipe for target 'R' failed
>
> make[1]: *** [R] Error 1
>
> make[1]: Leaving directory '/sas/data04/vinh/R-3.2.2/src'
>
> Makefile:59: recipe for target 'R' failed
>
> make: *** [R] Error 1
>
>
>
> I tried going all the way back to R 2.15.3 and I still get this error.
> Any suggestions for fixing this?  Thanks.
>
> -- Vinh

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


Re: [Rd] R 3.2.2 64 bit compilation error on AIX

2015-10-08 Thread Vinh Nguyen
One other note: I'm also using the latest src/main/dcf.c that was
giving an issue on AIX previously; see
[this](https://stat.ethz.ch/pipermail/r-devel/2015-September/071781.html)
thread.

Thanks.

On Thu, Oct 8, 2015 at 6:51 PM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
> Please note that if I don't specify those variables, then R 32 bit
> compiles fine.  Thanks.
>
> -- Vinh

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


[Rd] R 3.2.2 64 bit compilation error on AIX

2015-10-08 Thread Vinh Nguyen
Dear list,

I'm following the instructions provided here to compile R 64 bit on
AIX 6.1.  I did

export OBJECT_MODE=64
export CC="gcc -maix64 -pthread"
export CXX="g++ -maix64 -pthread"
export FC="gfortran -maix64 -pthread"
export F77="gfortran -maix64 -pthread"
export CFLAGS="-O2 -g -mcpu=power6"
export FFLAGS="-O2 -g -mcpu=power6"
export FCFLAGS="-O2 -g -mcpu=power6"
./configure
make -j 16

and it errors out at

gcc -maix64 -pthread -std=gnu99 -I../../../../include -DNDEBUG
-I../../../include -I../../../../src/include -DHAVE_CONFIG_H
-I../../../../src/main -I/usr/local/include  -mminimal-toc-O2 -g
-mcpu=power6  -c gramRd.c -o gramRd.o

gcc -maix64 -pthread -std=gnu99 -shared -Wl,-brtl -Wl,-G -Wl,-bexpall
-Wl,-bnoentry -lc -L/usr/local/lib -o tools.so text.o init.o Rmd5.o
md5.o signals.o install.o getfmts.o http.o gramLatex.o gramRd.o -lm
-lintl

make[6]: Entering directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'

mkdir -p -- ../../../../library/tools/libs

make[6]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'

make[5]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools/src'

make[4]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'

make[4]: Entering directory '/sas/data04/vinh/R-3.2.2/src/library/tools'

installing 'sysdata.rda'

Error: Line starting 'Package: tools ...' is malformed!

Execution halted

../../../share/make/basepkg.mk:150: recipe for target 'sysdata' failed

make[4]: *** [sysdata] Error 1

make[4]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'

Makefile:30: recipe for target 'all' failed

make[3]: *** [all] Error 2

make[3]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library/tools'

Makefile:36: recipe for target 'R' failed

make[2]: *** [R] Error 1

make[2]: Leaving directory '/sas/data04/vinh/R-3.2.2/src/library'

Makefile:28: recipe for target 'R' failed

make[1]: *** [R] Error 1

make[1]: Leaving directory '/sas/data04/vinh/R-3.2.2/src'

Makefile:59: recipe for target 'R' failed

make: *** [R] Error 1



I tried going all the way back to R 2.15.3 and I still get this error.
Any suggestions for fixing this?  Thanks.

-- Vinh

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


Re: [Rd] segfault with readDCF on R 3.1.2 on AIX 6.1 when using install.packages

2015-09-22 Thread Vinh Nguyen
On Tue, Sep 22, 2015 at 1:46 AM, Duncan Murdoch
 wrote:
> However, Herve's second example does illustrate a bug I can reproduce:
> one character out of 1 was read incorrectly.  Could you please try
> his final patch and see if it fixes your AIX problems?

Just tried the latest dcf.c from R-dev and install.packages no longer
segfaults from readDCF.  Thank you both Duncan and Murdoch for your
help.  Can finally make use of this AIX box now (fyi placed request to
get gdb installed but who knows when that would've been installed).

Thanks again.

-- Vinh

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


Re: [Rd] segfault with readDCF on R 3.1.2 on AIX 6.1 when using install.packages

2015-09-21 Thread Vinh Nguyen
On Mon, Sep 21, 2015 at 2:48 PM, Duncan Murdoch
 wrote:
> On 21/09/2015 4:50 PM, Hervé Pagès wrote:
>> Hi,
>>
>> Note that one significant change to read.dcf() that happened since R
>> 3.0.2 is the addition of support for arbitrary long lines (commit
>> 63281), which never worked:
>>
>>dcf <- paste(c("aa: ", rep(letters, length.out=1)), collapse="")
>>writeLines(dcf, "test.dcf")
>>nchar(read.dcf("test.dcf"))
>>#aa
>># [1,] 8186
>>
>
> I don't see that in R 3.2.2 on OSX or 3.2.2 patched on Windows:
>
>>nchar(read.dcf("test.dcf"))
> aa
> [1,] 1

I'm at home now and getting the following from Revolution R Open 3.2.2 on a Mac:

> dcf <- paste(c("aa: ", rep(letters, length.out=1)), collapse="")
> writeLines(dcf, "test.dcf")
> nchar(read.dcf("test.dcf"))
   aa
[1,] 8186

Here's what I see in the file:

$ wc -c test.dcf

   10005 test.dcf

Same results using Revolution R Open on Windows.  Also same results on
regular R 3.2.0 on Windows.

-- Vinh

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


Re: [Rd] segfault with readDCF on R 3.1.2 on AIX 6.1 when using install.packages

2015-09-21 Thread Vinh Nguyen
Here's an update:

I checked the ChangeLog for R, and it seems like readDCF was changed
in 3.0.2.  I went on a whim and copied src/main/dcf.c from R 2.15.3
over to 3.2.2, and R compiled fine and install.packages now work for
me.

This is probably not ideal, but it at least makes R usable on AIX for
me.  Would definitely like to help figure out what's wrong with the
new dcf.c on AIX.

Thanks.

-- Vinh


On Mon, Sep 21, 2015 at 10:01 AM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
> Hi there,
>
> I just wanted to follow up on this readDCF issue with install.packages
> on AIX on R 3.*.  I'm happy to help try potential solutions or debug
> if anyone could point me in the right direction.
>
> To re-cap, it appears readDCF is segfault'ing since R 3.* on AIX.
> This was not the case up until R 2.15.3.  This makes install.packages
> not usable.  Thanks.
>
> -- Vinh
>
>
> On Tue, Nov 11, 2014 at 10:23 AM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
>> Dear list (re-posting from r-help as r-devel is probably more appropriate),
>>
>> I was able to successfully compile R on our AIX box at work using the
>> GNU compilers following the instructions on the R Administration
>> guide.  The output can be seen at here
>> (https://gist.github.com/nguyenvinh/504321ea9c89d8919bef) and yields
>> no errors .
>>
>> However, I get a segfault whenever I try to use the install.packages
>> function to install packages.  Using debug, I was able to trace it to
>> the readDCF function:
>>
>> Browse[2]>
>> debug: if (!all) return(.Internal(readDCF(file, fields, keep.white)))
>> Browse[2]>
>> debug: return(.Internal(readDCF(file, fields, keep.white)))
>> Browse[2]>
>>
>>  *** caught segfault ***
>> address 4, cause 'invalid permissions'
>>
>> Possible actions:
>> 1: abort (with core dump, if enabled)
>> 2: normal R exit
>> 3: exit R without saving workspace
>> 4: exit R saving workspace
>> Selection:
>>
>> Was curious if anyone has a clue on why such error exists or what I
>> could do to fix it?  I'm able to install packages via R CMD INSTALL,
>> but I would hate to have to manually determine dependencies, download
>> the source for each package, and install them "by hand" via R CMD
>> INSTALL.
>>
>> I went back and compiled older versions of R to see if this error
>> exists.  On R 3.0.3, I get:
>>
>> debug(available.packages)
>> install.packages('ggplot2', dep=TRUE, repo='http://cran.stat.ucla.edu')
>> ...
>> Browse[2]>
>> debug: z <- res0 <- tryCatch(read.dcf(file = tmpf), error = identity)
>> Browse[2]>
>> Error: segfault from C stack overflow
>>
>> On R 2.15.3, I do not see the error.
>>
>> Would be great to get this resolved.  Thank you for your help.
>>
>> -- Vinh

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


Re: [Rd] segfault with readDCF on R 3.1.2 on AIX 6.1 when using install.packages

2015-09-21 Thread Vinh Nguyen
Hi there,

I just wanted to follow up on this readDCF issue with install.packages
on AIX on R 3.*.  I'm happy to help try potential solutions or debug
if anyone could point me in the right direction.

To re-cap, it appears readDCF is segfault'ing since R 3.* on AIX.
This was not the case up until R 2.15.3.  This makes install.packages
not usable.  Thanks.

-- Vinh


On Tue, Nov 11, 2014 at 10:23 AM, Vinh Nguyen <vinhdi...@gmail.com> wrote:
> Dear list (re-posting from r-help as r-devel is probably more appropriate),
>
> I was able to successfully compile R on our AIX box at work using the
> GNU compilers following the instructions on the R Administration
> guide.  The output can be seen at here
> (https://gist.github.com/nguyenvinh/504321ea9c89d8919bef) and yields
> no errors .
>
> However, I get a segfault whenever I try to use the install.packages
> function to install packages.  Using debug, I was able to trace it to
> the readDCF function:
>
> Browse[2]>
> debug: if (!all) return(.Internal(readDCF(file, fields, keep.white)))
> Browse[2]>
> debug: return(.Internal(readDCF(file, fields, keep.white)))
> Browse[2]>
>
>  *** caught segfault ***
> address 4, cause 'invalid permissions'
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> Selection:
>
> Was curious if anyone has a clue on why such error exists or what I
> could do to fix it?  I'm able to install packages via R CMD INSTALL,
> but I would hate to have to manually determine dependencies, download
> the source for each package, and install them "by hand" via R CMD
> INSTALL.
>
> I went back and compiled older versions of R to see if this error
> exists.  On R 3.0.3, I get:
>
> debug(available.packages)
> install.packages('ggplot2', dep=TRUE, repo='http://cran.stat.ucla.edu')
> ...
> Browse[2]>
> debug: z <- res0 <- tryCatch(read.dcf(file = tmpf), error = identity)
> Browse[2]>
> Error: segfault from C stack overflow
>
> On R 2.15.3, I do not see the error.
>
> Would be great to get this resolved.  Thank you for your help.
>
> -- Vinh

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


Re: [Rd] IdntoAscii issue with KERNEL32.dll on 64-bit R on Windows Server 2003 x64 SP2

2015-05-06 Thread Vinh Nguyen
On Wed, May 6, 2015 at 9:44 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On the MSDN page for that function, it mentions that you need a header file 
 and DLL to use it in XP or Server 2003.   You might try downloading the DLL 
 to see if it works for you automagically; I think it's unlikely we will put 
 in code to special case that version in the general release of R, as 
 Microsoft is abandoning it as of July this year.

Thanks Duncan.  I downloaded the files from
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318149%28v=vs.85%29.aspx,
extracted, and installed (idndl.amd64.exe); don't think the header
files were copied/moved anywhere.  The error still persists after
restarting the server.

Any other thoughts?  Thanks.


-- Vinh

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


[Rd] IdntoAscii issue with KERNEL32.dll on 64-bit R on Windows Server 2003 x64 SP2

2015-05-06 Thread Vinh Nguyen
Dear list,

With the new R 3.2.0 on the aforementioned platform, I get the following
pop-up error when I enter ?update.packages using R64:

The procedure entry point IdnToAscii could not be located in the dynamic
link library KERNEL32.dll

That is, my command never gets executed.  This does NOT happen with R32.

I previously noticed this error starting with R 3.0.0 with the RCurl
package (1.95-4.5): I get the same issue when I execute library(RCurl) in
R64.  This happened subsequently for every version  3.  I always thought
it was an RCurl issue so I just dropped to R 2.15.1 whenever I needed to
use it.

However, I now see this error with R 3.2.0 with the simple command
(?update.packages as it tries to access internet.dll).

My guess is this is specific to Windows Server 2003 x64 as it does not
happen on my Windows 7 machine and that I did not find anything when
searching for this issue.  I thought I'd reach out just in case anyone has
any ideas on how to fix it.  I'm stuck on Windows Server 2003 because it is
a work server.  Thanks so much for your help.

-- Vinh

[[alternative HTML version deleted]]

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


[Rd] segfault with readDCF on R 3.1.2 on AIX 6.1 when using install.packages

2014-11-11 Thread Vinh Nguyen
Dear list (re-posting from r-help as r-devel is probably more appropriate),

I was able to successfully compile R on our AIX box at work using the
GNU compilers following the instructions on the R Administration
guide.  The output can be seen at here
(https://gist.github.com/nguyenvinh/504321ea9c89d8919bef) and yields
no errors .

However, I get a segfault whenever I try to use the install.packages
function to install packages.  Using debug, I was able to trace it to
the readDCF function:

Browse[2]
debug: if (!all) return(.Internal(readDCF(file, fields, keep.white)))
Browse[2]
debug: return(.Internal(readDCF(file, fields, keep.white)))
Browse[2]

 *** caught segfault ***
address 4, cause 'invalid permissions'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

Was curious if anyone has a clue on why such error exists or what I
could do to fix it?  I'm able to install packages via R CMD INSTALL,
but I would hate to have to manually determine dependencies, download
the source for each package, and install them by hand via R CMD
INSTALL.

I went back and compiled older versions of R to see if this error
exists.  On R 3.0.3, I get:

debug(available.packages)
install.packages('ggplot2', dep=TRUE, repo='http://cran.stat.ucla.edu')
...
Browse[2]
debug: z - res0 - tryCatch(read.dcf(file = tmpf), error = identity)
Browse[2]
Error: segfault from C stack overflow

On R 2.15.3, I do not see the error.

Would be great to get this resolved.  Thank you for your help.

-- Vinh

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


Re: [Rd] build 32-bit R on x86_64?

2011-11-03 Thread Vinh Nguyen
Hi everyone,

I was trying to reproduce building a 32 bit version of R on a 64 bit
Ubuntu 11.04 machine (which worked before) with the latest version of
R in SVN but am getting this error:

make[3]: Leaving directory `/home/vinh/Downloads/R/trunk/src/modules/lapack'
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSM.so
when searching for -lSM
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libSM.a
when searching for -lSM
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libICE.so
when searching for -lICE
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libICE.a
when searching for -lICE
/usr/bin/ld: skipping incompatible
/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so when searching for
-lpangocairo-1.0
...


It should be looking in /usr/lib32, not /usr/lib.  I did the following
to arrive at these messages:

sudo apt-get install ia32-libs lib32readline6-dev lib32ncurses5-dev
lib32icu-dev gcc-multilib gfortran-multilib ## ubuntu does not have
ia32-libs-dev
./configure r_arch=i386 CC='gcc -std=gnu99 -m32' CXX='g++ -m32'
FC='gfortran -m32' F77='gfortran -m32'
make -j24

Any suggestions on how to fix this?  Thanks.

-- Vinh

On Wed, Aug 10, 2011 at 8:37 AM, Vinh Nguyen vqngu...@uci.edu wrote:
 On Tue, Aug 9, 2011 at 6:24 PM, Simon Urbanek
 simon.urba...@r-project.org wrote:
 It actually works ;) I'm using it for testing on my RForge.net machine and 
 yes, it's Debian - everything just works there :).

 But back to the original question. First a minor detail, don't set 
 environment variables use configure variables instead. Second, don't build 
 in the source directory, always create an object directory. Third, r_arch is 
 simply a name you set for the architecture, it has no meaning other than 
 that it's a label.

 So now to the real stuff. If you want 32-bit build, you'll need 32-bit 
 runtime of everything important in your system and the multilib compilers. 
 In Debian (and thus likely in Ubuntu too) that can be achieved by something 
 like

 sudo apt-get install  ia32-libs-dev lib32readline6-dev lib32ncurses5-dev 
 lib32icu-dev gcc-multilib gfortran-multilib

 Then you can build both 64-bit and 32-bit R, the difference will be in the 
 all compiler flags -- for 64-bit you'll use -m64 (or nothing since it's the 
 default) and for 32-bit you'll use -m32.

 So roughly something like

 tar fxz R-2.13.1.tar.gz
 mkdir obj-32
 cd obj-32
 ../R-2.13.1/configure r_arch=i386 CC='gcc -std=gnu99 -m32' CXX='g++ -m32' 
 FC='gfortran -m32' F77='gfortran -m32'
 make -j24  sudo make install rhome=/usr/local/R/2.13
 cd ..
 mkdir obj-64
 cd obj-64
 ../R-2.13.1/configure r_arch=amd64
 make -j24  sudo make install rhome=/usr/local/R/2.13

 That will leave you with multi-arch R that you can run with
 R --arch=i386 # 32-bit
 R --arch=amd64 # 64-bit
 Packages will be also built as multi-libs. Good luck :)
 [BTW the rhome=... setting is entirely optional, I just like to keep my R 
 versions organized…]

 Cheers,
 Simon


 Thanks Simon!  Confirm that these instructions work.  ia32-libs-dev
 was not available for Ubuntu Natty, so I installed ia32-libs instead,
 and the compilation works!

 -- Vinh

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


Re: [Rd] build 32-bit R on x86_64?

2011-08-10 Thread Vinh Nguyen
On Tue, Aug 9, 2011 at 6:24 PM, Simon Urbanek
simon.urba...@r-project.org wrote:
 It actually works ;) I'm using it for testing on my RForge.net machine and 
 yes, it's Debian - everything just works there :).

 But back to the original question. First a minor detail, don't set 
 environment variables use configure variables instead. Second, don't build in 
 the source directory, always create an object directory. Third, r_arch is 
 simply a name you set for the architecture, it has no meaning other than that 
 it's a label.

 So now to the real stuff. If you want 32-bit build, you'll need 32-bit 
 runtime of everything important in your system and the multilib compilers. In 
 Debian (and thus likely in Ubuntu too) that can be achieved by something like

 sudo apt-get install  ia32-libs-dev lib32readline6-dev lib32ncurses5-dev 
 lib32icu-dev gcc-multilib gfortran-multilib

 Then you can build both 64-bit and 32-bit R, the difference will be in the 
 all compiler flags -- for 64-bit you'll use -m64 (or nothing since it's the 
 default) and for 32-bit you'll use -m32.

 So roughly something like

 tar fxz R-2.13.1.tar.gz
 mkdir obj-32
 cd obj-32
 ../R-2.13.1/configure r_arch=i386 CC='gcc -std=gnu99 -m32' CXX='g++ -m32' 
 FC='gfortran -m32' F77='gfortran -m32'
 make -j24  sudo make install rhome=/usr/local/R/2.13
 cd ..
 mkdir obj-64
 cd obj-64
 ../R-2.13.1/configure r_arch=amd64
 make -j24  sudo make install rhome=/usr/local/R/2.13

 That will leave you with multi-arch R that you can run with
 R --arch=i386 # 32-bit
 R --arch=amd64 # 64-bit
 Packages will be also built as multi-libs. Good luck :)
 [BTW the rhome=... setting is entirely optional, I just like to keep my R 
 versions organized…]

 Cheers,
 Simon


Thanks Simon!  Confirm that these instructions work.  ia32-libs-dev
was not available for Ubuntu Natty, so I installed ia32-libs instead,
and the compilation works!

-- Vinh

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


[Rd] build 32-bit R on x86_64?

2011-08-09 Thread Vinh Nguyen
Dear R-Devel,

I'm using Ubuntu on an x86_64 machine and would like to have both the
32-bit and 64-bit versions of R built from source.  By default,
following the usual build procedures yields 64 bit R.  Looking at
[these](http://cran.r-project.org/doc/manuals/R-admin.html#Sub_002darchitectures),
I thought I could build 32-bit R by executing

r_arch=32 ./configure

and building R like usual (make).  However, after seeing this error message,

/usr/bin/install: cannot create regular file
`../../include/32/Rconfig.h': No such file or directory

I realize I am misunderstanding the instructions.  Could someone
please clarify how I could go about compiling both 32-bit and 64-bit
versions of R on my Linux machine?  Thank you!

-- Vinh

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


Re: [Rd] build 32-bit R on x86_64?

2011-08-09 Thread Vinh Nguyen
On Tue, Aug 9, 2011 at 4:52 PM, Joris Meys jorism...@gmail.com wrote:
 The architecture is called i386. Try

 r_arch=i386 ./configure

 That should work.
 Cheers
 Joris

Thank you for your response Joris.  However, I still get:
/usr/bin/install: cannot create regular file
`../../include/i386/Rconfig.h': No such file or directory

I don't think r_arch necessarily instruct make to build 32-bit
versions of R; I think it's more of a prefix in the name.

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


Re: [Rd] [Roxygen-devel] Roxygen: @example tag does not work for me

2010-11-04 Thread Vinh Nguyen
I didn't know @example path/to/file.R was available until you
mentioned the UseR! 2010 presentation.  If that's the case, I'm going
to guess that you have to specify use.Rd2=TRUE in roxygenize(), as
I've found most of the new features mentioned in that presentation to
require it.


On Thu, Nov 4, 2010 at 6:14 AM, Janko Thyson
janko.thy...@ku-eichstaett.de wrote:

 Hi Vinh,

 thanks for the reply. What you suggest works just fine. It's not the thing
 I'm looking for, though, since it means I have to hard code my examples to
 the actual script. That's exactly what I'm trying to get around. And there
 is this ominous @example tag that should get the job done, I just don't
 get how ;-)

 Thanks for your comment though!

 Regards, Janko


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


[Rd] args() and body() equivalents for S4 methods?

2010-10-05 Thread Vinh Nguyen
Dear list,

Suppose some methods were defined for a generic function genF(fitobj,
...).  Suppose one has signature(fitobj=lm) and
signature(fitobj=glm).  The ... piece of each method could have
different arguments.  I'm aware of getMethod(genF, lm) to get the
function definition but are there equivalents to the args() and body()
functions?

Thanks.
Vinh
--
Vinh Nguyen
Department of Statistics
Donald Bren School of ICS
2231 Bren Hall
University of California, Irvine
Irvine, CA 92607
vqngu...@uci.edu | http://www.ics.uci.edu/~vqnguyen/
Schedule a meeting: http://tungle.me/VinhNguyen

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


Re: [Rd] args() and body() equivalents for S4 methods?

2010-10-05 Thread Vinh Nguyen
On Tue, Oct 5, 2010 at 4:45 PM, Thomas Lumley tlum...@uw.edu wrote:
 You could define

 args4-function(generic, signature) args(getMethod(generic,signature))
 and
 body4-function(generic, signature) body(getMethod(generic,signature))

 or use selectMethod() instead of getMethod() if you want to find
 inherited methods.

   -thomas

Thanks Professor Lumley, this is sufficient.

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


[Rd] advice on writing/maintaining an R package with a version control system

2010-09-16 Thread Vinh Nguyen
Dear all,

As I resume my dissertation work next month, I'd like to actually
start an R package this time around.  I haven't done so because I
update my code very often (still in development phase), so running the
skeleton function, running checks, building, and re-installing the
package onto the system seemed like a long and tedious process.

I would like to hear your experience on how you start an R package
with a version control system.  Currently, I have most of my functions
in an R source file.  I expect to use a skeleton function to generate
the package directory (most likely Rcpp's), and start git as my
version control system (although the advice I'm seeking isn't
git-specific).  Once the version control system is set up, a few
questions:

1.  Do you update your code directly into the multiple R files in
./src, or do you update the main R source file?  I'm assuming the
former since we're using version control.
2.  What is your process for updating and testing your code?  Do you
run checks, build, and re-install the package to test?  Or do you have
some fancy workflow?  Please share.

Thanks for your advice.

Vinh
--
Vinh Nguyen
Department of Statistics
Donald Bren School of ICS
2231 Bren Hall
University of California, Irvine
Irvine, CA 92607
vqngu...@uci.edu | http://www.ics.uci.edu/~vqnguyen/
Schedule a meeting: http://tungle.me/VinhNguyen

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


Re: [Rd] R + C + Lapack toy regression example

2009-09-24 Thread Vinh Nguyen
thank you William Dunlap and professor Bates for your responses.
Since the first argument is always an N for linear regression, i
just placed
const char* trans = N;
in my .c file and things worked.
See some comments below.

On Thu, Sep 24, 2009 at 5:50 AM, Douglas Bates ba...@stat.wisc.edu wrote:
 In your C code you are treating that object as a C character string
 (char*) but that is not what is being passed.  Look at section 5.2 of
 Writing R Extensions - a character variable in R is passed by .C as
 a char**, not a char*.


so i suppose you can't get char* from R?  i tried as.raw and that
didn't work either.

 I find it much easier to use the .Call interface instead of the .C
 interface for applications like this.  You do need to learn some of
 the mysteries of the functions declared in Rinternals.h but, once you
 do, it is much easier to pass a matrix from R with and extract all the
 fussy details within the C code.  Several of the C source code files
 in the Matrix package are devoted to exactly the kind of operation you
 want to carry out.  Look at the function lsq_dense_QR in
 Matrix/src/dense.c, for example. (Although now that I look at it
 myself I see some questionable programming practices - I should have
 PROTECTed the result of coerceVector but it happens that it would not
 have needed protection.  Rather than coercing I should just check
 isInteger on the dim attribute.)

So if someone were to re-implement linear regression using C/C++ and
not fortran, would u imagine it being implemented via the .C()
function and using Lapack?  Or how would the matrix manipulations be
handled in C?

Thanks.
Vinh

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


Re: [Rd] R + C + Lapack toy regression example

2009-09-24 Thread Vinh Nguyen
On Thu, Sep 24, 2009 at 11:49 AM, Simon Urbanek
simon.urba...@r-project.org wrote:
 As Doug pointed out you don't want to be using .C(). As for matrix
 manipulations - they are usually done directly on the objects which are
 vectors stored in column-major order.

i meant .Call().   also, sorry for the poor word choice, i meant
matrix computations, not matrix manipulations.  i guess i just want
some recommendations for future references on what C library to use if
i were doing something like re-implement linear regression
(hypothetically speaking).  i assumed it would be lapack.  is this the
recommended approach?

vinh

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


[Rd] R + C + Lapack toy regression example

2009-09-23 Thread Vinh Nguyen
dear list,

since matrix manipulations is often of interest in statistical
computations, i'd like to get a working example of using Lapack for
regression.  However, i run into an error.

My matrix-lapack-example.c file:
#include R_ext/Lapack.h

void reg(const char* trans, const int* m, const int* n,
 const int* nrhs, double* a, const int* lda,
 double* b, const int* ldb,
 double* work, const int* lwork, int* info)
{
  F77_CALL(dgels)(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info);
}

My matrix-lapack-example.R file:
dyn.load( matrix-lapack-example.so )

regression - function( X, Y ){
  m - nrow( X )
  n - ncol( X )
  stopifnot( m = n , is.vector( Y ), n != length( Y ) )
  mn - min( m, n )
  lwork - mn + max( mn, 1 )
  ### to be used with dgels
  ### http://www.netlib.org/lapack/double/dgels.f
  rslt - .C( reg
 , trans=as.character( N )
 , m=as.integer( m ), n=as.integer( n )
 , nrhs=as.integer( 1 ), a=as.double( X )
 , lda=as.integer( m ), b=as.double( Y )
 , ldb=as.integer( m ) , work=double( lwork )
 , lwork=as.integer( lwork )
 , info=integer( 1 ) )
  ##F77_NAME(dgels)(const char* trans, const int* m, const int* n,
  ##const int* nrhs, double* a, const int* lda,
  ##double* b, const int* ldb,
  ##double* work, const int* lwork, int* info);
  return( rslt )
}

n - 100
x - rnorm( 100 )
y - 2.5 + 3*x + rnorm( n )
X - cbind( 1, x )

temp - regression( X=X, Y=y )


dgels does linear least squares.  the C code compile fines with a
warning (ld: warning, duplicate dylib
/usr/local/lib/libgcc_s.1.dylib).  in R, i get the following when i
run regression():
 temp - regression( X=X, Y=y )
Parameter 1 to routine DGELS  was incorrect
Mac OS BLAS parameter error in DGELS , parameter #0, (unavailable), is 0

Process R exited abnormally with code 1 at Wed Sep 23 00:21:59 2009

am i doing something wrong?  is my as.character() used wrong here?

i know R uses fortran code for lm.  but suppose i wanted to do
regression in C/C++.  is this lapack method the recommended / best
practice route?  i just want to know whats the recommended method for
doing matrix manipulations in C.  thanks!

vinh

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


Re: [Rd] building r packages for windows on a mac/linux

2009-09-04 Thread Vinh Nguyen
thank you professor Ligges for the build farm.  i was aware of it.
however, i'm just trying to learn how to build things myself.  thanks
to hin-tak, i did successfully cross build on R 2.8 on my mac.  i will
try to cross build r 2.9 next based on hin-tak's suggestions.

i don't know the exact reason why the R core team dropped support for
the cross build, but if it's because of the perceived 'lack of
demand,' i'd just like to note and show there is some demand (me), so
hopefully support will be back.

thanks.
vinh
--
This e-mail/fax message, including any attachments, is for the sole
use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
please contact the sender by reply e-mail/fax and destroy all copies
of the original message.



On Fri, Sep 4, 2009 at 2:12 AM, Uwe
Liggeslig...@statistik.tu-dortmund.de wrote:
 For those who have no confidential packages without license issues, want to
 build a Windows binary but do not have Windows available: please also note
 the service provided at
 http://win-builder.r-project.org/

 Uwe Ligges



 Hin-Tak Leung wrote:

 --- On Thu, 3/9/09, Vinh Nguyen vinhdi...@gmail.com wrote:

 hmmmtried building R-2.8.0 on my
 mac, didn't work.  i think it got
 the very end before failing:
 i386-mingw32-windres --preprocessor=i386-mingw32-gcc -E
 -xc
 -DRC_INVOKED -I
 /Users/vinh/Downloads/Rwin/R-2.8.0/include  -I -i
 methods_res.rc -o methods_res.o
 i386-mingw32-gcc  -std=gnu99  -shared -s  -o
 methods.dll methods.def
 class_support.o do_substitute_direct.o init.o
 methods_list_dispatch.o
 slot.o tests.o methods_res.o -L/Users/vinh/Downloads/Rwin/R-2.8.0/bin
   -lR
  ... DLL made
  installing DLL
  collecting R files
  preparing package methods for lazy loading
  dumping R code in package `methods'
 cp:

 /Library/Frameworks/R.framework/Resources/library/methods/libs/methods.so:
 No such file or directory
 make[4]: ***
 [/Users/vinh/Downloads/Rwin/R-2.8.0/library/methods/R/methods.rdb]
 Error 1
 make[3]: *** [all] Error 2
 make[2]: *** [pkg-methods] Error 2
 make[1]: *** [rpackage] Error 1
 make: *** [all] Error 2

 It is probably wiser to use the last of 2.8 (i.e. 2.8.1patched)

 That seems to be buggy - anyhow, I said to build win32 R package you need
 to have the win32 R.dll, I don't mean you have to build it yourself. You can
 just take it out of the official win32 R installer.

 if i go to bin/R.exe, my wine opens R fine.  so i
 think this is OK.
 my ultimate goal would be to build a package for
 windows.  looking
 through the admin file, i don't understand how i would do
 this (even
 if i didn't get that previous error).  could u kindly
 point me in the
 direction of how to do this?  make what?

 The instruction for cross-compiling R packages is in a file called
 README.packages or some such under src/gnuwin32 . The file was removed in
 R 2.9.x (as the content is no longer supported).

 BTW, you have not shown your affiliation nor the reason why you want to go
 this way - and I am reluctant to do one-on-one hand-holding on annonymity.
 So please keep the CC:, or arrange for commercial consultancy.


    __
 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