Re: [Rd] Open .ssc .S ... files in R (PR#8690)

2006-03-20 Thread Paul Roebuck
On Fri, 17 Mar 2006 Simon Urbanek wrote:

> On Mar 17, 2006, at 2:45 PM, Duncan Murdoch wrote:
>
> > On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote:
> >> - Quick summary:
> >>
> >> In the File:Open dialog, please change
> >> "S files (*.q)"
> >> to
> >> "S files (*.q, *.ssc, *.S)"
> >> and show the corresponding files (including .SSC and .s files).
> >
> > I'll make this change in the Windows Rgui.
> > Is this an issue in the Mac gui too?
>
> Yes, I was not aware of .ssc, either. Will fix that.

The Info.plist modifications I sent Simon a while back
included both dot-ssc and dot-s for S-plus files.

Might want to keep in mind that dot-s (and dot-S) is the
file extension for assembly source and on case-insensitive
file systems, like Windows and Mac OS X (HFS+ using default
settings), that could cause confusion if assembly source
files are present.

See also gcc(1).

--
SIGSIG -- signature too long (core dumped)

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


Re: [Rd] Open .ssc .S ... files in R (PR#8690)

2006-03-20 Thread Duncan Murdoch
On 3/20/2006 3:01 AM, Paul Roebuck wrote:
> On Fri, 17 Mar 2006 Simon Urbanek wrote:
> 
>> On Mar 17, 2006, at 2:45 PM, Duncan Murdoch wrote:
>>
>> > On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote:
>> >> - Quick summary:
>> >>
>> >> In the File:Open dialog, please change
>> >> "S files (*.q)"
>> >> to
>> >> "S files (*.q, *.ssc, *.S)"
>> >> and show the corresponding files (including .SSC and .s files).
>> >
>> > I'll make this change in the Windows Rgui.
>> > Is this an issue in the Mac gui too?
>>
>> Yes, I was not aware of .ssc, either. Will fix that.
> 
> The Info.plist modifications I sent Simon a while back
> included both dot-ssc and dot-s for S-plus files.
> 
> Might want to keep in mind that dot-s (and dot-S) is the
> file extension for assembly source and on case-insensitive
> file systems, like Windows and Mac OS X (HFS+ using default
> settings), that could cause confusion if assembly source
> files are present.
> 
> See also gcc(1).

On Windows outside of gcc, assembly source is normally named *.asm.  R 
only uses one assembly source file named *.S so I think it's fairly 
unlikely that this will cause confusion.  I don't know if it's more 
common on OS X.

On the other hand, *.s or *.S are reasonably common names for S source 
files in packages, so I think this is a useful change, at least in Windows.

Duncan Murdoch

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


[Rd] format.default loses matrix structure (PR#8695)

2006-03-20 Thread jhallman
Full_Name: Jeff Hallman
Version: 2.2.0
OS: Linux
Submission from: (NULL) (132.200.32.34)


format.default() loses matrix structure if big.mark is given

> format(matrix(1:16, 4))
 [,1] [,2] [,3] [,4]
[1,] " 1" " 5" " 9" "13"
[2,] " 2" " 6" "10" "14"
[3,] " 3" " 7" "11" "15"
[4,] " 4" " 8" "12" "16"
> format(matrix(1:16, 4), big.mark = ",")
 [1] " 1" " 2" " 3" " 4" " 5" " 6" " 7" " 8" " 9" "10" "11" "12" "13" "14" "15"
[16] "16"

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


[Rd] levels for list and data.frame

2006-03-20 Thread Gregor Gorjanc
Hello!

Does R core find the following pacth usefull - I created methods for
levels for list and data.frame, which can be usefull to get a list of
levels for entries in a list or columns in a data.frame. Patch is
attached and shown bellow example

# Example
> tmp <- list()
> tmp$a <- factor(letters[1:10])
> tmp$b <- factor(letters[5:14])
> tmp$c <- 1:10
> tmp1 <- as.data.frame(tmp)
> tmp2 <- list()
> tmp2$"1" <- tmp
> tmp2$"2" <- tmp1
> str(tmp2)
List of 2
 $ 1:List of 3
  ..$ a: Factor w/ 10 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10
  ..$ b: Factor w/ 10 levels "e","f","g","h",..: 1 2 3 4 5 6 7 8 9 10
  ..$ c: int [1:10] 1 2 3 4 5 6 7 8 9 10
 $ 2:`data.frame':  10 obs. of  3 variables:
  ..$ a: Factor w/ 10 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10
  ..$ b: Factor w/ 10 levels "e","f","g","h",..: 1 2 3 4 5 6 7 8 9 10
  ..$ c: int [1:10] 1 2 3 4 5 6 7 8 9 10

> levels(tmp2)
$"1"
$"1"$a
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

$"1"$b
 [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"


$"2"
$"2"$a
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

$"2"$b
 [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"

> levels(tmp2, drop = FALSE)
$"1"
$"1"$a
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

$"1"$b
 [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"

$"1"$c
NULL


$"2"
$"2"$a
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

$"2"$b
 [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"

$"2"$c
NULL

--

$ svn diff factor.R
Index: factor.R
===
--- factor.R(revision 37559)
+++ factor.R(working copy)
@@ -25,7 +25,25 @@
 ## Help old S users:
 category <- function(...) .Defunct()

-levels <- function(x) attr(x, "levels")
+levels <- function(x, ...) UseMethod("levels")
+
+levels.default <- function(x, ...) attr(x, "levels")
+
+levels.list <- function(x, drop = TRUE)
+{
+tmp <- lapply(x, levels, drop = drop)
+if (drop) {
+tmp1 <- unlist(lapply(tmp, is.null))
+tmp <- tmp[!tmp1]
+}
+return(tmp)
+}
+
+levels.data.frame <- function(x, ...)
+{
+return(levels.list(x, ...))
+}
+
 nlevels <- function(x) length(levels(x))

 "levels<-" <- function(x, value) UseMethod("levels<-")

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc  bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.
--


factor.R.diff.gz
Description: GNU Zip compressed data
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R-2.2.0 format.default() loses matrix structure (PR#8696)

2006-03-20 Thread Jeffrey . J . Hallman

If argument big.mark is supplied.  Like so:

> version _
platform i686-redhat-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor2.0
year 2005
month10
day  06
svn rev  35749
language R
> mat <- matrix(1:6, 3)
> mat
 [,1] [,2]
[1,]14
[2,]25
[3,]36
> format(mat)
 [,1] [,2]
[1,] "1"  "4"
[2,] "2"  "5"
[3,] "3"  "6"
> format(mat, big.mark = ",")
[1] "1" "2" "3" "4" "5" "6"
>

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


Re: [Rd] R make install and demo(graphics) issue

2006-03-20 Thread Matthew Beason
Simon,

Thanks! That resolved the "make install" issue. However, after
installation when running "demo(graphics)" or "png()" from within R, I
get the following error:

  > demo(graphics)


demo(graphics)
 

Type to start :

> require(graphics)
[1] TRUE

> require(datasets)
[1] TRUE

> if (dev.cur() <= 1) get(getOption("device"))()
Error in get(getOption("device"))() : X11 module cannot be loaded
In addition: Warning message:
unable to load shared library '/usr/local/R/lib/R/modules/R_X11.so':
  Could not load module /usr/local/R/lib/R/modules/R_X11.so.
Dependent module /usr/java14/jre/bin/libjpeg.a(libjpeg.so.62)
could not be loaded.
File /usr/java14/jre/bin/libjpeg.a is not an
  archive or the file could not be read properly.
System error: Exec format error
System error: Exec format error
Could not load module /usr/java14/jre/bin/libjpeg.a.
Dependent module /usr/java14/jre/bin/libjpeg.a could not be
loaded.

> png()
Error in png() : X11 module cannot be loaded
In addition: Warning message:
unable to load shared library '/usr/local/R/lib/R/modules/R_X11.so':
  Could not load module /usr/local/R/lib/R/modules/R_X11.so.
Dependent module /usr/java14/jre/bin/libjpeg.a(libjpeg.so.62)
could not be loaded.
File /usr/java14/jre/bin/libjpeg.a is not an
  archive or the file could not be read properly.
System error: Exec format error
System error: Exec format error
Could not load module /usr/java14/jre/bin/libjpeg.a.
Dependent module /usr/java14/jre/bin/libjpeg.a could not be
loaded.

I've checked and "/usr/java14/jre/bin/libjpeg.a" does exist.
ls -l /usr/java14/jre/bin/libjpeg.a
-r--r--r--   1 bin  bin  289503 Jan 19 2005
/usr/java14/jre/bin/libjpeg.a
file /usr/java14/jre/bin/libjpeg.a
/usr/java14/jre/bin/libjpeg.a: executable (RISC System/6000) or object
module not stripped

Any thoughts or suggestions would be greatly appreciated!

Matthew Beason

-Original Message-
From: Simon Urbanek [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 17, 2006 4:52 PM
To: Matthew Beason
Cc: r-devel@r-project.org
Subject: Re: [Rd] R make install and demo(graphics) issue


On 17.3.2006, at 19:08, Matthew Beason wrote:

> I've successfully gotten R 2.2.1 to compile on AIX 5.2.
>
> However, when I run "make install", I receive the following message:
>
> /appl/perform/workspace/R-2.2.1
> [EMAIL PROTECTED]/appl/perform/workspace/R-2.2.1] make install
> /appl/perform/workspace/R-2.2.1/m4
> Target "install" is up to date.
> /appl/perform/workspace/R-2.2.1/tools
> Target "install" is up to date.
> /appl/perform/workspace/R-2.2.1/doc
> installing doc ...
> ../tools/install-sh: no destination specified.
> make: The error code from the last command is 1.
>

Chances are that this is related to an issue with some shells mentioned
here before - you can either use R-2.2.1 patched from SVN where it is
fixed, or alternatively edit configure at line 1913:
if test -z ${rdocdir}; then
into
if test -z "${rdocdir}"; then
and make the same modification to the subsequent two if statements as
well.

Cheers,
Simon

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


Re: [Rd] levels for list and data.frame

2006-03-20 Thread Gregor Gorjanc
oops, this does not pass R CMD check. I will have to read manuals a bit
more.

...
* checking S3 generic/method consistency ... WARNING
levels:
  function(x, ...)
levels.list:
  function(x, drop)

levels:
  function(x, ...)
levels.data.frame:
  function(x, drop)
...

Anyway, I would like to ask what is the "opinion" about writing methods
for classes as list and data.frame. Methods for this might not be as
simple as for numeric, character, factor and it would be nice that there
would be some guidelines for at least:
- what should be the "general" output i.e. list or something else - I
understand that it is hard to say in advance, but a common policy might
not hurt
- what to do if a method for a list or data.frame can not be applied to
each entry/column


> Hello!
> 
> Does R core find the following pacth usefull - I created methods for
> levels for list and data.frame, which can be usefull to get a list of
> levels for entries in a list or columns in a data.frame. Patch is
> attached and shown bellow example
> 
> # Example
>> tmp <- list()
>> tmp$a <- factor(letters[1:10])
>> tmp$b <- factor(letters[5:14])
>> tmp$c <- 1:10
>> tmp1 <- as.data.frame(tmp)
>> tmp2 <- list()
>> tmp2$"1" <- tmp
>> tmp2$"2" <- tmp1
>> str(tmp2)
> List of 2
>  $ 1:List of 3
>   ..$ a: Factor w/ 10 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10
>   ..$ b: Factor w/ 10 levels "e","f","g","h",..: 1 2 3 4 5 6 7 8 9 10
>   ..$ c: int [1:10] 1 2 3 4 5 6 7 8 9 10
>  $ 2:`data.frame':  10 obs. of  3 variables:
>   ..$ a: Factor w/ 10 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10
>   ..$ b: Factor w/ 10 levels "e","f","g","h",..: 1 2 3 4 5 6 7 8 9 10
>   ..$ c: int [1:10] 1 2 3 4 5 6 7 8 9 10
> 
>> levels(tmp2)
> $"1"
> $"1"$a
>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
> 
> $"1"$b
>  [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
> 
> 
> $"2"
> $"2"$a
>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
> 
> $"2"$b
>  [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
> 
>> levels(tmp2, drop = FALSE)
> $"1"
> $"1"$a
>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
> 
> $"1"$b
>  [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
> 
> $"1"$c
> NULL
> 
> 
> $"2"
> $"2"$a
>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
> 
> $"2"$b
>  [1] "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
> 
> $"2"$c
> NULL
> 
> --
> 
> $ svn diff factor.R
> Index: factor.R
> ===
> --- factor.R(revision 37559)
> +++ factor.R(working copy)
> @@ -25,7 +25,25 @@
>  ## Help old S users:
>  category <- function(...) .Defunct()
> 
> -levels <- function(x) attr(x, "levels")
> +levels <- function(x, ...) UseMethod("levels")
> +
> +levels.default <- function(x, ...) attr(x, "levels")
> +
> +levels.list <- function(x, drop = TRUE)
> +{
> +tmp <- lapply(x, levels, drop = drop)
> +if (drop) {
> +tmp1 <- unlist(lapply(tmp, is.null))
> +tmp <- tmp[!tmp1]
> +}
> +return(tmp)
> +}
> +
> +levels.data.frame <- function(x, ...)
> +{
> +return(levels.list(x, ...))
> +}
> +
>  nlevels <- function(x) length(levels(x))
> 
>  "levels<-" <- function(x, value) UseMethod("levels<-")
> 

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc  bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

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