Re: [Rd] row.names != rownames for data.frame?

2006-05-02 Thread Prof Brian Ripley
On Mon, 1 May 2006, Seth Falcon wrote:

> With a recent R 2.4 I notice the following:
>
> df <- data.frame(x=1:2)
>> row.names(df)
> [1] "1" "2"
>> rownames(df)
> [1] 1 2
>
> This seems related to recent changes in the internal storage format of
> the row names data for data frames.
>
> The man page for rownames says:
>
> For a data frame, 'rownames' and 'colnames' are equivalent to
> 'row.names' and 'names' respectively.
>
> A number of Bioconductor packages seem to be relying on this.

Interesting: nothing on CRAN did.  Those are `equivalent' but not 
identical, but let's make them identical again.


-- 
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] optimize() and extrema at the interval bounds

2006-05-02 Thread Peter Ruckdeschel
Dear r-devels,

by construction, optimize() only evaluates the objective function
*inside* the bounds of argument 'interval'.

It does not seem to be an 'extremely' rare case that extrema are attained
*at* the bounds of argument 'interval' :-)

It is fairly easy to write a wrapper to optimize()
enforcing an evaluation of the objective function at these
bounds, too, but wouldn't it be a good idea to a add an
extra argument 'evalbounds' of optimize() defaulting to FALSE
(behavior of optimize() as it is now), but which if TRUE
does evaluate the objective at the bounds?

I do not know how costly two extra evaluations are in general
as to computation time at evaluation of optimize(), nor
how many conflicts of unmatched arguments an extra argument
to optimize() would cause; so consider this just as a proposal.

Thank you for your attention,
Peter

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


[Rd] Call trellis function in a function (PR#8827)

2006-05-02 Thread xiao . gang . fan1
Full_Name: Fan
Version: 2.2.1
OS: Windows
Submission from: (NULL) (159.50.101.9)


Hello,

When I call trellis function (such as histogram, densityplot, etc.) in a
function,
the call seems being ignored (no graphics is drawing) if some other instructions

are placed afeter that call. 

Here's an example:

y = rnorm(100*3)
b = sample(1:3,300,replace=T)

f = function()
{
  densityplot(~y|b)
}

f1 = function()
{
  densityplot(~y|b)
  return(1)
}

f1()  # this will not draw the histogram
f()   # this will draw the histogram

Thanks in advance
Kind regards
--
Fan

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


Re: [Rd] Call trellis function in a function (PR#8827)

2006-05-02 Thread Roger Bivand
On Tue, 2 May 2006 [EMAIL PROTECTED] wrote:

This is a FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

> Full_Name: Fan
> Version: 2.2.1
> OS: Windows
> Submission from: (NULL) (159.50.101.9)
> 
> 
> Hello,
> 
> When I call trellis function (such as histogram, densityplot, etc.) in a
> function,
> the call seems being ignored (no graphics is drawing) if some other 
> instructions
> 
> are placed afeter that call. 
> 
> Here's an example:
> 
> y = rnorm(100*3)
> b = sample(1:3,300,replace=T)
> 
> f = function()
> {
>   densityplot(~y|b)
> }
> 
> f1 = function()
> {
>   densityplot(~y|b)
>   return(1)
> }
> 
> f1()  # this will not draw the histogram
> f()   # this will draw the histogram
> 
> Thanks in advance
> Kind regards
> --
> Fan
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


[Rd] Force action in package install?

2006-05-02 Thread Duncan Murdoch
I'd like to substitute the Subversion revision number for a string in a 
package man page every time the package is installed or built.  I can 
assume it is being installed or built from a Subversion working copy.

I tried putting a target that depends on FORCE into Makefile or Makevars 
in the src directory, but it is not being built.  What sort of make 
magic do I need, and where do I put it in order to get R CMD INSTALL to 
run my code?

Duncan Murdoch

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


[Rd] normal random number generator in R

2006-05-02 Thread Tibshirani
Hi,

I am trying to figure out how normal random number generator works in R. As I 
look at .../src/nmath/snorm.c file, I find the default algorithm is inverse 
CDF method. In more detail, instead of directly using uniform value by 
unif_rand(), snorm function will first get a sum by adding unif_rand() and 
2^27*unif_rand(), then divide it by 2^27 and transfer it to qnorm5() function 
for inverting. Only a short comment for this operation is available in the 
source:
/* unif_rand() alone is not of high enough precision */

Just curious why this operation is needed? Is it a general algorithm for 
inverse CDF method, or simply unif_rand() in R returns float precision?

Thanks
Tib

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


[Rd] Installation problem of R.app GUI 1.15 for R 2.3.0 (PR#8828)

2006-05-02 Thread dupan
Full_Name: Pan Du
Version: 2.3.0
OS: Mac OS X 10.4.6
Submission from: (NULL) (165.124.152.227)


Hi,

I just downloaded the latest R2.3.0 for Mac. When I tried to install R.app GUI
1.15, it told me "You cannot install R GUI for Mac OS X on this volume. Requires
Mac OS X 10.4.4 or higher." But actually I am using Mac OS X 10.4.6, which is
higher than 10.4.4. Is there anyone knows what the problem is? BTW, all other
packages were installed smoothly. Thanks a lot!

Best,

Pan

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


Re: [Rd] normal random number generator in R

2006-05-02 Thread Prof Brian Ripley
On Tue, 2 May 2006, Tibshirani wrote:

> Hi,
>
> I am trying to figure out how normal random number generator works in R. As I
> look at .../src/nmath/snorm.c file, I find the default algorithm is inverse
> CDF method. In more detail, instead of directly using uniform value by
> unif_rand(), snorm function will first get a sum by adding unif_rand() and
> 2^27*unif_rand(), then divide it by 2^27 and transfer it to qnorm5() function
> for inverting. Only a short comment for this operation is available in the
> source:
> /* unif_rand() alone is not of high enough precision */
>
> Just curious why this operation is needed? Is it a general algorithm for
> inverse CDF method, or simply unif_rand() in R returns float precision?

unif_rand() returns a uniform over about 2^31 distinct doubles, and that 
gives granularity in the far tails of a normal.

It is a known (at least to me) trick for improving the accuracy of 
inversion.

-- 
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] Histogram to pdf file (PR#8829)

2006-05-02 Thread ksawery . pasciak
Full_Name: Ksawery
Version: 2.30
OS: WinXp
Submission from: (NULL) (195.150.76.2)


The bug apears when I'm trying to save, for example histogram into PDF file.I'm
using Polish language, and while in R letters are correct, in PDF file I have
some strange one...

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


Re: [Rd] Installation problem of R.app GUI 1.15 for R 2.3.0 (PR#8828)

2006-05-02 Thread Simon Urbanek
Pan,

On May 2, 2006, at 12:34 PM, [EMAIL PROTECTED] wrote:

> I just downloaded the latest R2.3.0 for Mac. When I tried to  
> install R.app GUI 1.15, it told me "You cannot install R GUI for  
> Mac OS X on this volume. Requires Mac OS X 10.4.4 or higher." But  
> actually I am using Mac OS X 10.4.6, which is higher than 10.4.4.  
> Is there anyone knows what the problem is? BTW, all other packages  
> were installed smoothly. Thanks a lot!
>

Indeed there is a bug in that PackageMaker that causes the individual  
installer for Packages/R-GUI.pkg to fail (SpecType should be plist  
not bundle). Please use the regular R package instead (R.mpkg) - that  
should work.

FWIW: If R.app is all you want, you may in fact just get it from the  
nightly page ( http://R.research.att.com ), because as it appears it  
has an important bug fix:
http://R.research.att.com/R-GUI-3114-2.3-Deployment.dmg

Cheers,
Simon

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


Re: [Rd] Force action in package install?

2006-05-02 Thread Simon Urbanek

On May 2, 2006, at 12:09 PM, Duncan Murdoch wrote:

> I tried putting a target that depends on FORCE into Makefile or  
> Makevars in the src directory, but it is not being built.  What  
> sort of make magic do I need, and where do I put it in order to get  
> R CMD INSTALL to run my code?
>

I don't think that's supported at all. I have successfully used this  
VeryUglyHack(TM) in the package's Makevars:

OBJECTS=dummy.o real1.o real2.o

dummy.o: myExtraTarget
echo "" > dummy.c
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c dummy.c -o $@

where real1.o and real2.o are real object files that have  
corresponding sources and dummy.c is a non-existent file thus forcing  
make to use my extra target. This hack exploits the fact that SHLIB  
will let Makevars override the objects list (the above is not the  
exact application I use, but the essence of the idea).

I agree that it would be great to add something like $(EXTRA_TARGETS)  
to SHLIB such that Makevars can define extra targets.

Back to your original problem, though, I never build packages  
directly from development sources (didn't we have a discussion about  
this recently?) for the reasons discussed - IMHO it's much better to  
have a script build the package tar ball, stamping files as necessary.

Cheers,
Simon

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


Re: [Rd] Force action in package install?

2006-05-02 Thread Simon Urbanek

On May 2, 2006, at 4:25 PM, Simon Urbanek wrote:

>
> On May 2, 2006, at 12:09 PM, Duncan Murdoch wrote:
>
>> I tried putting a target that depends on FORCE into Makefile or  
>> Makevars in the src directory, but it is not being built.  What  
>> sort of make magic do I need, and where do I put it in order to  
>> get R CMD INSTALL to run my code?
>>
>
> I don't think that's supported at all. I have successfully used  
> this VeryUglyHack(TM) in the package's Makevars:
>

Oops - I just realized that it's a huge overkill for what you  
described (the application actually did matter - it involved  
generated c files). The generated files force make to re-make the  
target unconditionally when using phony target, but that's another  
story. Sorry for the noise - feel free to delete it :).

Cheers,
Simon

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


[Rd] cannot use fanny in package cluster (PR#8830)

2006-05-02 Thread ghuang
Full_Name: Guan-Hua Huang
Version: 2.0.1
OS: Linux
Submission from: (NULL) (140.113.114.123)


I install the package cluster by using install.packages("cluster"). After
install it, it runs fine for function clara, but it does not work for function
fanny. I did the following things:

library(cluster)
set.seed(21)
x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)),
   cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)),
   cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5)))
.proctime00 <- proc.time()
(fannyx <- fanny(x, 2))

and got the following messages:

Error in .Fortran("fanny", as.integer(n), as.integer(jp), k, x2, dis = dv, ;
Fortran function name not in DLL for package cluster

Any help.

Guan-Hua

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


Re: [Rd] cannot use fanny in package cluster (PR#8830)

2006-05-02 Thread ligges
[EMAIL PROTECTED] wrote:

> Full_Name: Guan-Hua Huang
> Version: 2.0.1
> OS: Linux
> Submission from: (NULL) (140.113.114.123)
> 
> 
> I install the package cluster by using install.packages("cluster"). After
> install it, it runs fine for function clara, but it does not work for function
> fanny. I did the following things:
> 
> library(cluster)
> set.seed(21)
> x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)),
>cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)),
>cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5)))
> .proctime00 <- proc.time()
> (fannyx <- fanny(x, 2))
> 
> and got the following messages:
> 
> Error in .Fortran("fanny", as.integer(n), as.integer(jp), k, x2, dis = dv, ;
> Fortran function name not in DLL for package cluster
> 
> Any help.
> 
> Guan-Hua
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


If this is a bug, then with your installation of the package, but NOT 
with R nor with the package.

Please read the FAQs what a bug is and how to report it (check with a 
***recent*** version of R first!).

Uwe Ligges

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


Re: [Rd] Histogram to pdf file (PR#8829)

2006-05-02 Thread ligges
[EMAIL PROTECTED] wrote:

> Full_Name: Ksawery
> Version: 2.30

Currently we have R-2.3.0. 2.30 will be released in October 2019, if R 
core does not manage to get R-3.0.0 out some day before.


> OS: WinXp
> Submission from: (NULL) (195.150.76.2)
> 
> 
> The bug apears when I'm trying to save, for example histogram into PDF 
> file.I'm
> using Polish language, and while in R letters are correct, in PDF file I have
> some strange one...


Which bug?
Please read the FAQs what a bug is and how to report it.

I'd highly recommend to *ask* a question on R-help how to solve your 
problem rather than claiming there is a bug without giving a 
reproducible example that helps to fix it.

Uwe Ligges



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