[Rd] Packages for R-CRAN (organizing aspects)

oliver oliver at first.in-berlin.de
Tue Jun 7 18:00:25 CEST 2011


On Tue, Jun 07, 2011 at 10:30:12AM -0400, Gabor Grothendieck wrote:
> On Tue, Jun 7, 2011 at 9:03 AM, oliver <oliver at first.in-berlin.de> wrote:
> > Hello,
> >
> > I have some ideas for packages that I want to provide on R-CRAN.
> >
> > One package alreads is working, but I have some warnings in
> > when compiling. Also I don't know if the libraries in use are only
> > working on Unix/Linux.
> >
> > So I have some general questions:
> >
> >  - If I'm not sure if the code would also work on windows
> >    (needing some ceratain libraries or tools),
> >    would it be better to mark it as Unix-like only?
> >
> >    Would other people, who are interested in using the package
> >    on Windows, then look for the other issues?
> >
> >    (I'm just interested in providing the functionality, and I don't use Windows,
> >     so compatibility would not be my main goal, if it's using certain libraries;
> >     but if the code is not relying on certain libs or tools I of course write
> >     code ANSI-conform, so that it *should* compile on windows too.)
> >
> >    I mean: I just want to have the work for Unix/Linux, but in general like the
> >    platform-independent approach. I just have no interest, looking at the windows
> >    side too much. Are there people from R-CRAN team, who help at that point to make
> >    things available on many platforms?
> >
> >
> >  - I have in mind packages for reading a lot of different files / fileformat.
> >    How to name them?
> >    it would be consequent to name them
> >    read.<fileformat>
> >    but I'm not sure if this naming style is reserved for OO-methods only,
> >    and that topic I will learn later in detail, so that at the moment
> >    I just would provide the raw functionality.
> >
> >    Maybe the name of the reading function should then better be named
> >    read<filefomat> or <fileformat>read ?
> >
> >  - There are a lot of different fileformats that I want to read in.
> >
> >    Would it be better to make for each format one different package,
> >    or rather put them all together as a package "Readmisc"?
> >
> >    For example the following formats I have in mind:
> >
> >      - jpeg (libjpeg62)                     => already working, I want to
> >                                                clean up the code and documentation
> >                                                soon and then provide on R-CRAN
> >
> 
> Note existence of read.jpeg in the rimage package, read.gif in the
> caTools package and readPNG in the png package.

read.jpeg in rimage does not give me a matrix like I would extpect in R,
for further working with the data.
It gives me an imagmatrix, which's value I can't access directly.
I only have a data structure that is closed to the functionality that the
rimage module provides.

Maybe I have overseen something,
but how would I plot a histogram
of R, G and B values and the according
grayvalue's histogram?

With my libjpeg reader it would be:

      library(libjpeg)
      pic <- readjpeg( picfilename )
      par(mfrof=c(4,1))
      hist( pic$r, breaks = 256, col="red")
      hist( pic$g, breaks = 256, col="green")
      hist( pic$b, breaks = 256, col="blue")
      hist( pic$bw, breaks = 256)

How would that be possible with rimage?


read.gif in caTools is giving back a matrix, and hence it's a fine function.
caTools btw. offers a lot of very interesting functions. :-)

readPNG of png package is agood hint,
I didn't knew that.


> 
> >      - bvh   (maybe (f)lex or yacc or pcre) => want to start this soon
> >
> >      - apachelogfile /maybe using pcre)     => starting date not planned
> >
> >      - some other formats also
> >
> >
> >  - Other package ideas: rolling application (which uses R's built in types,
> >    not like zoo() using special types)
> 
> rollapply and related functions in the development version of zoo do
> work with ordinary vectors and matrices:

Ah the it's a new feature, which is not offered in the packages I can install
with install.packages and the default settings for this.

I had to use as.zoo() around my data to use rollapply from zoo-package.



> # install development version of zoo
> install.packages("zoo", repos = "http://r-forge.r-project.org")


Aha.
OK, thanks.

What about the documentation.
if I look for it on r-cran, but the module is form r-forge there will
be a mismatch.




> >
> > library(zoo)
> > rollmean(1:10, 2)
> [1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
> > rollapply(1:10, 2, sum)
> [1]  3  5  7  9 11 13 15 17 19
> > rollmean(1:10, 2)
> [1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
> > rollapply(cbind(a = 1:10, b = 11:20), 3, sum)

Yes, with that version it works. :-)


Ciao,
   Oliver



More information about the R-devel mailing list