R - statistics package and scripting language

Mathematical tools, physics simulators, CAD, CNC, etc.
Message
Author
loserguy
Posts: 2
Joined: Mon 08 Mar 2010, 09:53

#16 Post by loserguy »

I use command line for R mostly, but drop back to GUI when I'm trying to sell an idea. JGR (http://jgr.markushelbig.org/JGR.html) is nice but needs Java.

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

Learning R

#17 Post by hayden »

For anyone who wants to LEARN R you can access the examples I created for my two-semester intro. stats. sequence at

http://courses.statistics.com/software/help.php

which also has limited support for Rcmdr. This is for beginning statistics students who are not programmers. There are links to the example datasets so you can follow along..

If you want more detail I recommend the book on using R in an intro. course by John Verzani. This is for statistics users and professors whereas most of the official R documentation is for programmers. There is a UsingR package to go with Verzani's book

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

R-2.12.1

#18 Post by emil »

2 Pets 8) : R and R + Rcmdr [/size]

Image

Those were build in Lupu Quickset Edition 511.

Dependencies:
gfortran-4.4.3
recommended/optional:
devx.sfs (to install and compile additional packages)
tcltk8.5 (graphical download menu packages needs it)
Xorg-high.pet (from Quickpet for 3d plots)

Download location
http://boxen.math.washington.edu/home/e ... are/Puppy5


Just R: for those who just need commandline: start with R from terminal, installs normal
Rcmdr: R + Rcmdr, for those who like a gui. R - starts just R in terminal, Rcmdr starts R + Rcmdr, has also menu entries in Menu/Business/Calculate, installs to /mnt/home

maybe those work also in other puppies, but I am not sure. Test reports welcome :D

Happy 2011
emil

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

R 2.12

#19 Post by hayden »

I booted vanilla Puppy 511 from a CD. (It might have grabbed some previously saved files off my system at boot.) Then I installed gfortran and R 2.12. It worked great! Including graphics this time round. A good test if anyone is playing with this is (on the R command line)

Code: Select all

demo(graphics)
There are no menus on the windows so if you want to save or print a graph you have to do that from the command line.

Code: Select all

library()
will list the 27 packages already installed along with R.

Thanks, emil

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

Rcmdr

#20 Post by hayden »

Booted the same 511 but took care not to load any files not on the CD. Then I installed emil's gfortran, tcl/tk and Rcmdr pets. Seemed to work fine. I will try some older Puppies next year.

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

#21 Post by hayden »

After playing around with R and Rcmdr I remastered Puppy with those installed. The CD boots and R and Rcmdr are on the menu but neither runs from either the command line or the menu. It looks like a window opens and instantly closes. No error message.

Code: Select all

# cd /usr/bin
# ls R*
R  Rcmdr  Rcmdr.sh  R.sh
# more R.sh
#!/bin/sh
# this starts R and calls the start script /root/.Rprofile
# which starts Rcmdr
xterm -e /mnt/home/R-2.12.1/bin/R --no-init-files.
I see two problems. /mnt/home does not exist. Earlier that was the thumb drive on which the pet was stored. However, that thumb drive does not have a R-2.12.1 directory on it anyway. Then .Rprofile does not exist in /root. (I did ask that hidden files be shown and did see some others.)

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#22 Post by emil »

