Re: [Rd] error in trunc function (PR#9782)

2007-07-16 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
 Full_Name: Claudio
 Version: 2.5.1
 OS: windows
 Submission from: (NULL) (157.138.120.198)


 the command get a wrong result

   
 trunc(2.3*100)
 
 229

 __
Not a bug, read FAQ 7.31 and the reference therein.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[Rd] formula(CO2)

2007-07-16 Thread Gabor Grothendieck
The formula attribute of the builtin CO2 dataset seems a bit strange:

 formula(CO2)
Plant ~ Type + Treatment + conc + uptake

What is one supposed to do with that?  Certainly its not suitable for
input to lm and none of the examples in ?CO2 use the above.

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


Re: [Rd] formula(CO2)

2007-07-16 Thread Ted Harding
On 16-Jul-07 13:28:50, Gabor Grothendieck wrote:
 The formula attribute of the builtin CO2 dataset seems a bit strange:
 
 formula(CO2)
 Plant ~ Type + Treatment + conc + uptake
 
 What is one supposed to do with that?  Certainly its not suitable
 for input to lm and none of the examples in ?CO2 use the above.

I think one is supposed to ignore it! (Or maybe be inspired to
write a mail to the list ... ).

I couldn't find anything that looked like the above formula from
str(CO2). But I did spot that the order of terms in the formula:
Plant, Type, treatment, conc, uptake, is the same as the order
of the columns in the dataframe.

So I tried:

  D-data.frame(x=(1:10),y=(1:10))

  formula(D)
  x ~ y

So, lo and behold, D has a formula!

Or does it? Maybe if you give formula() a dataframe, it simply
constructs one from the columns.

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jul-07   Time: 14:57:28
-- XFMail --

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


Re: [Rd] formula(CO2)

2007-07-16 Thread Ted Harding
On 16-Jul-07 13:57:56, Ted Harding wrote:
 On 16-Jul-07 13:28:50, Gabor Grothendieck wrote:
 The formula attribute of the builtin CO2 dataset seems a bit strange:
 
 formula(CO2)
 Plant ~ Type + Treatment + conc + uptake
 
 What is one supposed to do with that?  Certainly its not suitable
 for input to lm and none of the examples in ?CO2 use the above.
 
 I think one is supposed to ignore it! (Or maybe be inspired to
 write a mail to the list ... ).
 
 I couldn't find anything that looked like the above formula from
 str(CO2). But I did spot that the order of terms in the formula:
 Plant, Type, treatment, conc, uptake, is the same as the order
 of the columns in the dataframe.
 
 So I tried:
 
   D-data.frame(x=(1:10),y=(1:10))
 
   formula(D)
   x ~ y
 
 So, lo and behold, D has a formula!
 
 Or does it? Maybe if you give formula() a dataframe, it simply
 constructs one from the columns.

Now that I think about it, I can see a use for this phenomenon:

   formula(CO2)
  Plant ~ Type + Treatment + conc + uptake
   formula(CO2[,2:5])
  Type ~ Treatment + conc + uptake
   formula(CO2[,3:5])
  Treatment ~ conc + uptake
   formula(CO2[,4:5])
  conc ~ uptake
   formula(CO2[,c(5,1,2,3,4)])
  uptake ~ Plant + Type + Treatment + conc


Could save a lot of typing!

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jul-07   Time: 15:14:38
-- XFMail --

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


Re: [Rd] formula(CO2)

2007-07-16 Thread Gabor Grothendieck
Good point.

It seems that the groupedData methods are all in the nlme package yet
CO2 is in datasets.  CO2 should probably be moved to nlme.

Of course one still wonders whether the way formula currently works on
data frames is really intended and desirable.  Ted's point is well taken
but I think formula.data.frame could still have the current default
yet be user overridable via the formula attribute.

On 7/16/07, Gavin Simpson [EMAIL PROTECTED] wrote:
 On Mon, 2007-07-16 at 14:57 +0100, [EMAIL PROTECTED] wrote:
  On 16-Jul-07 13:28:50, Gabor Grothendieck wrote:
   The formula attribute of the builtin CO2 dataset seems a bit strange:
  
   formula(CO2)
   Plant ~ Type + Treatment + conc + uptake
  
   What is one supposed to do with that?  Certainly its not suitable
   for input to lm and none of the examples in ?CO2 use the above.
 
  I think one is supposed to ignore it! (Or maybe be inspired to
  write a mail to the list ... ).
 
  I couldn't find anything that looked like the above formula from
  str(CO2). But I did spot that the order of terms in the formula:
  Plant, Type, treatment, conc, uptake, is the same as the order
  of the columns in the dataframe.

 CO2 is a groupedData object not a data.frame per se.

  class(CO2)
 [1] nfnGroupedData nfGroupedData  groupedDatadata.frame

 What Gabor saw was the result of formula.data.frame being applied to
 CO2, which, as you surmise Ted, is being produced from the columns of
 CO2.

  formula(CO2)
 Plant ~ Type + Treatment + conc + uptake
  stats:::formula.data.frame(CO2)
 Plant ~ Type + Treatment + conc + uptake

 But if we load nlme, we see that now (via a groupedData method for
 formula) a more useful formula is displayed.

  require(nlme)
 Loading required package: nlme
 [1] TRUE
  formula(CO2)
 uptake ~ conc | Plant

 as this can then be directly used in lme

  lme(CO2)
 Linear mixed-effects model fit by REML
  Data: CO2
  Log-restricted-likelihood: -283.1447
  Fixed: uptake ~ conc
 (Intercept)conc
 19.50028981  0.01773059
 snip /

 But like Gabor, I'm struggling to see where this [formula(data.frame)]
 might be used (useful)?

 G
 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



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


Re: [Rd] formula(CO2)

2007-07-16 Thread Gabor Grothendieck
Note that the formula uptake ~. will do the same thing so its not clear
how useful this facility really is.

On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
 On 16-Jul-07 14:16:10, Gabor Grothendieck wrote:
  Following up on your comments it seems formula.data.frame just creates
  a formula whose lhs is the first column name and whose rhs is made up
  of the remaining column names.  It ignores the formula attribute.
 
  In fact, CO2 does have a formula attribute but its not extracted by
  formula.data.frame:
 
  [EMAIL PROTECTED]
  uptake ~ conc | Plant
  formula(CO2)
  Plant ~ Type + Treatment + conc + uptake

 Indeed! And, following up yet again on my own follow-up comment:

 library(combinat)

 for(j in (1:4)){
  for(i in combn((1:4),j,simplify=FALSE)){
print(formula(CO2[,c(5,i)]))
  }
 }
 uptake ~ Plant
 uptake ~ Type
 uptake ~ Treatment
 uptake ~ conc
 uptake ~ Plant + Type
 uptake ~ Plant + Treatment
 uptake ~ Plant + conc
 uptake ~ Type + Treatment
 uptake ~ Type + conc
 uptake ~ Treatment + conc
 uptake ~ Plant + Type + Treatment
 uptake ~ Plant + Type + conc
 uptake ~ Plant + Treatment + conc
 uptake ~ Type + Treatment + conc
 uptake ~ Plant + Type + Treatment + conc

 opening the door to automated fitting of all possible models
 (without interactions)!

 Now if only I could find out how to do the interactions as well,
 I would never need to think again!

 best wishes,
 Ted.

 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 16-Jul-07   Time: 15:40:36
 -- XFMail --


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


[Rd] S4 coerce

2007-07-16 Thread Paul Gilbert
(I am not sure if this is a bug or a request for a more understandable 
warning, or possible something obvious I should be posting on r-help.)

I am trying to coerce an new class object to be a DBIConnection and it 
does not work the way I think it should:

R version 2.5.1 (2007-06-27) ...
  require(RMySQL) # or require(RSQLite)
Loading required package: RMySQL
Loading required package: DBI
[1] TRUE
  m - dbDriver(MySQL)  # or  m - dbDriver(SQLite)
  con - dbConnect(m, dbname=test)
  dbGetQuery(con, create table zzz (
+vintage VARCHAR(20) NOT NULL,
+alias   VARCHAR(20) default NULL,
+Documentation TEXT,
+PRIMARY KEY (vintage)
+);)
NULL
  dbListTables(con)
  [1] zzz
  setClass(TSconnection, representation(con=DBIConnection,
+vintage = logical,
+panel   = logical)
+)
[1] TSconnection
  setAs(TSconnection, DBIConnection, def = function(from) [EMAIL 
  PROTECTED])
  setIs(TSconnection, DBIConnection, coerce = function(x) [EMAIL 
  PROTECTED])
Warning messages:
1: there is no automatic definition for as(object, DBIConnection) - 
value when object has class TSconnection and no 'replace' argument was 
supplied; replacement will be an error in: makeExtends(class1, class2, 
coerce, test, replace, by, classDef1 = classDef,
2: methods currently exist for coercing from TSconnection to 
DBIConnection; they will be replaced. in: 
..removePreviousCoerce(class1, class2, where, prevIs)

# (warning may be important, but I don't understand it)

  setAs(TSconnection, MySQLConnection, def = function(from) [EMAIL 
  PROTECTED])
  setIs(TSconnection, MySQLConnection, coerce = function(x) [EMAIL 
  PROTECTED])
Warning messages:
1: there is no automatic definition for as(object, MySQLConnection) - 
value when object has class TSconnection and no 'replace' argument was 
supplied; replacement will be an error in: makeExtends(class1, class2, 
coerce, test, replace, by, classDef1 = classDef,
2: methods currently exist for coercing from TSconnection to 
MySQLConnection; they will be replaced. in: 
..removePreviousCoerce(class1, class2, where, prevIs)

  # or
  # setAs(TSconnection, SQLiteConnection, def = function(from) 
[EMAIL PROTECTED])
  # setIs(TSconnection, SQLiteConnection, coerce = function(x) [EMAIL 
  PROTECTED])

  Tcon - new(TSconnection, con=dbConnect(m, dbname=test), 
vintage=FALSE, panel=FALSE)
  is(Tcon, DBIConnection)
