[Rd] FORTRAN compilation error

2012-02-08 Thread David L Lorenz
I get an error when trying to compile a FORTRAN source file for use in a 
package that I am developing. The error, reported in 00install.out is 
below.

* installing *source* package 'USGSstats' ...
** libs

*** arch - i386
C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:194: warning: overriding recipe 
for target `.m.o'
C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:187: warning: ignoring old 
recipe for target `.m.o'
gfortran  -O3  -mtune=core2 -c seakenF.f -o seakenF.o
"zseakenF.o" was unexpected at this time.
make: *** [USGSstats.dll] Error 255
ERROR: compilation failed for package 'USGSstats'

I am running R 2.14.1 on a Windows 7 pc. The gnu compilers are all 
installed and work just fine. In fact, the .o file is created and I can 
manually create the .dll file.
The error seems to be in the generation of the object name zseakenF.o. I 
do not see where that might have been generated in the Makeconf file.

Thanks. Dave

[[alternative HTML version deleted]]

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


Re: [Rd] FORTRAN compilation error

2012-02-09 Thread David L Lorenz
 $(ALL_CFLAGS) -c $< -o $@
.c.d:
@echo "making $@ from $<"
@$(CC) -std=gnu99 -MM $(ALL_CPPFLAGS) $< > $@
.cc.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
.cpp.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
.cc.d:
@echo "making $@ from $<"
@$(CXX) -M $(ALL_CPPFLAGS) $< > $@
.cpp.d:
@echo "making $@ from $<"
@$(CXX) -M $(ALL_CPPFLAGS) $< > $@
.m.o:
$(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
.m.d:
@echo "making $@ from $<"
@$(OBJC) -MM $(ALL_CPPFLAGS) $< > $@
.mm.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.M.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.f.o:
$(F77) $(ALL_FFLAGS) -c $< -o $@
.f95.o:
$(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c  $< -o $@
.f90.o:
$(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c  $< -o $@

%.exe:
$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) 
$(LOCAL_LIBS) $(LIBS)

%.dll:
@echo EXPORTS > $*.def
@$(NM) $^ | $(SED) -n $(SYMPAT) >> $*.def
$(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $*.def $^ $(ALL_LIBS)
@$(RM) $*.def

lib%.dll.a: %.def
$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll 
--input-def $*.def --output-lib $@

%.a:
@$(RM) $@
$(AR) crs $@ $^

%.o: %.rc
$(RESCOMP) $(RESFLAGS) -i $< -o $@




From:
Simon Urbanek 
To:
David L Lorenz 
Cc:
r-devel@r-project.org
Date:
02/08/2012 07:13 PM
Subject:
Re: [Rd] FORTRAN compilation error




On Feb 8, 2012, at 3:16 PM, David L Lorenz wrote:

> I get an error when trying to compile a FORTRAN source file for use in a 

> package that I am developing. The error, reported in 00install.out is 
> below.
> 
> * installing *source* package 'USGSstats' ...
> ** libs
> 
> *** arch - i386
> C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:194: warning: overriding 
recipe 
> for target `.m.o'
> C:/PROGRA~1/R/R-214~1.1/etc/i386/Makeconf:187: warning: ignoring old 
> recipe for target `.m.o'
> gfortran  -O3  -mtune=core2 -c seakenF.f -o seakenF.o
> "zseakenF.o" was unexpected at this time.
> make: *** [USGSstats.dll] Error 255
> ERROR: compilation failed for package 'USGSstats'
> 
> I am running R 2.14.1 on a Windows 7 pc. The gnu compilers are all 
> installed and work just fine. In fact, the .o file is created and I can 
> manually create the .dll file.
> The error seems to be in the generation of the object name zseakenF.o. I 

> do not see where that might have been generated in the Makeconf file.
> 

The problem is caused by your Makeconf which you didn't share, so there is 
not much we can help you with ... You should remove the offending Makeconf 
to start with ...

Cheers,
Simon





[[alternative HTML version deleted]]

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


Re: [Rd] FORTRAN compilation error

2012-02-09 Thread David L Lorenz
Simon,
  It was not clear that I needed any makefiles in src. I have seen no 
documentation anywhere that I needed a makefile in src. 
  The FORTRAN source compiles just fine by hand, so the error is not in 
the code. It is just one single source code file with one subroutine.
  The problem appears to be the z that is inserted in from the the object 
file name when the .dll is created.
  Thanks.
Dave



From:
Simon Urbanek 
To:
David L Lorenz 
Cc:
r-devel@r-project.org
Date:
02/09/2012 09:24 AM
Subject:
Re: [Rd] FORTRAN compilation error



On Feb 9, 2012, at 9:54 AM, David L Lorenz wrote:

> 
> I should also have explained that I was using the default Makeconf file 
in R-2.14.1\etc\i386. it is reproduced below. I've tried it on other 
packages and it inserts a z in front of the object files. 

I'm not talking about R Makeconf, but the one in your package (in src). 
What are your settings there? And what are the files?

Thanks,
Simon



> Dave 
> 
> #-*- Makefile -*- 
> # $(R_HOME}/etc$(R_ARCH)/Makeconf 
> 
> # Hand-edited version for gnuwin32. 
> 
> ifdef DEBUG 
>   DLLFLAGS= 
>   DEBUGFLAG=-gdwarf-2 
> else 
>   DLLFLAGS=-s 
>   DEBUGFLAG= 
> endif 
> 
> DLLFLAGS+= -static-libgcc 
> LINKFLAGS+= -static-libgcc 
> 
> ## Things which are substituted by fixed/Makefile (and also -O3 -> -O2) 
> WIN = 32 
> BINPREF = 
> # SYMPAT = 's/^.* [BCDRT] _/ /p' for 32-bit 
> # SYMPAT = 's/^.* [BCDRT] / /p' for 64-bit 
> SYMPAT = 's/^.* [BCDRT] _/ /p' 
> IMPDIR = bin/i386 
> # flags for multilib builds, for compilers, dlltool and windres 
> M_ARCH = 
> DT_ARCH = 
> RC_ARCH = 
> # Used by packages tcltk and tkrplot 
> TCL_HOME = $(R_HOME)/Tcl 
> LOCAL_SOFT = d:/RCompile/CRANpkg/extralibs/local 
> 
> ifneq ($(strip $(LOCAL_SOFT)),) 
> LOCAL_CPPFLAGS = -I"$(LOCAL_SOFT)/include" 
> LOCAL_LIBS = -L"$(LOCAL_SOFT)/lib$(R_ARCH)" -L"$(LOCAL_SOFT)/lib" 
> endif 
> 
> DLLTOOL = $(BINPREF)dlltool --as $(BINPREF)as $(DT_ARCH) 
> DLLTOOLFLAGS = -k 
> NM = $(BINPREF)nm 
> RESCOMP = $(BINPREF)windres $(RC_ARCH) 
> ## MAIN_LD needs to be set by the package 
> LINKER = $(MAIN_LD) 
> ## as a default 
> DLL = $(CC) 
> 
> ## Things defined in Renviron on Unix 
> SED = sed 
> TAR = tar 
> 
> ## Things defined in MkRules 
> CAT = cat 
> CP = cp 
> MKDIR = mkdir 
> RM = rm -f 
> SORT = sort 
> 
> ## For use in packages 
> GRAPHAPP_LIB = -lRgraphapp 
> TCL_VERSION = 85 
> ZLIB_LIBS = -lRzlib 
> 
> AR = $(BINPREF)ar 
> ## Used by packages 'maps' and 'mapdata' 
> AWK = gawk 
> BLAS_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRblas 
> C_VISIBILITY = 
> CC = $(BINPREF)gcc $(M_ARCH) 
> CFLAGS = -O3 -Wall $(DEBUGFLAG) -std=gnu99 -mtune=core2 
> CPICFLAGS = 
> CPPFLAGS = 
> CXX = $(BINPREF)g++ $(M_ARCH) 
> CXXCPP = $(CXX) -E 
> CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mtune=core2 
> CXXPICFLAGS = 
> DYLIB_EXT = .dll 
> DYLIB_LD = $(DLL) 
> DYLIB_LDFLAGS = -shared 
> DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS) 
> ECHO = echo 
> ECHO_C = 
> ECHO_N = -n 
> ECHO_T = 
> FC = $(BINPREF)gfortran $(M_ARCH) 
> FCFLAGS = -O3 $(DEBUGFLAG) -mtune=core2 
> # additional libs needed when linking with $(FC), e.g. on Solaris 
> FCLIBS = 
> F77 = $(BINPREF)gfortran $(M_ARCH) 
> F77_VISIBILITY = 
> FFLAGS = -O3 $(DEBUGFLAG) -mtune=core2 
> FLIBS = -lgfortran 
> FCPICFLAGS = 
> FPICFLAGS = 
> FOUNDATION_CPPFLAGS = 
> FOUNDATION_LIBS = 
> JAR = 
> JAVA = 
> JAVAC = 
> JAVAH = 
> # JAVA_HOME = 
> # JAVA_LD_LIBRARY_PATH = 
> JAVA_LIBS = -L"$(JAVA_HOME)/bin/client" -ljvm -ljvm-w32 
> JAVA_CPPFLAGS = -I"$(JAVA_HOME)/../include" 
-I"$(JAVA_HOME)/../include/win32" 
> LAPACK_LIBS = -L"$(R_HOME)/$(IMPDIR)" -lRlapack 
> ## we only need this is if it is external, as otherwise link to R 
> LIBINTL= 
> LIBM = -lm 
> LIBR = -L"$(R_HOME)/$(IMPDIR)" -lR 
> LIBS =  -lm 
> ## needed by R CMD config 
> LIBnn = lib 
> LIBTOOL = 
> LDFLAGS = 
> ## needed to build applications linking to static libR 
> # MAIN_LD = 
> # MAIN_LDFLAGS = 
> # MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS) 
> # don't have this: would 'mkdir -p' do? 
> # MKINSTALLDIRS = $(R_HOME)/bin/mkinstalldirs 
> OBJC = $(CC) 
> OBJCFLAGS = -O2 
> OBJC_LIBS = -lobjc 
> OBJCXX = 
> R_ARCH = /i386 
> RANLIB = $(BINPREF)ranlib 
> SAFE_FFLAGS = -O3 -ffloat-store 
> SED = sed 
> ## it seems some makes (but not ours) get upset if SHELL is set. 
> # SHELL = /bin/sh 
> SHLIB_CFLAGS = 
> SHLIB_CXXFLAGS = 
> SHLIB_CXXLD = $(CXX) 
> ## ideally -shared -static-libstdc++, but

Re: [Rd] requesting a new SIG mailing list

2012-02-15 Thread David L Lorenz
All,
  Is it decided then? It does make sense to me, because much of the 
hydrologic work that we do is related to aquatic ecology.
  I am responsible for coordinating the migration to use R as the 
supported statistical package within the Water Mission Area of the USGS. 
I'd expect that many of our hydrologists will be interested in subscribing 
to r-sig-ecology to keep up with fellow researchers. I am also sure that 
some will be frustrated because they will need to wade through material 
not directly related to their work.
  When I hear r-sig-ecology will be the forum for hydrology, I'll notify 
the transition team so that they can subscribe and other hydrologist as 
they start to use R.
  Thanks.
Dave



From:
Sarah Goslee 
To:
mauricio.zambr...@jrc.ec.europa.eu
Cc:
Dominik Reusser , r-devel@r-project.org, 
w.buyta...@imperial.ac.uk
Date:
02/14/2012 11:24 AM
Subject:
Re: [Rd] requesting a new SIG mailing list
Sent by:
r-devel-boun...@r-project.org



Hello,

I'm one of the maintainers of the r-sig-ecology list, and I think
it would be entirely appropriate to include hydrology within
the scope of the list.

There hasn't been much hydrologic discussion, as you noted,
but not because we wish to exclude it.

Sarah

On Tue, Feb 14, 2012 at 11:31 AM, Mauricio Zambrano-Bigiarini
 wrote:

> Another possibility could be to use the R-sig-ecology, which seems to be
> more related to hydrology:
>
> "analytical techniques and topics that are appropriate for discussion on
> R-sig-ecology are quite broad. For examples of what might be appropriate 
for
> discussion on this list, please see the Environmentrics Task View
> (http://cran.r-project.org/web/views/Environmetrics.html)"
> (taken from: https://stat.ethz.ch/mailman/listinfo/r-sig-ecology)
>
> However, I did a quick search on the archives of 'R-sig-ecology' for the
> year 2011, and I could only found one single mail related to hydrology:
>
> https://stat.ethz.ch/pipermail/r-sig-ecology/2011-July/002274.html
>
> (in the same search I couldn't find any single reference to hydrology in 
the
> R-sig-geo during the year 2011)

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] I wish xlim=c(0, NA) would work. How about I send you a patch?

2012-04-16 Thread David L Lorenz
Paul,
  How about
plot(x,y, xlim=c(0, max(pretty(x

Dave



From:
Paul Johnson 
To:
R Devel List 
Date:
04/16/2012 12:54 PM
Subject:
[Rd] I wish xlim=c(0, NA) would work. How about I send you a patch?
Sent by:
r-devel-boun...@r-project.org



I'm looking for an R mentor.  I want to propose a change in management
of plot options xlim and ylim.

Did you ever want to change one coordinate in xlim or ylim? It happens
to me all the time.

x <- rnorm(100, m=5, s=1)
y <- rnorm(100, m=6, s=1)
plot(x,y)

## Oh, I want the "y axis" to show above x=0.

plot(x,y, xlim=c(0, ))

##Output: Error in c(0, ) : argument 2 is empty

 plot(x,y, xlim=c(0,NA ))
## Output: Error in plot.window(...) : need finite 'xlim' values


I wish that plot would let me supply just the min (or max) and then
calculate the other value where needed.
It is a little bit tedious for the user to do that for herself.  The
user must be knowledgeable enough to know where the maximum (MAX) is
supposed to be, and then supply xlim=c(0, MAX). I can't see any reason
for insisting users have that deeper understanding of how R calculates
ranges for plots.

Suppose the user is allowed to supply NA to signal R should fill in the 
blanks.

plot(x,y, xlim=c(0, NA))


In plot.default now, I find this code to manage xlim

   xlim <- if (is.null(xlim))
range(xy$x[is.finite(xy$x)])

And I would change it to be something like
   ##get default range
   nxlim <- range(xy$x[is.finite(xy$x)])

   ## if xlim is NULL, so same as current
xlim <- if (is.null(xlim)) nxlim
## Otherwise, replace NAs in xlim with values from nxlim
else xlim[ is.na(xlim) ] <- nxlim[ is.na(xlim) ]


Who is the responsible party for plot.default.  How about it?

Think of how much happier users would be!

pj
-- 
Paul E. Johnson
Professor, Political ScienceAssoc. Director
1541 Lilac Lane, Room 504 Center for Research Methods
University of Kansas   University of Kansas
http://pj.freefaculty.orghttp://quant.ku.edu

__
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] How does .Fortran "dqrls" work?

2012-04-27 Thread David L Lorenz
  Of course, what you could do is Google dqrls and get the source and 
documentation. That is because it is in the publically available linpack. 
If it were not publically available that would not work. Theoretically, 
all FORTRAN or C code in R should be publically available.
Dave




From:

To:

Date:
04/27/2012 06:28 AM
Subject:
Re: [Rd] How does .Fortran "dqrls" work?
Sent by:
r-devel-boun...@r-project.org



yangleicq  writes:

> Hi, all.
> I want to write some functions like glm() so i studied it.
> In glm.fit(), it calls a fortran subroutine named  "dqrfit" to compute 
least
> squares solutions
>  to the system
>   x * b = y
>
> To learn how "dqrfit" works, I just follow how glm() calls "dqrfit" by 
my
> own example, my codes are given below:
>
>>  qr <-
>> 
matrix(c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14,2.3,1.7,1.3,1.7,1.7,1.6,1,1.7,1.7,1.7),ncol=2)
>> qr 
>   [,1] [,2]
>  [1,] 4.17  2.3
>  [2,] 5.58  1.7
>  [3,] 5.18  1.3
>  [4,] 6.11  1.7
>  [5,] 4.50  1.7
>  [6,] 4.61  1.6
>  [7,] 5.17  1.0
>  [8,] 4.53  1.7
>  [9,] 5.33  1.7
> [10,] 5.14  1.7
>> n=10
>>  p=2
>>  y <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
>>  ny=1L
>>  tol=1e-07
>>  coefficients=double(p)
>>  residuals=double(n)
>>  effects=double(n)
>>  rank=integer(1L)
>>  pivot=1:n
>>  qraux=double(n)
>>  work=double(2*n)
>> 
>> 
>> 
>>  fittt<-.Fortran("dqrls", qr =qr, n = n, 
> + p = p, y = y, ny = ny, tol = tol,
> coefficients=coefficients,
> + residuals = residuals, effects = effects, 
> + rank = rank, pivot = pivot, qraux = qraux, 
> + work = work, PACKAGE = "base")
>> 
>>  fittt$coefficients
> [1] 0 0

You have the args for .Fortran wrong. Try:

> fargs <- structure(list("dqrls", qr = structure(c(1, 1, 1, 1, 1, 1, 1, 
+ 1, 1, 1, 4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, 4.53, 5.33, 
+ 5.14, 2.3, 1.7, 1.3, 1.7, 1.7, 1.6, 1, 1.7, 1.7, 1.7), .Dim = c(10L, 
+ 3L)), n = 10L, p = 3L, y = c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 
+ 6.03, 4.89, 4.32, 4.69), ny = 1L, tol = 1e-11, coefficients = c(0, 
+ 0, 0), residuals = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), effects = c(0, 
+ 0, 0, 0, 0, 0, 0, 0, 0, 0), rank = 0L, pivot = 1:3, qraux = c(0, 
+ 0, 0), work = c(0, 0, 0, 0, 0, 0), PACKAGE = "base"), .Names = c("", 
+ "qr", "n", "p", "y", "ny", "tol", "coefficients", "residuals", 
+ "effects", "rank", "pivot", "qraux", "work", "PACKAGE"))
> do.call(.Fortran,fargs)$coef
[1] 11.176571 -0.883272 -1.262772
>

TIP: It often helps to use something like

 debug(function.calling.Fortran) 

and then step thru the function till the call you want to study is
invoked. Then inspect the inputs one-by-one and tinker with them and
recall the function or save them via 

 dput( list(...) , file="fargs" ) 

so you can later invoke the function as above.

HTH,

Chuck 


>
> but when i use lm() which also calls "dqrls" internally to fit this 
model,
> it gives reasonable result.
>
>> lm(y~qr)
>
> Call:
> lm(formula = y ~ qr)
>
> Coefficients:
> (Intercept)  qr1  qr2 
> 11.1766  -0.8833  -1.2628 
>
>
> when I change the coefficients to be c(1,1), the output from "dqrls", 
> fittt$coefficients also equals to c(1,1). That means the 
.Fortran("dqrls",
> qr=qr,n=n,p=p,...) did nothing to the coefficients! I don't know why, is
> there anything I did wrong or missed?  How can I get the result from 
"dqrls"
> as what lm() or glm() gets from "dqrls"?
>
> Thanks in advance. Best Regards.
>
>
>
> --
> View this message in context: 
http://r.789695.n4.nabble.com/How-does-Fortran-dqrls-work-tp4588973p4588973.html

> Sent from the R devel mailing list archive at Nabble.com.
>

-- 
Charles C. BerryDept of Family/Preventive 
Medicine
cberry at ucsd edu   UC 
San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
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] S4 objects in formulas

2012-07-23 Thread David L Lorenz
Hi,
  I have very carefully developed several S4 classes that describe 
censored water-quality data. I have routines for them that will support 
their use in data.frames and so forth. I have run into a problem when I 
try to use the S4 class as the response variable in a formula and try to 
extract the model frame. I get an error like:

Error in model.frame.default(as.lcens(Y) ~ X) : object is not a matrix

  In this case, as.lcens works much like the Surv function in the survival 
package except that the object is an S4 class and not a matrix of class 
Surv. I would have expected that the model.frame function would have been 
able to manipulate any kind of object that can be subsetted and put into a 
data.frame. But that appears not to be the case. I'm using R 2.14.1 if 
that matters.
  I can supply the routines for the lcens data if needed.
  Am I looking at needing to write a wrapper to convert all of my S4 
classes into matrices and then extract the necessary data in the matrices 
according to rules for the particular kind of S4 class? Or, am I missing a 
key piece on how model.frame works?
  Thanks.
Dave

[[alternative HTML version deleted]]

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


[Rd] Shared routines in a dynamic library.

2012-07-30 Thread David L Lorenz
All,
  I have a question about referring to a subroutine that is in a dynamic 
library other than the one in my current package.
Let's say that I have a package foo and it has some FORTRAN code that 
contains the subroutines foo1 and foocommon. The package foo has an R 
function that calls foo1 and foocommon is a subroutine that is called from 
foo1.
And, I have another package called bar which also has some FORTRAN code 
that contains the subrouting bar1. But bar1 also calls foocommon. The bar 
package is distinctly different from foo, but would require foo (even if 
the FORTRAN code did not have the common subroutine).

  I can think of a few ways to resolve this.
1. Place a copy of foocommon.f into the shared library for bar.
2. Put all of the FORTRAN code into the foo package and just rely on the R 
code in bar to call the code that it needs.
3. Refer to the shared library in the bar package. I assume that I'd do 
this in the NAMESPACE file using useDynLib(foo) in addition to 
useDynLib(bar), but I found no reference to it in Writing R extensions.
  Is there a recommended way to solve this issue? Thanks.
Dave
[[alternative HTML version deleted]]

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


[Rd] virus and malicious code

2012-08-06 Thread David L Lorenz
Hi,
  A question has come up within a user group about the possibility of 
viruses or other malicious code being embedded within any package served 
from CRAN. How much checking is done to guard against this? I do not 
expect any kind of response about picking up R code from any other source, 
like gitHub. Thanks.
Dave
[[alternative HTML version deleted]]

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


[Rd] misc subdirectory

2012-08-24 Thread David L Lorenz
  The utils package has a misc folder, and some other packages have 
folders that are not listed in the R-extensions documentation (?data?, ?
demo?, ?exec?, ?inst?, ?man?, ?po?, ?src?, and ?tests?). I'd like to be 
able to put some ancillary data into a misc folder, but it's mere presence 
in the source folder or source tarball (created with R CMD build) does not 
mean that it gets put into the zip file (I'm using Windoze) for the 
package.
  How do I get an extra, nonstandard subdirectory into a package?
  Thanks.
Dave
[[alternative HTML version deleted]]

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


[Rd] Vignette question

2012-09-04 Thread David L Lorenz
All,
  I seem to be missing some key point about the construction of vignettes. 
I have created a vignette script that works fine when run interactively 
using Sweave. The top part of the .Rnw file is below.

\documentclass{article}
\parskip 3pt
\parindent 30pt
%\VignetteIndexEntry{Box Plot Examples}
%\VignetteDepends{USGSgraphs}

\begin{document}

\title{Box Plot Examples}

\author{Dave Lorenz}

\maketitle

... text omittted from this example ...
<>=
# Generate a random sample for the box plot
set.seed(27036)
BP <- rchisq(32, 3)
# setSweave is a specialized function that sets up the graphics page
setSweave("boxplot01", 6 ,6)
# Set layout for 4 graphs
AA.lo <- setLayout(width=rep(1.25, 4), height=4, xtop=1.5)

... remainder omitted ...

  The functions setSweave and setLayout are functions within the 
USGSgraphs library that I am building. As I said, the script runs just 
fine when I run interactively. I do have a version of the USGSgraphs 
library attached when I run the script. When I run R CMD check, or R CMD 
build on the source, I get the error:

Error: processing vignette 'boxplots.Rnw' failed with diagnostics:
 chunk 1
Error in eval(expr, envir, enclos) : could not find function "setSweave"
Execution halted

  I would have expected that the contents of the library being built would 
have been available to the script (based on section 1.3.2 in R-exts.html). 
Barring that, I expected that "%\VignetteDepends{USGSgraphs}" would have 
made those functions available to the script. I have found that if I 
include this code before the first real example, it will run.

<>=
library(USGSgraphs)
@

  But I have no reason to believe that it would run on any system that did 
not already have a version of USGSgraphs installed. Note that if I use the 
default graphics output, then I get the same error on setLayout.
  I use the default process for building the vignettes--no makefile.
  What do I need to do to get this vignette to run? I know I can set 
BuildVignettes to FALSE in the DESCRIPTION file or try to build with the 
--no-vignettes option, but that does not really address the more general 
issue.
  Thanks.
Dave

[[alternative HTML version deleted]]

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


Re: [Rd] Vignette question

2012-09-04 Thread David L Lorenz
Duncan,
  That does make sense. But then what does %\VignetteDepends{USGSgraphs} 
do if it does not actually make the library available from the temporary 
library tree?
Dave



From:
Duncan Murdoch 
To:
David L Lorenz 
Cc:
r-devel@r-project.org
Date:
09/04/2012 09:34 AM
Subject:
Re: [Rd] Vignette question



On 04/09/2012 9:47 AM, David L Lorenz wrote:
> All,
>I seem to be missing some key point about the construction of 
vignettes.
> I have created a vignette script that works fine when run interactively
> using Sweave. The top part of the .Rnw file is below.
>
> \documentclass{article}
> \parskip 3pt
> \parindent 30pt
> %\VignetteIndexEntry{Box Plot Examples}
> %\VignetteDepends{USGSgraphs}
>
> \begin{document}
>
> \title{Box Plot Examples}
>
> \author{Dave Lorenz}
>
> \maketitle
>
> ... text omittted from this example ...
> <>=
> # Generate a random sample for the box plot
> set.seed(27036)
> BP <- rchisq(32, 3)
> # setSweave is a specialized function that sets up the graphics page
> setSweave("boxplot01", 6 ,6)
> # Set layout for 4 graphs
> AA.lo <- setLayout(width=rep(1.25, 4), height=4, xtop=1.5)
>
> ... remainder omitted ...
>
>The functions setSweave and setLayout are functions within the
> USGSgraphs library that I am building. As I said, the script runs just
> fine when I run interactively. I do have a version of the USGSgraphs
> library attached when I run the script. When I run R CMD check, or R CMD
> build on the source, I get the error:
>
> Error: processing vignette 'boxplots.Rnw' failed with diagnostics:
>   chunk 1
> Error in eval(expr, envir, enclos) : could not find function "setSweave"
> Execution halted
>
>I would have expected that the contents of the library being built 
would
> have been available to the script (based on section 1.3.2 in 
R-exts.html).
> Barring that, I expected that "%\VignetteDepends{USGSgraphs}" would have
> made those functions available to the script. I have found that if I
> include this code before the first real example, it will run.
>
> <>=
> library(USGSgraphs)
> @
>
>But I have no reason to believe that it would run on any system that 
did
> not already have a version of USGSgraphs installed. Note that if I use 
the
> default graphics output, then I get the same error on setLayout.
>I use the default process for building the vignettes--no makefile.
>What do I need to do to get this vignette to run? I know I can set
> BuildVignettes to FALSE in the DESCRIPTION file or try to build with the
> --no-vignettes option, but that does not really address the more general
> issue.

Vignettes are run in pretty standard R sessions when the package is 
built, so you need the explicit library(USGSgraphs) call to make 
functions from your package available in that session.  What the manual 
is saying is just that that call will succeed:  R will install a copy of 
your package in order to build the vignette.  It goes into a "temporary 
library tree", because you might not want that particular version 
installed in your main tree.

Duncan Murdoch



[[alternative HTML version deleted]]

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


[Rd] S4method

2012-09-28 Thread David L Lorenz
I get an error when I try to use \S4method in a usage section in an Rd 
file for a function. I tried to duplicate exactly how stats4 documents its 
method functions, but I must be missing something. Here is the top part of 
the Rd file:

\name{xyPlot-methods}
\docType{methods}
\alias{xyPlot-methods}
\alias{xyPlot,numeric,numeric-method}
\title{Methods for Function \code{xyPlot}}
\description{
Create a line or scatter plot.
}
\usage{
\S4method{xyPlot}{numeric, numeric}(x, y, 
Plot = list(name = "", what = "lines", type = "solid", width = "standard", 

 symbol = "circle", filled = TRUE, size = 0.09, color = "black"), 
yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), 
xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, 
xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), 
caption = "", margin = c(NA, NA, NA, NA))
}

  The error I get is 

Bad \usage lines found in documentation object 'xyPlot-methods':
  S4method{xyPlot}{numeric, numeric}(x, y,
  Plot = list(name = "", what = "lines", type = "solid", width = 
"standard",
   symbol = "circle", filled = TRUE, size = 0.09, color = "black"),
  yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA),
  xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7,
  xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)),
  caption = "", margin = c(NA, NA, NA, NA))

  Here's my R info:

R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-mingw32/x64 (64-bit)

  The error is treated as a WARNING, so I can build and install the 
package and the documentation file looks fine when I ask for help on 
xyPlot-methods. What am I missing?
  Thanks.
Dave

[[alternative HTML version deleted]]

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


Re: [Rd] S4method

2012-09-28 Thread David L Lorenz
Martin, that was it. Thanks. Dave



From:
Martin Morgan 
To:
David L Lorenz 
Cc:
r-devel@r-project.org
Date:
09/28/2012 02:39 PM
Subject:
Re: [Rd] S4method



On 09/28/2012 11:57 AM, David L Lorenz wrote:
> I get an error when I try to use \S4method in a usage section in an Rd
> file for a function. I tried to duplicate exactly how stats4 documents 
its
> method functions, but I must be missing something. Here is the top part 
of
> the Rd file:
>
> \name{xyPlot-methods}
> \docType{methods}
> \alias{xyPlot-methods}
> \alias{xyPlot,numeric,numeric-method}
> \title{Methods for Function \code{xyPlot}}
> \description{
> Create a line or scatter plot.
> }
> \usage{
> \S4method{xyPlot}{numeric, numeric}(x, y,
> Plot = list(name = "", what = "lines", type = "solid", width = 
"standard",
>
>   symbol = "circle", filled = TRUE, size = 0.09, color = "black"),
> yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA),
> xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7,
> xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)),
> caption = "", margin = c(NA, NA, NA, NA))
> }
>
>The error I get is
>
> Bad \usage lines found in documentation object 'xyPlot-methods':
>S4method{xyPlot}{numeric, numeric}(x, y,

Hi David - R is being picky about spaces; use {numeric,numeric}. Martin

>Plot = list(name = "", what = "lines", type = "solid", width =
> "standard",
> symbol = "circle", filled = TRUE, size = 0.09, color = "black"),
>yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA),
>xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7,
>xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)),
>caption = "", margin = c(NA, NA, NA, NA))
>
>Here's my R info:
>
> R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
> Copyright (C) 2012 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
>The error is treated as a WARNING, so I can build and install the
> package and the documentation file looks fine when I ask for help on
> xyPlot-methods. What am I missing?
>Thanks.
> Dave
>
>[[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



[[alternative HTML version deleted]]

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