Hmm, will look at it, *sigh*
emil
oh, first thought, I guess anything in mnt/home will not be remastered with the standard scripts.
I plan to put it into an sfs and make something like a math.sfs (with maxima and octave), but I don't promise
If you want to make a remastered lupq 511 with R then I suggest to compile fresh, i.e. install, tcltk and gfortran, load the devx, then load the r sources and do vanilla (./configure, make, install) hmm loading the R.pet should be the same.
then follow my instructions for getting R commander installed from earlier this thread (should be something like install.packages(Rcmdr, dependencies=true)
that should work,
emil

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

Other puppies

#23 Post by emil »

Just tried it in Wary (102) and spup (first release), it didn't work :cry:
So atm restricted to Ubuntu puppies.

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

R 2.12 not persistent

#24 Post by hayden »

Why does something get mounted on /mnt/home? Usually apps end up in one of the /bin folders or occasionally in the user's home directory (/root for Puppy). It appears that R gets installed to a RAM image of /mnt/home? After I booted from the CD and installed R, /mnt/home was the thumb drive the pet had been on. Of course thumb drives should not get normally included in a remaster. However, it looks like R did not get put on the physical thumb drive anyway. I can't find it there now, nor can pfind find it anywhere from the remaster with that thumb drive mounted.

I am hoping that losing the dot configuration file is not a problem and that R would run with defaults if that cannot be found. I've never quite figured out what configurations get saved in a remaster. I always choose to have the remaster NOT save settings for my hardware as the point of the remaster is to give it to students to use on their own computers.

There is an older R 2.4 out there -- a dot-pup I think. I believe that DID survive a remaster. Maybe there are some clues in that. Maybe I can get that to work in a Puppy that also has a development environment available so I could install R packages. I went through all this a year or two back based on Puppy 2.14 and I think the roadblock was installing R packages.

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

Update on R-2.4

#25 Post by hayden »

Back in 2008-2009 I built a couple of ISOs for something I called "SciPup" that could be handed out to college students in science. One was based on Puppy 2.14 and the other on TeenPup (which was also based on 2.14). I just booted both of those and R did indeed make it into the remaster. The R files seem to be in /usr/lib and /usr/bin. I did not see a dot configuration file. The run script is longer than _War and Peace_ but seems to be mostly generic stuff that came with the source. If anybody messes with this I seem to recall that R tried to find the Mandrake C-compiler if you tried to install R packages. I do not have ANY C compiler installed in SciPup. I don't think there was a developer sfs back then, and I'm not sure if there is one now for Puppy 2.14. If so I think one could edit Mandrake out of the startup shell script.

One other thing I learned is that these older pups do not boot up from my SATA CD drive;-( I had to try them on other hardware.

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

remaster Rcmdr

#26 Post by emil »

hi hayden,
The /mnt/home was used intentionally by me when building by giving the ./configure prefix=/mnt/home option. The advantage is that it doesn't use up your savefile (300 MB), disadvantage is remaster won't work.

To fix it you could ask the students to install the pet themself (which is not so hard) or you install just the R package and then install Rcmdr from within

Code: Select all

install.packages("Rcmdr", dependencies=TRUE)
emil

User avatar
hayden
Posts: 61
Joined: Thu 14 Sep 2006, 01:49
Location: New Hampshire USA

R

#27 Post by hayden »

OK. I'll continue to work with the R 2.4 package. The point for students was to avoid having to install things. Most are Windows users and might as well just install R for Windows and avoid all these issues;-) And to install their own R packages in Puppy they would need the developer package while the Windows packages are precompiled.

Rcmdr seems to have grown to require roughly 150 other packages. That is why it inflates the save file by 300Mb. I will try to find the Rcmdr that goes with R 2.4. I think Rcmdr used to have about 10 dependencies. My guess is that it has added many capabilities that would not be needed in a basic stats. course anyway.

Thanks for you efforts re R 2.12. This may be good for me to use if not for students.

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#28 Post by emil »

I ment if you install just R.pet (this is in the savefile) with devx.sfs and dependencies installed, then you could install Rcmdr inside the remastered filesystem and afterwards do a remaster. I just did this and it worked, however you probably will have to remove /root/.rProfile and /root/.rHistory manually. If you use a normal lupu 5.11 as base than you could give the students a Rcmdr puppy.

Either way, thanks for the pointer with the R plotting, Ill try to make this work in sagelive
emil

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

R-puppy

#29 Post by Puppyt »

G'day emil,

I must congratulate you again for your efforts with R - much appreciated, thank you! Like hayden I've also had problems remastering Lupu520 into a straightforward "R-pup" using your pets and listed dependencies (i.e,. tcklt, gofortran, lupu_devx_520 etc). Mind you, I've never had any luck burning copies of my operational puppy from hard-drive to CD - I must be missing something obvious although I follow the help dialogues to the letter.
I can produce the LUPU 520 ISO with all your extra pets on the CD so that they can be regenerated 'on the fly' for any fresh install, as I think you suggested in your previous post, but like hayden I think that might frustrate a novice user. I'm attempting now to remaster the LUPU 520 iso by swapping my operational (R- and Rcmdr-loaded) lupu.sfs with that generated from the 'Puppy live-CD remaster'. Again, I must be missing something really basic,

Cheers.

EDIT: Barking up the wrong tree again - obvious that only the current LIVE-CD is offered for remastering in the standard selections offered in Lupu 520, you have to go 'behind the scenes' to do a functional remaster as illustrated here by stu90/snuffer66 http://www.youtube.com/watch?v=i5xXWtkvw50 or the indomitable sneekylinux here http://www.youtube.com/watch?v=yQIqwy7_ ... re=related and he has a Part2 linked with it also. Dougals ENHANCED remaster script is buried here http://www.murga-linux.com/puppy//viewt ... 7e2ad5850c and I'm just about to try it out now.

EDIT EDIT: Barking up another wrong tree - for Lupu520 shinobar has come to the rescue in cases of some sort of 'reused' SFS issue with a another updated RemasterPup2 here: http://www.murga-linux.com/puppy/viewto ... a701c0932b, and pa_mcclamrock posted his Remasterpup3 here http://www.murga-linux.com/puppy/viewto ... a701c0932b, which I'm about to try. Or cry trying.

OK those who've actually read through the reams of help threads are aware that there are 2 basic ways to remaster your own puppy - during a 'live' session in which you boot from a fresh base (with puppy pfix=ram), download and install all your preferred goodies (Pets and SFS's, browser add-ons, bookmarks etc), and then choose the 'Puppy Remaster Live-CD' route to personalise your distro. or;
INSTALL your fresh base to HDD or USB etc - creating a pupsav file in the rebooting process - and download and install all your preferred goodies (Pets and SFS's, browser add-ons, bookmarks etc as previous example. Correct me if I'm wrong somebody - not important whether you are running from a "Full" or "Frugal" install.) This secondary route doesn't appear to come standard in the official Puppy5's, from what I have seen.

I note similar disappearances and 'ghosting' as hayden described for emil's R- and RCommander pets after rebooting, undoubtedly related to the /mnt/home installation path noted earlier in this thread as an issue on Monday 3rd Jan. The respective file lists in ./packages are stripped (i.e., "R-2.12.1-i486.files" and "Rcmdr-2.12.1-i486.files") and as everything else appeared intact I thought if I just repaired and preserved those files by changing the Permission rights on them, they would not be corrected on reboot. Don't try that solution, folks - that leads to kernel-panic City.

I'll try emil's workaround - maybe I'll understand it when I try it - I think you mean remastering via the hdd-install route rather than the live-cd route, emil? I wonder whether you'd care to re-compile the pets to install in the expected manner, or perhaps post an SFS combining those pets - some stage in the future? Many thanks for all your work to date, emil.
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

remaster

#30 Post by emil »

Hi puppyt - greetings and best wishes to Australia and especially to the regions and victims which were hit by the flooding.

I see 2 distinct issues:

1) The fact that I compiled R to /mnt/home was motivated by saving place in savefiles. It grew quite popular recently (see open offce pets). From the responce so far it would had been better to make them at a place inside the "/" tree which is included into the remaster. Maybe I have a quick go at that.

