[Rd] Form of \item{arg_i}{Description of arg_i.} in \arguments

2005-05-16 Thread Gorjanc Gregor
Hello!

This really isn't so important, but it comes often in my mind, when
I write documentation for functions. Writing R Extensions manual says
that one should describe each element of the argument list (which is
afcourse OK) in a form:

\item{arg_i}{Description of arg_i.}

When I started with R it really helped me that some "man pages" used

\item{arg_i}{Mode. Description of arg_i.}

e.g. 

\item{argument1}{Logical. Bla bla bla.}
\item{argument2}{Integer. Bla bla bla.}
\item{argument2}{Character. Bla bla bla.}

Although one can most of the time deduce from the man page what mode 
should each argument be, I belive that it would enhance redeability 
if mode specification would be mandatory. I would also like to see 
that there is some sort of mandatory form i.e.

\item{argument2}{Character. Bla bla bla.}
 ^a   ^b^c ^d

a - lower or upper case
b - dot or colon or semicolon
c - lower or upper case
d - dot?

I understand that taking this as mandatory or proposed form, would 
probably make a lot of man pages "invalid", but it would enhance 
redeability on longer term.

Comments, thoughts, ...?

Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana
Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3   tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europe
--
"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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Building R for windows tools link

2005-05-11 Thread Gorjanc Gregor
Hello!

I think that link to page of Duncan Murdoch (bellow) should be given

http://www.murdoch-sutherland.com/Rtools/

at 

http://developer.r-project.org/. 

It's easy to launch Google and find mentioned page, but it took me quite 
some time to do this, because I was sure, that it is noted somewhere on 
{www,CRAN}.r-project.org. Maybe I didn't read carefully ...

Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana
Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3   tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europe
--
"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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Re: F90

2005-04-03 Thread Gorjanc Gregor
Hello!

I posted this question already a week ago, but didn't get any response. I 
will try again if anybody, who can answer this, wasn't reading mails
during easter holidays.

Has anyone successfully compiled F90 sources in R-package? I found the
same question on r-devel list from 2002 and I wonder if there is any
progress. I heard that g95 and gfortran can be usable. 

Thanks in advance!

--
Lep pozdrav / With regards,
Gregor Gorjanc


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] F90

2005-03-26 Thread Gorjanc Gregor
Hello!

Has anyone successfully compiled F90 sources in R-package? I found the
same question on r-devel list from 2002 and I wonder if there is any
progress. I heard that g95 and gfortran can be usable. 

And one more thing. I have a program written in F90 and lets suppose that
compiler is not a problem. I've read manual 'Writing R Extensions' and
successfully loaded one F77 subroutine in R for test and I had no problem. 
However, what is the strategy if one has a whole program i.e. main program 
+ subroutines and wants to call it from R?

Thanks in advance!