[1] TRUE
  is(Tcon, MySQLConnection)
[1] TRUE
  # or is(Tcon, SQLiteConnection)

  # This fails but I think it should work
  dbListTables(Tcon)
Error in slot(from, Id) : no slot of name Id for this object of 
class TSconnection

#these all work
  dbListTables([EMAIL PROTECTED])
  [1] zzz
  dbListTables(as(Tcon, MySQLConnection) )
  [1] zzz
  dbListTables(as(Tcon, DBIConnection) )
  [1] zzz
 

Is this a bug or am I doing something wrong?

Thanks,
Paul Gilbert


La version française suit le texte anglais.



This email may contain privileged and/or confidential inform...{{dropped}}

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


Re: [Rd] formula(CO2)

2007-07-16 Thread Ted Harding
On 16-Jul-07 14:16:10, Gabor Grothendieck wrote:
 Following up on your comments it seems formula.data.frame just creates
 a formula whose lhs is the first column name and whose rhs is made up
 of the remaining column names.  It ignores the formula attribute.
 
 In fact, CO2 does have a formula attribute but its not extracted by
 formula.data.frame:
 
 [EMAIL PROTECTED]
 uptake ~ conc | Plant
 formula(CO2)
 Plant ~ Type + Treatment + conc + uptake

Indeed! And, following up yet again on my own follow-up comment:

library(combinat)

for(j in (1:4)){
  for(i in combn((1:4),j,simplify=FALSE)){
print(formula(CO2[,c(5,i)]))
  }
}
uptake ~ Plant
uptake ~ Type
uptake ~ Treatment
uptake ~ conc
uptake ~ Plant + Type
uptake ~ Plant + Treatment
uptake ~ Plant + conc
uptake ~ Type + Treatment
uptake ~ Type + conc
uptake ~ Treatment + conc
uptake ~ Plant + Type + Treatment
uptake ~ Plant + Type + conc
uptake ~ Plant + Treatment + conc
uptake ~ Type + Treatment + conc
uptake ~ Plant + Type + Treatment + conc

opening the door to automated fitting of all possible models
(without interactions)!

Now if only I could find out how to do the interactions as well,
I would never need to think again!

best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jul-07   Time: 15:40:36
-- XFMail --

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


Re: [Rd] formula(CO2)

2007-07-16 Thread Gabor Grothendieck
Yes. That's what I was referring to.

On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
 On 16-Jul-07 14:42:19, Gabor Grothendieck wrote:
  Note that the formula uptake ~. will do the same thing so its
  not clear how useful this facility really is.

 Hmmm... Do you mean somthing like

  lm(uptake ~ . , data=CO2[,i])

 where i is a subset of (1:4) as in my code below? In which case
 I agree!

 Ted.


 
  On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
  On 16-Jul-07 14:16:10, Gabor Grothendieck wrote:
   Following up on your comments it seems formula.data.frame just
   creates
   a formula whose lhs is the first column name and whose rhs is made
   up
   of the remaining column names.  It ignores the formula attribute.
  
   In fact, CO2 does have a formula attribute but its not extracted by
   formula.data.frame:
  
   [EMAIL PROTECTED]
   uptake ~ conc | Plant
   formula(CO2)
   Plant ~ Type + Treatment + conc + uptake
 
  Indeed! And, following up yet again on my own follow-up comment:
 
  library(combinat)
 
  for(j in (1:4)){
   for(i in combn((1:4),j,simplify=FALSE)){
 print(formula(CO2[,c(5,i)]))
   }
  }
  uptake ~ Plant
  uptake ~ Type
  uptake ~ Treatment
  uptake ~ conc
  uptake ~ Plant + Type
  uptake ~ Plant + Treatment
  uptake ~ Plant + conc
  uptake ~ Type + Treatment
  uptake ~ Type + conc
  uptake ~ Treatment + conc
  uptake ~ Plant + Type + Treatment
  uptake ~ Plant + Type + conc
  uptake ~ Plant + Treatment + conc
  uptake ~ Type + Treatment + conc
  uptake ~ Plant + Type + Treatment + conc
 
  opening the door to automated fitting of all possible models
  (without interactions)!
 
  Now if only I could find out how to do the interactions as well,
  I would never need to think again!
 
  best wishes,
  Ted.
 
  
  E-Mail: (Ted Harding) [EMAIL PROTECTED]
  Fax-to-email: +44 (0)870 094 0861
  Date: 16-Jul-07   Time: 15:40:36
  -- XFMail --
 
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel

 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 16-Jul-07   Time: 16:13:15
 -- XFMail --


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