2) I feel there is quite a deal of confusion in the conception of "remaster". I exclusively use a "manual remaster" procedure, which works fine for me. It is also much easier to understand and control what happens. Burning lots of dysfunctional CD'S makes no sense. Is there any interest if I write sort of a "HOWTO manual remaster"?

kind regards
emil

PS: try my new lithe version of my sage pupplet. (400 MB) there you can install Rcmdr and do a remaster, this should work fine. It is called sagelithe
http://www.murga-linux.com/puppy/viewto ... 712#487712

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#31 Post by Puppyt »

Many Thanks emil for your kind sympathies - much appreciated. I live just off Postmans' Ridge Road and while my family and property was largely untouched, a very many of our little communities are living through 4 different kinds of hell at the present. Trying not to think about it, so a little Puppy remastery disastery is light relief.

Thanks too for the heads-up on your Sagelithe puplet - I hope to have a look at that later. For my personal use I frequently just extract the 3-4 key files from a Puplet ISO for a manual frugal install (five Puppy5's and a couple of Puppy4's on my Toshiba Portege 3480CT, without PCMCIA support. I use 7-zip in WinXP for that and can burn ISO's like the 'open' or 'multi' CD's in Puppy, using the latest CDBurnerXP). Actually creating my own puplet or backup CD copy with all the programs most useful for my profession - just as hayden was aiming for his students - well that's another matter. Wheels keep falling off for me in the 'automated' remasterings. Might not be so complicated for me if I didn't charge off like a bull through two different gates at the same time. Perhaps a "how-to" on manual remastering would be useful to clarify the issue (for a LOT of perpetual noobs like myself), but only later if you have the time.