--
Lep pozdrav / With regards,
Gregor Gorjanc


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] Package Installation on networked disk (was: Package Installation in RGui (PR#7262))

2005-03-15 Thread Gorjanc Gregor
Hi again!

I would just like to add that this surely must be a problem with network
disks. As I reported yesterady in, 

https://stat.ethz.ch/pipermail/r-devel/2005-March/032431.html

I have problems with installing packages on network drive (where I have R 
installed), marked N:

> install.packages("gap")
trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
Content type `text/plain; charset=iso-8859-1' length 26936 bytes
opened URL
downloaded 26Kb

trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/gap_0.8-3.zip'
Content type `application/zip' length 437644 bytes
opened URL
downloaded 427Kb

package 'gap' successfully unpacked and MD5 sums checked

Delete downloaded files (y/N)? y

updating HTML package descriptions
Warning message: 
unable to move temp installation 
'N:/Ovce/Programi/R/rw2001/library\file4821/gap' to 
'N:/Ovce/Programi/R/rw2001/library/gap' 
> library("gap")
Error in library("gap") : There is no package called 'gap'

But if I try to install package on local disk, marked C:

> install.packages("gap", lib="C:/Programs/R/library")
> install.packages("gap", lib="C:/Programs/R/library")
trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
Content type `text/plain; charset=iso-8859-1' length 26936 bytes
opened URL
downloaded 26Kb

trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/gap_0.8-3.zip'
Content type `application/zip' length 437644 bytes
opened URL
downloaded 427Kb

package 'gap' successfully unpacked and MD5 sums checked

Delete downloaded files (y/N)? y

updating HTML package descriptions
> library("gap")
Error in library("gap") : There is no package called 'gap'
> library("gap", lib.loc="C:/Programs/R/library")
> ?hwe.hardy

I also reported yesterday that this is not 100% reproducible. I tried 
to install today bundle 'gregmisc' and the installation failed only partly,
due to failure of moving temporary installation directory for 'gplots', while
others packages passed OK. Strange. Look below:

> install.packages("gregmisc")
trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
Content type `text/plain; charset=iso-8859-1' length 26936 bytes
opened URL
downloaded 26Kb

trying URL 
`http://cran.r-project.org/bin/windows/contrib/2.0/gregmisc_2.0.3.zip'
Content type `application/zip' length 821874 bytes
opened URL
downloaded 802Kb

bundle 'gregmisc' successfully unpacked and MD5 sums checked

Delete downloaded files (y/N)? y

updating HTML package descriptions
Warning message: 
unable to move temp installation 
'N:/Ovce/Programi/R/rw2001/library\file1347/gplots' to 
'N:/Ovce/Programi/R/rw2001/library/gplots' 
> library("gdata")
Loading required package: gtools 
> library("gplots")
Error in library("gplots") : There is no package called 'gplots'

Can someone try this with local and networked installation of package to 
confirm 
my thoughts.

Local system:
Windows XP SP1
R 2.0.1
Administrator rights

Network system (host of disk):
Sorry I don't have this information.

--
Lep pozdrav / With regards,
Gregor GORJANC


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


FW: [Rd] Package Installation in RGui (PR#7262)

2005-03-14 Thread Gorjanc Gregor
I didn't load the package. I wasn't able to do that, since I wasn't
successfull to install it in first place with install.packages.

-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED]
Sent: pon 2005-03-14 15:34
To: Gorjanc Gregor
Cc: r-devel@stat.math.ethz.ch
Subject: Re: [Rd] Package Installation in RGui (PR#7262)
 
Under Windows, you cannot update / install  a package, if the package 
has been loaded, because Windows locks the dll. This is a FAQ.

Uwe Ligges



Gorjanc Gregor wrote:

> Hello!
> 
> I have just encountered the same situation as Heather and also Paul Gilbert at
> 
> http://tolstoy.newcastle.edu.au/R/devel/05/02/2095.html
> 
> I went into install.packages() in current release as well as in R-devel and
> there is really no problem with \ or /. However, I also had the same warning
> 
> 
>>install.packages("RODBC")
> 
> [... snip ...]
> Delete downloaded files (y/N)? y
> 
> updating HTML package descriptions
> Warning message: 
> unable to move temp installation 
> 'N:/Ovce/Programi/R/rw2001/library\file27583/RODBC' to 
> 'N:/Ovce/Programi/R/rw2001/library/RODBC' 
> 
> The warning is issued from this part of install.packages()
> 
> if (ret == 0) {
> ## Move the new package to the install lib and
> ## remove our temp dir
> ret <- file.rename(file.path(tmpDir, curPkg), instPath)
> if(!ret) warning("unable to move temp installation ",
>  sQuote(file.path(tmpDir, curPkg)),
>  " to ",
>  sQuote(instPath), call. = FALSE)
> } else {
> ## !! Can't revert to old 'zip.unpack' as it would
> ## !! potentially leave cruft from a bundle in there
> stop("Can not remove prior installation of package ",
>  sQuote(curPkg), call. = FALSE)
> }
> 
> "Problem" lies in 
> 
> ret <- file.rename(file.path(tmpDir, curPkg), instPath)
> 
> I went through the whole function "by hand" and at first the above line
> didn't moved tmpDir to instPath. I tried several times and after a while
> it was successfull. It is strange that it happens only with some packages
> i.e. in my case with RODBC and car. I also noted that line above takes 
> quite a lot of time to "accomplish" its work. It actually causes R to 
> freeze for a moment. If I launched
> 
> file.rename(file.path(tmpDir, curPkg), instPath)
> 
> move was done in a moment. I know, that this comment is not the answer 
> to the problem. However, someone might come with that.
> 
> One more thing. I have R installed on networked disk. I assume that Heather 
> does also, since disk letter is H. On the other hand, Paul reported problems
> with C disk.
> 
> Windows XP SP1
> R 2.0.1
> 
> On Tue, 5 Oct 2004 [EMAIL PROTECTED] wrote:
> 
>>Full_Name: Heather Turner
>>Version: 2.0.0
>>OS: Windows NT
>>Submission from: (NULL) (137.205.8.2)
>>
>>
>>I tried using the Packages menu to install the gam package and get the 
>>following
>>output:
>>
>>
>>>local({a <- CRAN.packages()
>>
>>+ install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a,
>>dependencies=TRUE)})
>>trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
>>Content type `text/plain; charset=iso-8859-1' length 21246 bytes
>>opened URL
>>downloaded 20Kb
>>
>>trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/gam_0.92.zip'
>>Content type `application/zip' length 224167 bytes
>>opened URL
>>downloaded 218Kb
>>
>>package 'gam' successfully unpacked and MD5 sums checked
>>
>>Delete downloaded files (y/N)? y
>>
>>Warning message:
>>unable to move temp installation 'H:/rw2000/library\file15762/gam' to
>>'H:/rw2000/library/gam'
>>
>>I get the same message if I opt to delete the downloaded files and the
>>same problem if I try to install from a downloaded .zip file instead -
>>not really surprising as seems to "unpack" file okay, but loses the
>>temporary file. As the syntax of the file path for the temporary file is
>>incorrect, I'm assuming this is a bug in install.packages or one of the
>>functions it calls...
> 
> 
> Since you _incorrectly_ assume that the syntax is incorrect, the rest of
> your assumption is incorrect. As the FAQ asks, please don't speculate
> about things you are n

Re: [Rd] Package Installation in RGui (PR#7262)

2005-03-14 Thread Gorjanc Gregor
Hello!

I have just encountered the same situation as Heather and also Paul Gilbert at

http://tolstoy.newcastle.edu.au/R/devel/05/02/2095.html

I went into install.packages() in current release as well as in R-devel and
there is really no problem with \ or /. However, I also had the same warning

> install.packages("RODBC")
[... snip ...]
Delete downloaded files (y/N)? y

updating HTML package descriptions
Warning message: 
unable to move temp installation 
'N:/Ovce/Programi/R/rw2001/library\file27583/RODBC' to 
'N:/Ovce/Programi/R/rw2001/library/RODBC' 

The warning is issued from this part of install.packages()

if (ret == 0) {
## Move the new package to the install lib and
## remove our temp dir
ret <- file.rename(file.path(tmpDir, curPkg), instPath)
if(!ret) warning("unable to move temp installation ",
 sQuote(file.path(tmpDir, curPkg)),
 " to ",
 sQuote(instPath), call. = FALSE)
} else {
## !! Can't revert to old 'zip.unpack' as it would
## !! potentially leave cruft from a bundle in there
stop("Can not remove prior installation of package ",
 sQuote(curPkg), call. = FALSE)
}

"Problem" lies in 

ret <- file.rename(file.path(tmpDir, curPkg), instPath)

I went through the whole function "by hand" and at first the above line
didn't moved tmpDir to instPath. I tried several times and after a while
it was successfull. It is strange that it happens only with some packages
i.e. in my case with RODBC and car. I also noted that line above takes 
quite a lot of time to "accomplish" its work. It actually causes R to 
freeze for a moment. If I launched

file.rename(file.path(tmpDir, curPkg), instPath)

move was done in a moment. I know, that this comment is not the answer 
to the problem. However, someone might come with that.

One more thing. I have R installed on networked disk. I assume that Heather 
does also, since disk letter is H. On the other hand, Paul reported problems
with C disk.

Windows XP SP1
R 2.0.1

On Tue, 5 Oct 2004 [EMAIL PROTECTED] wrote:
> Full_Name: Heather Turner
> Version: 2.0.0
> OS: Windows NT
> Submission from: (NULL) (137.205.8.2)
>
>
> I tried using the Packages menu to install the gam package and get the 
> following
> output:
>
> > local({a <- CRAN.packages()
> + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a,
> dependencies=TRUE)})
> trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES'
> Content type `text/plain; charset=iso-8859-1' length 21246 bytes
> opened URL
> downloaded 20Kb
>
> trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/gam_0.92.zip'
> Content type `application/zip' length 224167 bytes
> opened URL
> downloaded 218Kb
>
> package 'gam' successfully unpacked and MD5 sums checked
>
> Delete downloaded files (y/N)? y
>
> Warning message:
> unable to move temp installation 'H:/rw2000/library\file15762/gam' to
> 'H:/rw2000/library/gam'
>
> I get the same message if I opt to delete the downloaded files and the
> same problem if I try to install from a downloaded .zip file instead -
> not really surprising as seems to "unpack" file okay, but loses the
> temporary file. As the syntax of the file path for the temporary file is
> incorrect, I'm assuming this is a bug in install.packages or one of the
> functions it calls...

Since you _incorrectly_ assume that the syntax is incorrect, the rest of
your assumption is incorrect. As the FAQ asks, please don't speculate
about things you are not expert about, but stick to facts. Also as the
FAQ asks, don't misuse R-bugs for things you do not know _for sure_ are
bugs in R.

FYI, Windows accepts both /and \ in file paths, including a mixture. If
your speculation was correct install.packages() would work for no one, and
do you seriously think that such a bug would go unreported and unfixed.

We have seen this once before, and it was a Windows bug solved by updating
Windows to the latest set of patches. Since you have not reported a
precise version of Windows, it is hard for us to know what you were using,
but if you mean NT4.0, that is rather old (last Service Pack five years
ago I read yesterday).

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

--
Lep pozdrav / With regards,
Gregor GORJANC


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-12

[Rd] Use of htest class for different tests

2005-03-13 Thread Gorjanc Gregor
Hello!

First of all I must appologize if this has been raised previously, but
search provided by Robert King at the University of Newcastle seems to
be down these days. Additionally let me know if such a question should
be sent to R-help.

I did a contribution to function hwe.hardy in package 'gap' during the
weekend. That functions performs Hardy-Weinberg equilibrium test using
MCMC. The return of the function does not have classical components for
htest class so I was afcourse not successfull in using it. However, I
managed to copy and modify some part of print.htest to accomplish the 
same task.

Now my question is what to do in such cases? Just copy parts of 
print.htest and modify for each test or anything else. Are such cases 
rare? If yes, then mentioned approach is probably the easiest. 

--
Lep pozdrav / With regards,
Gregor GORJANC


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


RE: [Rd] CRAN Task Views: ctv package available

2005-03-12 Thread Gorjanc Gregor
Gregor:
>> I think that there is a lot of "fields" where this views cover the same
>> stuff. When I first read about ctv I thought it will be implemented more
>> in somewhat "hierarchical" or kind of "multiple" way, since for example
>> linear models come usefull in many different fields and some people might
>> never look under "Econometrics" view as Paul stated.
>>
>> I realize that "hierarchical/multiple" is far from easy and I do not have
>> any clear idea how to implement it, but it would probably easier to maintain
>> larger set of views in such a way and it would be easier to generate new
>> ones.

Achim
> Yes, the implementation would not be the main problem, but the
> maintenance. For hierarchical views, there needs to be much more
> communication and coordination between the maintainers of related views.
> My idea was to keep the work low for the maintainers...hoping that there
> would be more people volunteering to maintain a view related to their
> field of research or application.

Yes, you are right about needed work. Anyway, one can copy some parts from 
different views and create a new one ;)

Regards, Gregor

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


RE: [Rd] CRAN Task Views: ctv package available

2005-03-12 Thread Gorjanc Gregor
Hello!

First of all congratulations for a nice approach to present "R fields" in 
more coherent way. When I started with R I was often frustrated with long
list of packages, similarities between them, ... If I would take a slow 
approach (one thing at a time) things would be easier from the start, but 
usually one wants to know what a new program is capable of. This is esential
if one wants really to switch to R.

About ctv:
>> Paul Gilbert wrote:
>> For my own purposes the "Econometrics" view is just fine, but I do 
>> sometimes get questions about dse from people in fields that are 
>> different enough that they might not even know to look in 
>> "Econometrics." A time series view might be useful even if it only
>> said see also ... .  Another approach to this might be to have
>> sub-views so, for example, "Econometrics" and "Control theory" could
>> both point to "Time series."

> Achim Zeileis responded:
> Yes, that is, of course, an obvious idea but it requires more
> coordination between the different views, hence we've decided not to
> support hierarchically ordered views. 
> Re: "ControlTheory". If someone would raise his hand and provide a view
> for that, it would be great. It could, of course, link to the
> "Econometrics" view (and vice versa) but they wouldn't have a formally
> defined subset in a "TimeSeries" view.

I think that there is a lot of "fields" where this views cover the same
stuff. When I first read about ctv I thought it will be implemented more
in somewhat "hierarchical" or kind of "multiple" way, since for example 
linear models come usefull in many different fields and some people might
never look under "Econometrics" view as Paul stated.

I realize that "hierarchical/multiple" is far from easy and I do not have
any clear idea how to implement it, but it would probably easier to maintain
larger set of views in such a way and it would be easier to generate new
ones.

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3   tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europe

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


[Rd] corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits)

2005-02-13 Thread Gorjanc Gregor
Hello!

I posted on saturday mail with the same subject on r-help seeking
for help in my work, but now I realized that this list is more 
appropriate for this. I think I found I bug. Bellow are comments
and reproducible examples:

# Create a data frame
(tmp <- data.frame(y1=1:4, f1=factor(c("A", "B", "C", "D"
  y1 f1
1  1  A
2  2  B
3  3  C
4  4  D

# Add new column, which is not full (missing some data for last
# records)
tmp[1:2, "y2"] <- 2
tmp
  y1 f1   y2
1  1  A2
2  2  B2
3  3  C 
4  4  D 
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs
in: format.data.frame(x, digits = digits) 

# Why did I get corrupted data frame? 

# Add new factor column, which is not full (missing some data for last
# records)
tmp[1:2, "f2"] <- tmp[1:2, "f1"]
tmp
  y1 f1   y2   f2
1  1  A21
2  2  B22
3  3  C  
4  4  D  
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits) 

# New column should have class factor, but got somehow converted to integer
class(tmp$f2)
[1] "integer"

# If new column is completely full, everything is OK
> tmp$f3 <- tmp$f1
> tmp
  y1 f1   y2   f2 f3
1  1  A21  A
2  2  B22  B
3  3  CC
4  4  DD
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits) 

# Let's go further and try to convert one of new numeric column 
# to factor
tmp$y2 <- factor(tmp$y2, labels="x")
tmp
  y1 f1 y2   f2 f3
1  1  A  x1  A
2  2  B  x2  B
3  3  C  x   C
4  4  D  x   D
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits)

# Why did also NAs get converted to level x?

# Let's continue and add additional column, which is again not
# full, but missing some data for first records
tmp[3:4, "y3"] <- 1
tmp
  y1 f1 y2   f2 f3 y3
1  1  A  x1  A NA
2  2  B  x2  B NA
3  3  C  x   C  1
4  4  D  x   D  1
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs
in: format.data.frame(x, digits = digits) 

# Notice the difference between  in previous example and
# NA in current one.

# Try to convert this to factor
tmp$y3 <- factor(tmp$y3, labels="y")
tmp
  y1 f1 y2   f2 f3   y3
1  1  A  x1  A 
2  2  B  x2  B 
3  3  C  x   Cy
4  4  D  x   Dy
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs 
in: format.data.frame(x, digits = digits)

# Works as expected.
# My configuration:
Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 2
 minor = 0.1
 year = 2004
 month = 11
 day = 15
 language = R

Windows XP Professional (build 2600) Service Pack 0.0

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] Wish: multiline comments

2005-02-13 Thread Gorjanc Gregor
Hello!

I found a wish for multilne comments under wishlist-fullfilled.

http://r-bugs.biostat.ku.dk/cgi-bin/R/wishlst-fulfilled?id=7261;expression=NA;user=guest

Is this really fullfilled? Where, in R 2.1.0? I was not able to 
find any "announcements" or talks about that on mailing list 
or NEWS files.

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


Re: [Rd] Wishlist: simple legend options (PR#7400)

2005-02-13 Thread Gorjanc Gregor
Hello!

I was loooking in R-bugs and found under wishlist-fullfilled wish for 
"smart" placement of a legend. This has already been done in package
gplots in function smartlegend.

One question. This "bug-report" is under wishlist-fullfilled. Is it really
fullfilled? 

Mail from Elizabeth
---

It would be nice if legend had the option of some default locations you could
choose instead of entering specific coordinates, like "topleft",
"topright","topcenter", etc. based on par("usr") coordinates. I know I've wanted
it so often I've made my own simple non-robust wrap-around, so I don't have to
remember or parse the xjust and yjust options necessary to make it work. Of
course there should be the option of entering in your own coordinates. 

Also it would be nice to be able to put a optional title inside your legend.
Currently I just make my title the first value in my legend vector, and then fix
the other options so no symbols plot next to it. But this isn't always a pretty
result and can be a pain if your symbols are complicated.

Thanks,
Elizabeth 

Response to Elizabeth by Duncan Murdoch
---

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


RE: [Rd] Notes on bug reports 3229 and 3242 - as.matrix.data.fram e

2005-02-11 Thread Gorjanc Gregor
I agree. Sorry for bothering. 

With regards, Gregor

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: pet 2005-02-11 22:35
To: Gorjanc Gregor
Cc: Liaw, Andy; r-devel@stat.math.ethz.ch
Subject: RE: [Rd] Notes on bug reports 3229 and 3242 - as.matrix.data.fram e
 
...
> ! I agree completely and as I have described up it is my fault that
> ! I have/had problems with as.matrix.data.frame by use of write.table.
> ! But I think that my proposal is nice, since as.matrix.data.frame would
> ! be more robust.

It is actually much less robust.  It would work for embedded data frames 
of one column, but you could have a list column with entries of different 
lengths. e.g.

X <- data.frame(x=1:2, y = I(list(a=1, b=3:4)))
> as.matrix(X)
   x y
a 1 1
b 2 Integer,2

With your fix, this becomes an error.  And I could replace those entries 
by data frames containing lists of dates 

Note that in R-devel write.table does not convert data frames to matrices, 
so this does not arise.  We could treat your example specially, but surely 
it was an error that is better found out about than hushed up.

-- 
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


RE: [Rd] Notes on bug reports 3229 and 3242 - as.matrix.data.fram e

2005-02-11 Thread Gorjanc Gregor
From: Liaw, Andy [mailto:[EMAIL PROTECTED]
> From: Gorjanc Gregor

> ! Yes, I was not able to do it from my data. But bellow is one. It is
> ! a stupid one, but it works. The problem is use of as.data.frame in 
> ! tmp1$L <- as.data.frame(tmp$L). This looks like to produce 
> a corrupted
> ! data.frame. If I use just tmp1$L <- tmp$L, write.table and 
> ! as.matrix.data.frame works OK. I still think that mine proposal can
> ! give benefit, since it works also on corrupted data frames.
> 
> data(warpbreaks)
> tmp <- as.data.frame(tapply(breaks, list(wool, tension), mean))
> tmp1 <- data.frame(level=rownames(tmp))
> tmp1$L <- as.data.frame(tmp$L)

Here's the problem that Brian is referring to:  Why do you make one variable
in the data frame a data frame?  That's what caused problem in
write.table()!

! I agree completely and as I have described up it is my fault that
! I have/had problems with as.matrix.data.frame by use of write.table.
! But I think that my proposal is nice, since as.matrix.data.frame would 
! be more robust.

! With regards, Gregor

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


RE: [Rd] Notes on bug reports 3229 and 3242 - as.matrix.data.frame

2005-02-11 Thread Gorjanc Gregor
! Look after character !

From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
You too have not give an reproducible example!
! Yes, I was not able to do it from my data. But bellow is one. It is
! a stupid one, but it works. The problem is use of as.data.frame in 
! tmp1$L <- as.data.frame(tmp$L). This looks like to produce a corrupted
! data.frame. If I use just tmp1$L <- tmp$L, write.table and 
! as.matrix.data.frame works OK. I still think that mine proposal can
! give benefit, since it works also on corrupted data frames.

data(warpbreaks)
tmp <- as.data.frame(tapply(breaks, list(wool, tension), mean))
tmp1 <- data.frame(level=rownames(tmp))
tmp1$L <- as.data.frame(tmp$L)
write.table(tmp1)
Error in as.matrix.data.frame(x) : dim<- : dims [product 2] do not match the 
length of object [3]

tmp1$L <- tmp$L
write.table(tmp1)
"level" "L"
"1" "A" 44.6
"2" "B" 28.2

If you have a corrupt data frame, the function may fail, which is what 
happened in the PR# you quote.

Please note: you should not be calling as.matrix.data.frame, but as.matrix.
! I called it because I had problems with write.table and that function
! calls as.matrix.data.frame. 

On Fri, 11 Feb 2005, Gorjanc Gregor wrote:

> Hello R developers.
>
> I encountered the same problem as Uwe Ligges with as.matrix.data.frame()
> in bug reports 3229 and 3242 - under section not-reproducible.
>
> Example I have is:
>
>> tmp
> level 2100-D
> 1   biological_process unknown NA
> 2 cellular process  -5.88
> 3  development  -8.42
> 4physiological process  -6.55
> 5 regulation of biological process NA
> 6 viral life cycle NA
>
>> str(tmp)
> `data.frame':   6 obs. of  2 variables:
> $ level  : Factor w/ 6 levels "biological_..",..: 1 2 3 4 5 6
> $ 2100-D_mean:`data.frame':6 obs. of  1 variable:
>  ..$ 2100-D: num  NA -5.88 -8.42 -6.55 NA NA

I think you have a data frame column in a data frame, and that cannot be 
made directly into a matrix.  It's the steps that got you here that are 
the problem.

>> as.matrix.data.frame(tmp)
> Error in as.matrix.data.frame(tmp) : dim<- : dims [product 6] do not
> match the length of object [7]
>
> The error associated with this is comming up at the end of function
> as.matrix.data.frame where it is used:
>
>dim(X) <- c(n, length(X)/n)
>
> ?dim says
> 'dim' has a method for 'data.frame's, which returns the length of
> the 'row.names' attribute of 'x' and the length of 'x' (the
> numbers of "rows" and "columns").
>
> This part is ok. The problem is with X, which is "intensively"
> modified through the function. Before this (dim(X) <- ...) call
> X in my case is:
>
>> x <- tmp
>> "code from as.matrix.data.frame down to dim(X) <- ..."
>> X
> [[1]]
> [1] "biological_process unknown"
>
> [[2]]
> [1] "cellular process"
>
> [[3]]
> [1] "development"
>
> [[4]]
> [1] "physiological process"
>
> [[5]]
> [1] "regulation of biological process"
>
> [[6]]
> [1] "viral life cycle"
>
> [[7]]
> [1]NA -5.88 -8.42 -6.55NANA
>
> So we can see, that X is somehow destroyed - the first and second
> column of tmp differ. For dim command this should really be one
> long vector. So the problem lies in line
>
>X <- unlist(X, recursive = FALSE, use.names = FALSE)
>
> where it should be
>
>X <- unlist(X, recursive = TRUE, use.names = FALSE)
>   
>
> I have checked source code for that function from R as well as
> in R-devel sources. I was not succesfull in reproducing the above
> with the data frame bellow though. It did not report any problems
> with old as.matrix.data.frame. There must be some trick with
> first column in my data. So I am quite sure my suggestion is
> OK.
>
> tmp1 <- data.frame(level=c("A A", "B B"), x=c(NA, -5.8))
>
> --
> Lep pozdrav / With regards,
>Gregor GORJANC
>
> ---
> University of Ljubljana
> Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
> Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
> Groblje 3  tel: +386 (0)1 72 17 861
> SI-1230 Domzalefax: +386 (0)1 72 17 888
> Slovenia
>
> __
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Notes on bug reports 3229 and 3242 - as.matrix.data.frame

2005-02-11 Thread Gorjanc Gregor
Hello R developers.

I encountered the same problem as Uwe Ligges with as.matrix.data.frame()
in bug reports 3229 and 3242 - under section not-reproducible. 

Example I have is:

> tmp
 level 2100-D
1   biological_process unknown NA
2 cellular process  -5.88
3  development  -8.42
4physiological process  -6.55
5 regulation of biological process NA
6 viral life cycle NA

> str(tmp)
`data.frame':   6 obs. of  2 variables:
 $ level  : Factor w/ 6 levels "biological_..",..: 1 2 3 4 5 6
 $ 2100-D_mean:`data.frame':6 obs. of  1 variable:
  ..$ 2100-D: num  NA -5.88 -8.42 -6.55 NA NA

> as.matrix.data.frame(tmp)
Error in as.matrix.data.frame(tmp) : dim<- : dims [product 6] do not 
match the length of object [7]

The error associated with this is comming up at the end of function
as.matrix.data.frame where it is used:

dim(X) <- c(n, length(X)/n)

?dim says
 'dim' has a method for 'data.frame's, which returns the length of
 the 'row.names' attribute of 'x' and the length of 'x' (the
 numbers of "rows" and "columns").

This part is ok. The problem is with X, which is "intensively"
modified through the function. Before this (dim(X) <- ...) call
X in my case is:

> x <- tmp
> "code from as.matrix.data.frame down to dim(X) <- ..."
> X
[[1]]
[1] "biological_process unknown"

[[2]]
[1] "cellular process"

[[3]]
[1] "development"

[[4]]
[1] "physiological process"

[[5]]
[1] "regulation of biological process"

[[6]]
[1] "viral life cycle"

[[7]]
[1]NA -5.88 -8.42 -6.55NANA

So we can see, that X is somehow destroyed - the first and second
column of tmp differ. For dim command this should really be one 
long vector. So the problem lies in line

X <- unlist(X, recursive = FALSE, use.names = FALSE)

where it should be 

X <- unlist(X, recursive = TRUE, use.names = FALSE)
   

I have checked source code for that function from R as well as
in R-devel sources. I was not succesfull in reproducing the above
with the data frame bellow though. It did not report any problems
with old as.matrix.data.frame. There must be some trick with 
first column in my data. So I am quite sure my suggestion is
OK.

tmp1 <- data.frame(level=c("A A", "B B"), x=c(NA, -5.8))

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


[Rd] Option for "Delete downloaded files (y/N)?" in install.packages()

2005-01-04 Thread Gorjanc Gregor
Hello!

I have a wish/proposal.

Is it possible to include some option in install.packages() for
Delete downloaded files (y/N)? at the end of that process. It can
be quite anoying if you must install several packages and wait 
meanwhile to type y/n for each package separately.

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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


RE: [Rd] R-intro

2005-01-01 Thread Gorjanc Gregor
Nice. So, I was successfull afterall!

Thanks again to all R developers for such a usefull program. Happy new
year with small number of bugs and many new functions ;)

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia
---



-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED]
Sent: sob 2005-01-01 20:04
To: Uwe Ligges
Cc: Gorjanc Gregor; Kjetil Brinchmann Halvorsen; r-devel@stat.math.ethz.ch
Subject: Re: [Rd] R-intro
 
On Sat, 01 Jan 2005 17:24:33 +0100, Uwe Ligges
<[EMAIL PROTECTED]> wrote:

>Gorjanc Gregor wrote:
>> The problem is that there is no file morley.tab. I belive that for first 
>> impression or example session, things should work.
>
>Have you read from the beginning in Appendix A? It says:
>
>"Login, start your windowing system. You should also have the file
>'morley.tab' in your working directory. If not, seek the local expert
>(or get it yourself from the 'datasets/data' subdirectory of the default
>R library tree). If you have, proceed."
>
>The point is that we cannot get the file anymore from "datasets/data", 
>because since the days of R-2.0.0 we have the data in package "datasets" 
>lazy loaded and the file "morley.tab" is not available in binary 
>installations. Hence it is a bug.
>
>Possible solution:
>We could copy the file to something like 
>.../src/library/datasets/inst/intro/morley.tab
>
>It would also make sense to simplify the Appendix A stuff in R-intro, 
>because this is (well, has been) a more or less frequently asked 
>question (I wonder why nobody has asked during the last 3 months ):
>
>
>filename <- file.path(.find.package("datasets"), "intro", "morley.tab"))
>filename
>file.show(filename)
>mm <- read.table(filename)
>
>Uwe Ligges

Good suggestions.  I'll make the changes in R-patched.

Duncan Murdoch

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


RE: [Rd] R-intro

2005-01-01 Thread Gorjanc Gregor
The problem is that there is no file morley.tab. I belive that for first 
impression or example session, things should work.

>file.show("morley.tab")
>mm <- read.table("morley.tab")

-Original Message-
From: Kjetil Brinchmann Halvorsen [mailto:[EMAIL PROTECTED]
Sent: Fri 2004-12-31 22:01
To: Gorjanc Gregor
Cc: r-devel@stat.math.ethz.ch
Subject: Re: [Rd] R-intro
 
Gorjanc Gregor wrote:

>Hello!
>
>I was reading R-intro and I have some suggestions:
>
>R-intro.html#A-sample-session
>
>rm(fm, fm1, lrf, x, dummy)
>suggestion
>rm(fm, fm1, lrf, x, y, w, dummy)
>
>The next section will look at data from the classical experiment of Michaelson 
>and Morley to measure the speed of light.
>
>file.show("morley.tab")
>mm <- read.table("morley.tab")
>suggestion
>mm <- data(morley)
>  
>
No. Although this looks easier, the whole point is to show people how to 
use read.table!

Kjetil

>rm(fm, fm0)
>suggestion
>rm(fm, fm0, mm)
>
>objects(); rm(x, y, f, fa)
>suggestion
>objects(); rm(x, y, f, fa, oldpar)
>
>It might also be usefull to use # for comments, since it is easier to
>copy&paste to R terminal from manual.
>
>--
>Lep pozdrav / With regards,
>Gregor GORJANC
>
>---
>University of Ljubljana
>Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
>Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
>Groblje 3  tel: +386 (0)1 72 17 861
>SI-1230 Domzalefax: +386 (0)1 72 17 888
>Slovenia
>
>__
>R-devel@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>
>  
>


-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
   --  Mahdi Elmandjra





-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

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


[Rd] R-intro

2004-12-30 Thread Gorjanc Gregor
Hello!

I was reading R-intro and I have some suggestions:

R-intro.html#A-sample-session

rm(fm, fm1, lrf, x, dummy)
suggestion
rm(fm, fm1, lrf, x, y, w, dummy)

The next section will look at data from the classical experiment of Michaelson 
and Morley to measure the speed of light.

file.show("morley.tab")
mm <- read.table("morley.tab")
suggestion
mm <- data(morley)

rm(fm, fm0)
suggestion
rm(fm, fm0, mm)

objects(); rm(x, y, f, fa)
suggestion
objects(); rm(x, y, f, fa, oldpar)

It might also be usefull to use # for comments, since it is easier to
copy&paste to R terminal from manual.

--
Lep pozdrav / With regards,
Gregor GORJANC

---
University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si
Zootechnical Departmentemail: gregor.gorjanc  bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia

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