Re: [Rd] formula(CO2)

2007-07-16 Thread Ted Harding
On 16-Jul-07 14:42:19, Gabor Grothendieck wrote:
 Note that the formula uptake ~. will do the same thing so its
 not clear how useful this facility really is.

Hmmm... Do you mean somthing like

  lm(uptake ~ . , data=CO2[,i])

where i is a subset of (1:4) as in my code below? In which case
I agree!

Ted.


 
 On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
 On 16-Jul-07 14:16:10, Gabor Grothendieck wrote:
  Following up on your comments it seems formula.data.frame just
  creates
  a formula whose lhs is the first column name and whose rhs is made
  up
  of the remaining column names.  It ignores the formula attribute.
 
  In fact, CO2 does have a formula attribute but its not extracted by
  formula.data.frame:
 
  [EMAIL PROTECTED]
  uptake ~ conc | Plant
  formula(CO2)
  Plant ~ Type + Treatment + conc + uptake

 Indeed! And, following up yet again on my own follow-up comment:

 library(combinat)

 for(j in (1:4)){
  for(i in combn((1:4),j,simplify=FALSE)){
print(formula(CO2[,c(5,i)]))
  }
 }
 uptake ~ Plant
 uptake ~ Type
 uptake ~ Treatment
 uptake ~ conc
 uptake ~ Plant + Type
 uptake ~ Plant + Treatment
 uptake ~ Plant + conc
 uptake ~ Type + Treatment
 uptake ~ Type + conc
 uptake ~ Treatment + conc
 uptake ~ Plant + Type + Treatment
 uptake ~ Plant + Type + conc
 uptake ~ Plant + Treatment + conc
 uptake ~ Type + Treatment + conc
 uptake ~ Plant + Type + Treatment + conc

 opening the door to automated fitting of all possible models
 (without interactions)!

 Now if only I could find out how to do the interactions as well,
 I would never need to think again!

 best wishes,
 Ted.

 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 16-Jul-07   Time: 15:40:36
 -- XFMail --

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


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 16-Jul-07   Time: 16:13:15
-- XFMail --

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


Re: [Rd] formula(CO2)

2007-07-16 Thread S Ellison
CO2 is apparently a groupedData object; the formula attribute is described by 
Pinheiro and Bates as a 'display formula'.

Perhaps reference to the nlme package's groupedData help would be informative?

 

 Gabor Grothendieck [EMAIL PROTECTED] 16/07/2007 16:18:37 
Yes. That's what I was referring to.