Is a "R / RCommander" puppy possible with your pets or might there be a script or patch (or symlink solution) to keep all the cogs together when a remastery for the masses (not installation on a case-by-case basis) is warranted? Would that get around the (usually expected) mount-from-/ recompile problem hayden and myself seem to be having? It seems a waste to have to use the 'other' installation and remaster option through WINE - though I get the strong impression from your last message and your earlier-suggested workaround that RCmdr is the bugbear. Sorry if I ramble - you can tell I'm no programmer,

Thanks Again
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#32 Post by emil »

Remaster will only work when all the files are in the "/" section and not in "/mnt" section. Creating symlinks there will only confuse the matter further.

1) Option: use sagelithe, install Rcmdr there, then remaster that - everything is in "/sage"

2) Option: recompile R with -prefix=/opt/R.2.12.2 (or similar), install Rcmdr from that R, then remaster that (possibly also create optional pet package from that directory tree)

R seems the most used package, you need it for your job?
greetings
emil

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

Rcmdr sfs

#33 Post by emil »

I made an sfs of Rcmdr, which installs to /opt/R-2.12.1 - this is included by the usual remaster scripts. Made in Lupq 511, briefly tested in 520.
gfortan 44.3 and TclTk8.5 are included in the sfs, so only missing dependency is Xorg-High for 3d-plotting.

Download: http://sage.math.washington.edu/home/em ... re/Puppy5/

Start with R from terminal, or with menu entry in Business (category Calculator).
Start Rcmdr with library(Rcmdr) from inside R.

Cookbook R sfs:
As stated the difficulty is that you have to compile Rcmdr from inside R, so usual new2dir for pet production doesn't work. So I did the following (its out from top of my head, more like a reminder to myself). If you find something is wrong please correct me.

downloaded r source to /mnt/home/Compile, and unzipped it to
/mnt/home/Compile/R-2.21.1

loaded devx.sfs, installed gfortran pet and tclTk8.5 pet. then:
check if enough enough space left in savefile (600 MB, OK).

open terminal

Code: Select all

cd /mnt/home/Compile/R-2.12.2
mkdir bld                                      # create build directory
cd bld
../configure -prefix=/opt/R-2.12.1      #set the final installation directory
make
make check                                   #hopefully no errors detected
make install                                   # Version A: build R+ Rcmdr sfs 
# new2dir make install-strip              # Version B: build just R pet
# /opt/R-2.12.1/bin/R
# demo(graphics)                          # Version B: test, if works
# cd /mnt/home/Compile
# now add any menu entries, symlinks etc to directory R-2.12.1-i386
# dir2pet R-2.12.1-i386                   # use TAB completion - it rocks!
# End Version B creation of only R - pet 
# (Rcmdr can be installed from inside R anytime)
/opt/R-2.12.1/bin/R                          # Version A - Follow up:run R
install.packages("Rcmdr", dependencies=TRUE)      #install Rcmdr
demo(graphics)                              # quick test
library(Rcmdr)                                # quick test of Rcmdr
Ctrl-D                                           # leave R
cd /mnt/home/Compile/R-2.12.1        # have done no stripping yet
mkdir -p R-2.12.1-sfs-dir/opt                       #make a coppy of the installation
# maybe there is an error while stripping, so better keep the original
# also your savefile could become full when you create sfs in "/" range,
# so better switch to /mnt/home
cp -nvr /opt/R-2.21.1 ./R-2.21.1-sfs-dir/opt      # prepare this dir- tree also for sfs creation 
cd R-2.12.1-sfs-dir # 
Ok, in my work with the sage installation I have used a little script which uses the package fslint (scripts which find double files and hardlinks them, google - Bash/Python mix). The script also strips all binaries in the directory tree. So we use this to check/strip the R package

