[R] feedback on writing r extensions
Hi, To whom should I send feedback/edits concerning the Writing R Extensions web page? http://cran.r-project.org/doc/manuals/R-exts.html Scott __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fidelity of generated raster images (R and perl)
Wrap-up: Different solutions were proposed for turning a matrix into a bitmap. Henrik Bengtsson [EMAIL PROTECTED] R.classes bundle from (http://www.maths.lth.se/help/R/R.classes/) MonochromeImage R.classes is still not compatible with 2.0.0 (minor modification to DESCRIPTION etc are needed) so you have use R v1.9.1 to try the below. img - MonochromeImage(1-bits) # 1=white, 0=black image(img) plot(img) persp(img, phi=60, theta=150) write(img, foo.pbm) # Write directly Martin Maechler [EMAIL PROTECTED] I think the most typical alternative is to use image() [EMAIL PROTECTED] Maybe use the write.pnm() function in the pixmap package Another package you could explore is rimage, which looks relevant. For the sake of being conventional and minimizing dependencies, I had good success with the image() function. It is very nice to know there are other approaches if I need to optimize/customize what I am doing more for this. (As usual) learned a few more things about 'R' from the examples provided by others. Most grateful for your help. Regards, Scott __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] fidelity of generated raster images (R and perl)
Hi: Goal: use R to turn a matrix of 1's and 0's into a corresponding image (e.g. png) of black and white pixels. Why R: Yes, I can do this more efficiently and precisely with a perl module like Image::PBM. Been there, done that many times, etc. (Just humor me. I'm trying to do this with R for a number of reasons.) Problem: Difficult to get a perfect rasterization. There can be appended or removed pixel columns or pixel rows depending on plot region dimensions. I witness this with both R version 1.8.1 and R version 2.0. print($out bitmap('/usr/local/mycrow/tmp/out.png', type = 'png256', height = .(int($height*68/64)/64)., width = .(int($width*69/64)/64)., res = 64, pointsize=0)\n); print($out 'par(mar=c(0,0,0,0))'.\n); my $width1 = $width-1; my $height1 = $height-1; print($out END); plot.new() plot.window(c(0,$width1),c(0,$height1)) rect(m[,1], m[,2], m[,1], m[,2], col=black, border=black) There are alternatives to rect (plot with type=p, pch=., etc) and I have also tried png() instead of bitmap(). (I do prefer bitmap so this can run without x11.) I am guessing that R's internal region calculations are vector based, which generally makes sense for most statistical plots. However, I do have some ideas for R and the presentation of cellular automata results. Any tips out there? (Is it just a matter of height=50px to overcome the inches default, etc?). Regards, Scott __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html