On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
 On 16-Jul-07 14:42:19, Gabor Grothendieck wrote:
  Note that the formula uptake ~. will do the same thing so its
  not clear how useful this facility really is.

 Hmmm... Do you mean somthing like

  lm(uptake ~ . , data=CO2[,i])

 where i is a subset of (1:4) as in my code below? In which case
 I agree!

 Ted.


 
  On 7/16/07, Ted Harding [EMAIL PROTECTED] wrote:
  On 16-Jul-07 14:16:10, Gabor Grothendieck wrote:
   Following up on your comments it seems formula.data.frame just
   creates
   a formula whose lhs is the first column name and whose rhs is made
   up
   of the remaining column names.  It ignores the formula attribute.
  
   In fact, CO2 does have a formula attribute but its not extracted by
   formula.data.frame:
  
   [EMAIL PROTECTED]
   uptake ~ conc | Plant
   formula(CO2)
   Plant ~ Type + Treatment + conc + uptake
 
  Indeed! And, following up yet again on my own follow-up comment:
 
  library(combinat)
 
  for(j in (1:4)){
   for(i in combn((1:4),j,simplify=FALSE)){
 print(formula(CO2[,c(5,i)]))
   }
  }
  uptake ~ Plant
  uptake ~ Type
  uptake ~ Treatment
  uptake ~ conc
  uptake ~ Plant + Type
  uptake ~ Plant + Treatment
  uptake ~ Plant + conc
  uptake ~ Type + Treatment
  uptake ~ Type + conc
  uptake ~ Treatment + conc
  uptake ~ Plant + Type + Treatment
  uptake ~ Plant + Type + conc
  uptake ~ Plant + Treatment + conc
  uptake ~ Type + Treatment + conc
  uptake ~ Plant + Type + Treatment + conc
 
  opening the door to automated fitting of all possible models
  (without interactions)!
 
  Now if only I could find out how to do the interactions as well,
  I would never need to think again!
 
  best wishes,
  Ted.
 
  
  E-Mail: (Ted Harding) [EMAIL PROTECTED]
  Fax-to-email: +44 (0)870 094 0861
  Date: 16-Jul-07   Time: 15:40:36
  -- XFMail --
 
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel 

 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 16-Jul-07   Time: 16:13:15
 -- XFMail --


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

***
This email and any attachments are confidential. Any use, co...{{dropped}}

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


[Rd] Problem building R with Sun Studio Compiler