Code: Select all

#--striptree.sh --
#!/bin/sh
# replace double files with hardlinks in all directory tree
findup -m .
# strip executables
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : |
xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null 
This saves ~ 40 MB

strip, then test again the stripped R-tree:

Code: Select all

striptree.sh
./opt/bin/R                  # cross fingers and start R
demo(graphics)          # works
library(Rcmdr)            # seems to work too
mkdir -p ./usr/bin          # create a Symlink so R is in the path
ln -s ./opt/bin/R ./usr/bin/R   
# simliar create menu entries and include icons etc,
# maybe weed out some bloat manually 
# when finish do 
cd ..
dir2sfs R-2.12.1-sfs-dir             #produce our new R sfs package
mv R-2.12.1.sfs /mnt/home        # shift it to /mnt/home
rm -r /opt/R-2.12.1         # delete installation: Oops!
# mv /opt/R-2.12.1 to_backup_location   # maybe better to keep the original
list our R.sfs in the bootmanager, Reboot and then hopfully it works.
Hey hayden and puppyt - hope this works for an R-Pup!
Regards
8) emil
Last edited by emil on Thu 20 Jan 2011, 10:09, edited 1 time in total.

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#34 Post by Puppyt »

Dear emil -

this is absolutely marvelous, THANK YOU :D

I regret that my bandwidth has been choked (broadband wireless in regional Queensland is a criminal AU$80/mo for 6GB up/down thanks to a national monopoly) - but will be able to download and install late tonight.

With regard to your earlier query, emil, I think I wrote waaaay back when somewheres in the Puppy forums that there was a rapid increase in use of statistical modeling in fields related to animal behavior research. 'R' plays a starring role in that shift away from 'traditional' hypothesis-testing techniques of data analysis - as a quick scan of leading journals like "Animal Behavior" over the last decade testifies. There is a site put together for behavioral ecologists here https://bestat.ecoinformatics.org/ with tutorials for the use of R being added all the time. [Thanks hayden for posting your earlier link for introductions to the use of R - I'll be looking into those in more detail later.]

Thanks too for your very helpful SFS 'cookbook' emil - fingers crossed that this numpty could replicate that pathway if ever needed - or alternatively risk loading the Sid (Lenny) r-dev package into something like Dpup or Insidious Puppy. (Reckon I'll design a t-shirt for myself with the "Perpetual Noob" motif.) I'll let you know how your SFS goes in a pristine Lupu 520,

Cheers!
Last edited by Puppyt on Thu 10 Mar 2011, 11:56, edited 2 times in total.
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#35 Post by emil »

Hi puppyt,

sorry I remember you told me back than about your animal research!
Actually R compiles quite smoothly, the package is well tended.
It's definitly one of the easier pieces of source.

Last year I wrote that maybe there will never be an easy pet/sfs of R, but you see, one year later experience and increased skill make me find it easy.
The cookbook looks of course very difficult writing up all those terminal commands. Maybe there is even a shorter possibility but I am happy that this worked so well (you never know before).

I hope that the pathway is useful because I think R is a "should have" package for all puppy versions, but I fear most need there own version compiled. Hm, I add a line to the description about making an R.pet, Rcmdr can always be installed from inside that with the second part of the cookbook.

Maybe you could eventually help with looking into the package and see what else could be stripped out or shifted to DOC / LANG packages. I guess with 145 MB it is still too heavy (the core R is ca 20 MB) so Rcmdr pulls in lots of stuff! That would be great!

kind regards
emil

Post Reply