2007-07-16 Thread Len Zaifman
I would like to Build R-2.5.1 on OpenSUSE 10.2 using the SunStudio 12
compilers(http://developers.sun.com/sunstudio/index.jsp)

R builds and passes make check fine without optimising. However, when I try to 
compile with optimisation turned on
(-fast) the build gets stuck in an infinite loop  at the following point:

Sun_Studio/sunstudio12/bin/cc -m64 -shared -Kpic   -m64 -fPIC  -o grDevices.so 
chull.o devNull.o devPicTeX.o devPS.o
devQuartz.o init.o
mkdir -p -- ../../../../library/grDevices/libs
make[5]: Leaving directory 
`/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/grDevices/src'
make[4]: Leaving directory 
`/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/grDevices/src'

R is running at this point and will run for as long as I do not kill it. If I 
compile without-fast the next line
in the make is:



make[3]: Entering directory 
`/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/graphics'

and the entire package builds and make check verifies correctly. Any ideas on 
why this is happening?

The build works fine for gcc as well.

-- 
Len Zaifman
Systems Manager, Supercomputing Systems
Centre for Computational Biology
Hospital for Sick Children
Toronto, Ont. M5G 1X8
[EMAIL PROTECTED]
(416)813-5513

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


Re: [Rd] How to disable R's C stack checking

2007-07-16 Thread Simon Urbanek

On Jul 6, 2007, at 6:57 AM, Ev Whin wrote:

 Hi all,

 I'm developing an application on Mac OS X Darwin which embeds R.
 However, the application always crashes due to the C stack checking.
 I know that R_CStackLimit can be set to -1 to disable the stack
 checking, but I don't know where to put the code R_CStackLimit=-1.


After the call to Rf_initialize_R (and don't forget to define  
CSTACK_DEFNS and include Rinterface.h).

Cheers,
Simon

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


Re: [Rd] Problem building R with Sun Studio Compiler

2007-07-16 Thread Prof Brian Ripley
The R-admin manual did tell you not to do that!

   When using the Sun compilers do @emph{not} specify @option{-fast}, as
   this disables @acronym{IEEE} arithmetic and @command{make check} will
   fail.

That was for Solaris and SunStudio 11, but I presume these are basically 
the same compilers.  (--fast has been a no-no for as long as I have been 
using R on Solaris, ca 10 years.)

On Mon, 16 Jul 2007, Len Zaifman wrote:

 I would like to Build R-2.5.1 on OpenSUSE 10.2 using the SunStudio 12
 compilers(http://developers.sun.com/sunstudio/index.jsp)

 R builds and passes make check fine without optimising. However, when I try 
 to compile with optimisation turned on
 (-fast) the build gets stuck in an infinite loop  at the following point:

 Sun_Studio/sunstudio12/bin/cc -m64 -shared -Kpic   -m64 -fPIC  -o 
 grDevices.so chull.o devNull.o devPicTeX.o devPS.o
 devQuartz.o init.o
 mkdir -p -- ../../../../library/grDevices/libs
 make[5]: Leaving directory 
 `/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/grDevices/src'
 make[4]: Leaving directory 
 `/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/grDevices/src'

 R is running at this point and will run for as long as I do not kill it. 
 If I compile without -fast the next line in the make is:

 make[3]: Entering directory 
 `/export/home/leonardz/ccb/HPF/support/R-2.5.1/ss12/R-2.5.1/src/library/graphics'

 and the entire package builds and make check verifies correctly. Any 
 ideas on why this is happening?

 The build works fine for gcc as well.



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[Rd] substitute and expression

2007-07-16 Thread Deepayan Sarkar
Hi,

I'm trying to understand whether the use of substitute() is
appropriate/documented for plotmath annotation. The following two
calls give the same results:

 plot(1:10, main = expression(alpha == 1))
 do.call(plot, list(1:10, main = expression(alpha == 1)))

But not these two:

 plot(1:10, main = substitute(alpha == a, list(a = 2)))
 do.call(plot, list(1:10, main = substitute(alpha == a, list(a = 2
Error in as.graphicsAnnot(main) : object alpha not found

(as a consequence, xyplot(..., main = substitute(alpha)) doesn't
currently work.)

On the other hand, this works:

 foo - function(x) plot(1, main = x)
 foo(substitute(alpha))

I'm not sure how to interpret ?plotmath; it says

 If the 'text' argument to one of the text-drawing functions
 ('text', 'mtext', 'axis', 'legend') in R is an expression, the
 argument is interpreted as a mathematical expression...

and uses substitute() in its examples, but

 is.expression(substitute(alpha == a, list(a = 1)))
[1] FALSE

-Deepayan

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


Re: [Rd] substitute and expression

2007-07-16 Thread Peter Dalgaard
Deepayan Sarkar wrote:
 Hi,

 I'm trying to understand whether the use of substitute() is
 appropriate/documented for plotmath annotation. The following two
 calls give the same results:

   
 plot(1:10, main = expression(alpha == 1))
 do.call(plot, list(1:10, main = expression(alpha == 1)))
 

 But not these two:

   
 plot(1:10, main = substitute(alpha == a, list(a = 2)))
 do.call(plot, list(1:10, main = substitute(alpha == a, list(a = 2
 
 Error in as.graphicsAnnot(main) : object alpha not found

 (as a consequence, xyplot(..., main = substitute(alpha)) doesn't
 currently work.)

 On the other hand, this works:

   
 foo - function(x) plot(1, main = x)
 foo(substitute(alpha))
 

 I'm not sure how to interpret ?plotmath; it says

  If the 'text' argument to one of the text-drawing functions
  ('text', 'mtext', 'axis', 'legend') in R is an expression, the
  argument is interpreted as a mathematical expression...

 and uses substitute() in its examples, but

   
 is.expression(substitute(alpha == a, list(a = 1)))
 
 [1] FALSE
   
I think you need to take plotmath out of the equation and study the 
difference between objects of mode call and those of mode 
expression. Consider this:

  f - function(...)match.call()
  do.call(f, list(1:10, main = substitute(alpha == a, list(a = 2
function(...)match.call()
(1:10, main = alpha == 2)
  do.call(list, list(1:10, main = substitute(alpha == a, list(a = 2
Error in do.call(list, list(1:10, main = substitute(alpha == a, list(a = 
2 :
object alpha not found

The issue is that function ends up with an argument  alpha == 2 which it 
proceeds to evaluate (lazily), where a direct call sees 
substitute(.). It is a general problem with the do.call mechanism 
that it effectively pre-evaluates the argument list, which can confuse 
functions that rely on accessing the original argument expression. Try, 
e.g., do.call(plot, list(airquality$Wind, airquality$Ozone)) and watch 
the axis labels.

Does it work if you use something like

 main = substitute(quote(alpha == a), list(a = 2))?

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


Re: [Rd] substitute and expression

2007-07-16 Thread Gabor Grothendieck
On 7/16/07, Deepayan Sarkar [EMAIL PROTECTED] wrote:
 Hi,

 I'm trying to understand whether the use of substitute() is
 appropriate/documented for plotmath annotation. The following two
 calls give the same results:

  plot(1:10, main = expression(alpha == 1))
  do.call(plot, list(1:10, main = expression(alpha == 1)))

 But not these two:

  plot(1:10, main = substitute(alpha == a, list(a = 2)))
  do.call(plot, list(1:10, main = substitute(alpha == a, list(a = 2
 Error in as.graphicsAnnot(main) : object alpha not found

 (as a consequence, xyplot(..., main = substitute(alpha)) doesn't
 currently work.)

If your question is really about do.call then use the quote = TRUE argument.
Then both of the above work:

plot(1:10, main = substitute(alpha == a, list(a = 2)))
do.call(plot, list(1:10, main = substitute(alpha == a, list(a = 2))),
quote = TRUE)

plot(1:10, main = expression(alpha == 1))
do.call(plot, list(1:10, main = expression(alpha == 1)), quote = TRUE)

Another possibility is just to make sure you are passing an expression so
that the first one would become:

plot(1:10, main = substitute(alpha == a, list(a = 2)))
do.call(plot, list(1:10, main = as.expression(substitute(alpha == a,
list(a = 2)



 On the other hand, this works:

  foo - function(x) plot(1, main = x)
  foo(substitute(alpha))

 I'm not sure how to interpret ?plotmath; it says

 If the 'text' argument to one of the text-drawing functions
 ('text', 'mtext', 'axis', 'legend') in R is an expression, the
 argument is interpreted as a mathematical expression...

 and uses substitute() in its examples, but

  is.expression(substitute(alpha == a, list(a = 1)))
 [1] FALSE


I am not sure what examples you are referring to but if you read the
Value section in ?substitute it does say that substitute typically
returns call objects but may return a name object and in principle
can return others too so they need not be expressions.

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


Re: [Rd] substitute and expression

2007-07-16 Thread Deepayan Sarkar
On 7/16/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
 Deepayan Sarkar wrote:
  Hi,
 
  I'm trying to understand whether the use of substitute() is
  appropriate/documented for plotmath annotation. The following two
  calls give the same results:
 
 
  plot(1:10, main = expression(alpha == 1))
  do.call(plot, list(1:10, main = expression(alpha == 1)))
 
 
  But not these two:
 
 
  plot(1:10, main = substitute(alpha == a, list(a = 2)))
  do.call(plot, list(1:10, main = substitute(alpha == a, list(a = 2
 
  Error in as.graphicsAnnot(main) : object alpha not found
 
  (as a consequence, xyplot(..., main = substitute(alpha)) doesn't
  currently work.)
 
  On the other hand, this works:
 
 
  foo - function(x) plot(1, main = x)
  foo(substitute(alpha))
 
 
  I'm not sure how to interpret ?plotmath; it says
 
   If the 'text' argument to one of the text-drawing functions
   ('text', 'mtext', 'axis', 'legend') in R is an expression, the
   argument is interpreted as a mathematical expression...
 
  and uses substitute() in its examples, but
 
 
  is.expression(substitute(alpha == a, list(a = 1)))
 
  [1] FALSE
 
 I think you need to take plotmath out of the equation and study the
 difference between objects of mode call and those of mode
 expression. Consider this:

   f - function(...)match.call()
   do.call(f, list(1:10, main = substitute(alpha == a, list(a = 2
 function(...)match.call()
 (1:10, main = alpha == 2)
   do.call(list, list(1:10, main = substitute(alpha == a, list(a = 2
 Error in do.call(list, list(1:10, main = substitute(alpha == a, list(a =
 2 :
 object alpha not found

 The issue is that function ends up with an argument  alpha == 2 which it
 proceeds to evaluate (lazily), where a direct call sees
 substitute(.). It is a general problem with the do.call mechanism
 that it effectively pre-evaluates the argument list, which can confuse
 functions that rely on accessing the original argument expression. Try,
 e.g., do.call(plot, list(airquality$Wind, airquality$Ozone)) and watch
 the axis labels.

Right. Lazy evaluation was the piece I was missing.

 Does it work if you use something like

  main = substitute(quote(alpha == a), list(a = 2))?

Not for xyplot, though I haven't figured out why. Turns out this also
doesn't work:

 plot(y ~ x, data = list(x = 1:10, y = 1:10), main = substitute(alpha))
Error in as.graphicsAnnot(main) : object alpha not found

I'll take this to mean that the fact that substitute() works sometimes
(for plotmath) is an undocumented side effect of the implementation
that should not be relied upon.

-Deepayan

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


[Rd] Unable to build with working iconv support on Solaris9/x86

2007-07-16 Thread Lucas Barbuto
Hi all,

Have had a frustrating time trying to get R 2.5.1 running happily on  
Solaris9/x86, the problems seem to stem mainly from libiconv  
support.  After a couple of hours of experimenting, I came across the  
following combination, note that iconv (the program, but not the  
library) exists in the Solaris base system, I've manually installed  
the full GNU distribution in /usr/local/apps/libiconv-1.11 but not  
in /usr/local yet.

CFLAGS=-I/usr/local/apps/libiconv-1.11/include -I/usr/local/include  
LDFLAGS=-L/usr/local/apps/libiconv-1.11/lib -R/usr/local/apps/ 
libiconv-1.11/lib -L/usr/local/lib -R/usr/local/lib ./configure -- 
prefix=/usr/local/apps/r-2.5.1 --with-libiconv-prefix=/usr/local/apps/ 
libiconv-1.11

Note that the option --with-libiconv-prefix=/usr/local/apps/ 
libiconv-1.11 won't get me past the configure phase by itself (fails  
the iconv test), in fact as far as I can tell --with-libiconv-prefix  
has no effect at all but I've been leaving it in just in case.

Anyway, with the environment variables CFLAGS and LDFLAGS set as  
above, the process gets through configure and make successfully, but  
fails 'make check' trying to do a conversion to latin1

  ## x is intended to be in latin1
  x - fa\xE7ile
  Encoding(x)
[1] unknown
  Encoding(x) - latin1
  x
[1]Error: unsupported conversion
Execution halted

ldd -s bin/exec/R confirms that R gets it's iconv from /usr/local/ 
apps/libiconv-1.11/lib/libiconv.so.2 as expected

ldd -s bin/exec/R
[snip]
find object=libiconv.so.2; required by bin/exec/R
 search path=/usr/local/apps/libiconv-1.11/lib:/usr/local/lib:/ 
usr/local/apps/gcc-3.4.5/lib/gcc/i386-pc-solaris2.9/3.4.5  (RPATH  
from file bin/exec/R)
 trying path=/usr/local/apps/libiconv-1.11/lib/libiconv.so.2
 libiconv.so.2 = /usr/local/apps/libiconv-1.11/lib/ 
libiconv.so.2
[snip]

I don't know what else to try.  Anyone?

Regards,

--
Lucas Barbuto  E: [EMAIL PROTECTED]
System AdministratorT: +613 8344 1270
Department of CSSE
The University of Melbourne   http://www.csse.unimelb.edu.au/

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


Re: [Rd] S4 coerce

2007-07-16 Thread Seth Falcon
Paul Gilbert [EMAIL PROTECTED] writes:

 (I am not sure if this is a bug or a request for a more understandable 
 warning, or possible something obvious I should be posting on r-help.)

 I am trying to coerce an new class object to be a DBIConnection and it 
 does not work the way I think it should:

 R version 2.5.1 (2007-06-27) ...
   require(RMySQL) # or require(RSQLite)
 Loading required package: RMySQL
 Loading required package: DBI
 [1] TRUE
   m - dbDriver(MySQL)  # or  m - dbDriver(SQLite)
   con - dbConnect(m, dbname=test)
   dbGetQuery(con, create table zzz (
 +vintage VARCHAR(20) NOT NULL,
 +alias   VARCHAR(20) default NULL,
 +Documentation TEXT,
 +PRIMARY KEY (vintage)
 +);)
 NULL
   dbListTables(con)
   [1] zzz
   setClass(TSconnection, representation(con=DBIConnection,
 +vintage = logical,
 +panel   = logical)
 +)
 [1] TSconnection
   setAs(TSconnection, DBIConnection, def = function(from) [EMAIL 
 PROTECTED])

I think things work as you expect up until this pint.

   setIs(TSconnection, DBIConnection, coerce = function(x)
   [EMAIL PROTECTED])

I'm confused about what you want to do here.  If you want TSconnection
to be a DBIConnection, why wouldn't you use inheritance?

   setClass(TSconnection, contains=DBIConnection, ...)

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

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