Re: [Rd] Why R-project source code is not on Github

2014-08-24 Thread Brian Lee Yung Rowe
One thing to note about git vs svn is that each git repository is a complete 
repository containing the full history, so despite github acting as a central 
repository, it is not the same as a central svn repository. In svn the central 
repository is typically the only repository with a complete revision history, 
but that is not the case with git.

�
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY




On Aug 24, 2014, at 2:22 PM, Spencer Graves 
spencer.gra...@structuremonitoring.com wrote:

 In addition, several members are skeptical about putting source code
 in the hands of a for-profit US company, and other legal issues. These
 are just some of the concerns that would need to be addressed to get
 everyone on board.
 
 
  Am I correct that we could use Git without Github?
 
 
  If yes, the planning might involve a cost-benefit comparison of what 
 would be required bring up a not-for-profit alternative to Github (e.g., 
 RGit.org or FreeGit.org or ...), and whether the risks of problems with that 
 would be more or less than the risks associated with putting source code in 
 the hands of a for-profit US company.
 
 
  Spencer
 
 
 p.s.  Regarding the risks of putting source code in the hands of a 
 for-profit US company, I would naively expect that it should be easy and 
 cheap for someone to program a server to make daily backup copies of whatever 
 we want from Github.  This could provide an insurance policy in case events 
 push the group to leave Github. Many (most?) of those who read this may 
 remember how LibreOffice forked from Open Office.  A friend told me that 
 MySQL has a much larger user (and developer?) base than LibreOffice, and 
 every Oracle executive doubtless knows that MySQL could similarly be forked 
 relatively easily.


[[alternative HTML version deleted]]

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


Re: [Rd] Is using devtools::release no longer allowed?

2014-08-19 Thread Brian Lee Yung Rowe
Isn't the source for CRAN itself open source? One option is to run a test 
server that can respond with a success or failure message based on the 
submission. 

•
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY

 On Aug 19, 2014, at 3:55 PM, Kasper Daniel Hansen 
 kasperdanielhan...@gmail.com wrote:
 
 Given the seeming need for automated submission to CRAN, perhaps the repos
 maintainers could consider making a function available that allows one to
 do so, for example
  source(http://www.cran.r-project.org/submit_to_cran.R;)
  submit_to_cran(PACKAGE.TARBALL, REQUIRED_ARGUMENTS)
 or perhaps be interested in a community developed script?  Although I
 recognize how easy it is for me to suggest work for others, it seems like
 such a script would cut down on everyones work, long-term.
 
 Best,
 Kasper
 
 
 
 
 On Tue, Aug 19, 2014 at 2:53 PM, Duncan Murdoch murdoch.dun...@gmail.com
 wrote:
 
 On 19/08/2014 2:40 PM, Carl Boettiger wrote:
 
 Dirk, listeners,
 
 Perhaps you would consider using omegahat's RHTMLForms instead?
 
 library(RHTMLForms)
 forms - getHTMLFormDescription(http://xmpalantir.wu.ac.at/
 cransubmit/
 )
 submit_to_cran - createFunction(forms[[1]])
 
 Should create a function called submit_to_cran with arguments
 corresponding to the webform blanks, e.g.
 
 submit_to_cran(name = packagename, email = youremail, uploaded_file =
 package.tar.gz, comment = the optional comment)
 
 (clearly you could fill those details in from the submitting package
 description).  I haven't tested this.
 If you use this, make sure you test it well enough to get it perfect the
 very first time you use it.  If I were a CRAN administrator and received a
 series of bad submissions from someone who was working out the bugs, I
 would not find it difficult either technically or morally to permanently
 ban that user from ever submitting anything again.
 
 Duncan Murdoch
 
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
[[alternative HTML version deleted]]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

[[alternative HTML version deleted]]

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


Re: [Rd] Compilation problems

2014-08-13 Thread Brian Lee Yung Rowe
I would add it would be useful to know what system you are on and how much 
overall memory the machine has (not to mention how many other users are on the 
box). If you are on a linux variant, you can see installed memory by running: 
cat /proc/meminfo. You might also want to look at top to see how many resources 
are being used by you and others.

Regarding Java, if you had done a search for 'java xmx', you'd see that you can 
control the maximum heap size of the JVM using this option. [1]   So, if you 
know how much memory you have available on your system, then you can set this 
value to something lower and verify that you can start the JVM in isolation. As 
for specifics, I wouldn't know, since you didn't provide the JVM version you're 
using. Try java -version to give us specifics.

Brian

[1] 
http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html

�
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY




On Aug 13, 2014, at 5:15 AM, peter dalgaard pda...@gmail.com wrote:

 Well, I didn't go there because I don't have a clue
 
 What I usually try in such circumstances is to Google the error message and 
 see if any ideas crop up. Looks like it is common to several applications 
 that use Java, so not likely an R issue per se.
 
 I'd look into 
 
 - how to provoke the error to occur without make
 - what are your resource limits (ulimit -a  is your friend)?
 - are any environment variables affecting the Java memory use? If not, 
 perhaps you need to set them to values less than the max allowed. Or twiddle 
 command line options.
 
 etc.
 
 -pd
 
 On 13 Aug 2014, at 10:46 , Andr� Z. D. A. andrezd...@yandex.com wrote:
 
 Thanks a lot for this atention, Peter. But the fonts problem is just a 
 warning: configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF 
 vignettes and package manuals will not be rendered optimally. So, no 
 worries. I can live with render errors for the manuals. :)
 
 But the error I have with the 'make' is with Java. I don't know why. I even 
 restarted the compilation again (the only detail I change is to pass 
 --prefix=/home/me/r/ to configure, to install it on my own folder instead 
 of defaults). Then a make without arguments and it ends with this:
 
 -
 configuring Java ...
 Java interpreter : /usr/bin/java
 Could not create the Java virtual machine.
 Error occurred during initialization of VM
 Could not reserve enough space for object heap
 
 *** Java interpreter doesn't work properly.
 
 make[1]: [stamp-java] Error 1 (ignored)
 make[1]: Leaving directory `/home/me/r-src-second-try/R-3.1.1'
 
 -
 
 
 But how do anyone explain that onde a second run of 'make' it finished!? And 
 on two more times it won't show the error again!
 
 Lets try to run R. Done 'make install'... and then run... it works!
 
 I'm lost. A bug? Something is not working as it should? What? Or is it fine??
 
 Andre'
 
 
 On 11 Aug 2014, at 16:49 , peter dalgaard pda...@gmail.com wrote:
 
 On 11 Aug 2014, at 15:46 , Andr� Z. D. A. andrezd...@yandex.com wrote:
 
 No, Peter, I have the (2014-07-10, Sock it to Me) R-3.1.1.tar.gz 
 source. Thanks for pointing it. So (I hope) it should be ok. Right?
 
 Not unlikely. (I goofed and thought that it only affected the development 
 version.)
 
 Check
 
 kpsewhich inconsolata.sty
 
 if it is found, and zi4.sty is not, then it should be fixed by an upcoming 
 patch release.
 
 ... and for a quick fix, edit the configure script. There is a section 
 looking like this
 
 if test -n ${KPSEWHICH}; then
 ${KPSEWHICH} zi4.sty  /dev/null
 if test $? -eq 0; then
 { $as_echo $as_me:${as_lineno-$LINENO}: result: found zi4.sty 5
 $as_echo found zi4.sty 6; }
 else
 ${KPSEWHICH} inconsolata.sty  /dev/null
 if test $? -ne 0; then
 { $as_echo $as_me:${as_lineno-$LINENO}: result: found inconsolata.sty 5
 
 (Search for incons and you'll get there.)
 
 Change the -ne in the penultimate line to -eq and rerun configure. This 
 isn't the correct fix because configure is autogenerated from other files, 
 but it should get you going.
 
 -pd
 
 -pd
 
  Peter Dalgaard, Professor wrote:
 
 If you are playing with the R-devel branch (or rather, trunk), then just 
 hold
 your horses for a little while. There seems to be a reversed-logic bug 
 that
 bites if you have inconsolata.sty and not zi4.sty.
 
 --
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk Priv: pda...@gmail.com
 
 --
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk Priv: pda...@gmail.com
 
 -- 
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000

Re: [Rd] modifying a persistent (reference) class

2014-08-01 Thread Brian Lee Yung Rowe
Ross,

This is generally a hard problem in software systems. The only language I know 
that explicitly addresses it is Erlang. Ultimately you need a system upgrade 
process, which defines how to update the data in your system to match a new 
version of the system. You could do this by writing a script that 
1) loads the old version of your library
2) loads your data/serialized reference classes
3) exports data to some intermediate format (eg a list)
4) loads new version of library
5) imports data from intermediate format

Once you've gone through the upgrade process, arguably it's better to persist 
the data in a format that is decoupled from your objects since then future 
upgrades would simply be
1) load new library
2) import data from intermediate format

which is no different from day-to-day operation of your app/system (ie you're 
always writing to and reading from the intermediate format). 

Warm regards,
Brian

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY

 On Aug 1, 2014, at 1:54 PM, Ross Boylan r...@biostat.ucsf.edu wrote:
 
 I saved objects that were defined using several reference classes.
 Later I modified the definition of reference classes a bit, creating new
 functions and deleting old ones.  The total number of functions did not
 change.  When I read them back I could only access some of the original
 data.
 
 I asked on the user list and someone suggested sticking with the old
 class definitions, creating new classes, reading in the old data, and
 converting it to the new classes.  This would be awkward (I want the
 new classes to have the same name as the old ones), and I can
 probably just leave the old definitions and define the new functions I
 need outside of the reference classes.
 
 Are there any better alternatives?
 
 On reflection, it's a little surprising that changing the code for a
 reference class makes any difference to an existing instance, since all
 the function definitions seem to be attached to the instance.  One
 problem I've had in the past was precisely that redefining a method in a
 reference class did not change the behavior of existing instances.  So
 I've tried to follow the advice to keep the methods light-weight.
 
 In this case I was trying to move from a show method (that just printed)
 to a summary method that returned a summary object.  So I wanted to add
 a summary method and redefine the show to call summary in the base
 class, removing all the subclass definitions of show.
 
 Regular S4 classes are obviously not as sensitive since they usually
 don't include the functions that operate on them, but I suppose if you
 changed the slots you'd be in similar trouble.
 
 Some systems keep track of versions of class definitions and allow one
 to write code to migrate old to new forms automatically when the data
 are read in.  Does R have anything like that?
 
 The system on which I encountered the problems was running R 2.15.
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

[[alternative HTML version deleted]]

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


Re: [Rd] modifying a persistent (reference) class

2014-08-01 Thread Brian Lee Yung Rowe
Ross,

Ah I didn't think about Smalltalk. Doesn't surprise me that they supported 
upgrades of this sort. That aside I think the question is whether it's 
realistic for a language like R to support such a mechanism automatically. 
Smalltalk and Erlang both have tight semantics that would be hard to establish 
in R (given the multiple object systems and dispatching systems). 

I'm a functional guy so to me it's natural to separate the data from the 
functions/methods. Having spent years writing OOP code I walked away concluding 
that OOP makes things more complicated for the sake of being OOP (eg no first 
class functions). Obviously that's changing, and in a language like R it's less 
of an issue. However, something like object serialization smells suspiciously 
similar. If you know that serializing objects is brittle, why not look for an 
alternative approach as opposed to chasing that rainbow?

Warm regards,
Brian

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY

 On Aug 1, 2014, at 3:33 PM, Ross Boylan r...@biostat.ucsf.edu wrote:
 
 On Fri, 2014-08-01 at 14:42 -0400, Brian Lee Yung Rowe wrote:
 Ross,
 
 
 This is generally a hard problem in software systems. The only
 language I know that explicitly addresses it is Erlang. Ultimately you
 need a system upgrade process, which defines how to update the data in
 your system to match a new version of the system. You could do this by
 writing a script that 
 1) loads the old version of your library
 2) loads your data/serialized reference classes
 3) exports data to some intermediate format (eg a list)
 4) loads new version of library
 5) imports data from intermediate format
 My recollection is that in Gemstone's smalltalk database you can define
 methods associated with a class that describe how to change an instance
 from one version to another.  You also have the choice of upgrading all
 persistent objects at once or doing so lazily, i.e., as they are
 retrieved.
 
 The brittleness of the representation depends partly on the details.  If
 a class has 2 slots, a and b, and the only thing on disk is the contents
 of a and the contents of b, almost any change will screw things up.
 However, if the slot name is persisted with the instance it's much
 easier to reconstruct the instance of the class changes (if slot c is
 added and not on disk, set it to nil; if b is removed, throw it out when
 reading from disk).  Once could also persist the class definition, or
 key elements of it, with individual instances referring to the
 definition.
 
 I don't know which, if any of these strategies, R uses for reference or
 other classes.
 
 
 Once you've gone through the upgrade process, arguably it's better to
 persist the data in a format that is decoupled from your objects since
 then future upgrades would simply be
 1) load new library
 2) import data from intermediate format
 Arguably :)  As I said, some representations could do this
 automatically.  And there are still issues such as a change in the type
 of a slot, or rules for filling new slots, that would require
 intervention.
 
 In my experience with other object systems, usually methods are
 attributes of the class.  For R reference classes they appear to be
 attributes of the instance, potentially modifiable on a per-instance
 basis.
 
 Ross
 
 
 which is no different from day-to-day operation of your app/system (ie
 you're always writing to and reading from the intermediate format). 
 
 
 Warm regards,
 Brian
 
 •••••
 Brian Lee Yung Rowe
 Founder, Zato Novo
 Professor, M.S. Data Analytics, CUNY
 
 On Aug 1, 2014, at 1:54 PM, Ross Boylan r...@biostat.ucsf.edu wrote:
 
 
 I saved objects that were defined using several reference classes.
 Later I modified the definition of reference classes a bit, creating
 new
 functions and deleting old ones.  The total number of functions did
 not
 change.  When I read them back I could only access some of the
 original
 data.
 
 I asked on the user list and someone suggested sticking with the old
 class definitions, creating new classes, reading in the old data,
 and
 converting it to the new classes.  This would be awkward (I want the
 new classes to have the same name as the old ones), and I can
 probably just leave the old definitions and define the new functions
 I
 need outside of the reference classes.
 
 Are there any better alternatives?
 
 On reflection, it's a little surprising that changing the code for a
 reference class makes any difference to an existing instance, since
 all
 the function definitions seem to be attached to the instance.  One
 problem I've had in the past was precisely that redefining a method
 in a
 reference class did not change the behavior of existing instances.
 So
 I've tried to follow the advice to keep the methods light-weight.
 
 In this case I was trying to move from a show method (that just
 printed)
 to a summary method that returned a summary object.  So I wanted to
 add

Re: [Rd] index.search

2014-06-16 Thread Brian Lee Yung Rowe
Thanks for the great insight. I love that there's always something else to 
learn in R. 

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY

On Jun 16, 2014, at 3:34 AM, Martin Maechler maech...@stat.math.ethz.ch wrote:

 Adrian Dușa dusa.adr...@unibuc.ro
on Mon, 16 Jun 2014 08:33:59 +0300 writes:
 
 On Mon, Jun 16, 2014 at 6:37 AM, Gabriel Becker
 gmbec...@ucdavis.edu wrote:
 [...]  You can. This is valid R source, so the parser
 will understand it
 
 expr = parse(text= example(deMorgan, package=QCA,
 give.lines=TRUE))
 
 You can then evaluate some or all of that expression
 using either R's own eval package or, e.g. Hadley
 Wickham's evaluate package (for your particular usecase
 evaluate will be easier I think).
 
 Oh, I see...! In that case I can use it, of course.  Did
 install the evaluate package, although one would expect
 some better documentation (no examples at all, especially
 at the main evaluate function).
 
 
 [...]
 index.search is an unexported function, which means that
 it is subject to change in how it behaves without notice
 or even externally available reasons. You can get it via
 :::, but again, it's really not the right tool here, and
 not safe to use in general in code you expect to keep
 working.
 
 Yes, I figured that much.  Of course it's not meant to be
 used in any decently working code, but I learn heavily by
 simply looking at these sort of (hidden) R functions.
 
 Thanks again, Adrian
 
 Apropos not the right tool.  I'm a bit astonished that nobody
 mentioned the fact R already provides the tool to
 automatically compare all example outputs with a previous
 version (of the packages example outputs):
 
 *THE* manual (every package writer should know about,
 re-read/browse about once a year, and search in for such questions):
 
 Writing R Extensions, section Package subdirectories
 
 (e.g. on the CRAN master in Vienna,
 http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories )
 says
 
 |If directory 'tests' has a subdirectory 'Examples' containing a file
 |'PKG-Ex.Rout.save', this is compared to the output file for running the
 |examples when the latter are checked. 
 
 So: After an 'R CMD check PKG' you only need to take and
 keep the  PKG-Ex.Rout  file that is produced (in the
 PKG.Rcheck/ directory), and save it into PKG/tests/PKG-Ex.Rout.save
 and from then on, every time you run R CMD check PKG  the
 comparison will be made. 
 
 Martin Maechler, ETH Zurich
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

[[alternative HTML version deleted]]

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


Re: [Rd] index.search

2014-06-15 Thread Brian Lee Yung Rowe
Adrian,

You might consider using a unit testing framework such as RUnit or testthat, 
which does this but in a more structured manner. Essentially you codify the 
behavior in a set of tests as opposed to comparing with a previous version.

HTH,
Brian

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY

 On Jun 15, 2014, at 11:25 PM, Adrian Dușa dusa.adr...@unibuc.ro wrote:
 
 Hi Gabriel,
 
 Actually, I am not going to use multiple versions of the same package,
 but always the last version. What I would like to do is:
 - to run all examples from all functions in the package, saving the
 results into a list
 - compare the list to an already saved one (from the previous version
 of the package), possibly using all.equal()
 
 I tried using the example() function, like this:
 example(deMorgan, package=QCA, give.lines=TRUE)
 
 That returns the commands from the examples section, but if a command
 is split over multiple rows I cannot use it automatically.
 
 I could also use:
 capture.output(example(deMorgan, package=QCA, ask=FALSE))
 
 That would indeed work for the printed output, but I would also like
 to compare the objects saved by the deMorgan() function. If that is
 not possible, I'll probably be happy with the printed output.
 
 I'd still be curious as to why the index.search() function cannot be
 used... (it seems useful for other purposes).
 
 Best wishes,
 Adrian
 
 
 On Mon, Jun 16, 2014 at 5:46 AM, Gabriel Becker gmbec...@ucdavis.edu wrote:
 Adrian,
 
 R isn't really designed to use multiple versions of the same package in the
 same R session. To do what you want you'll need to unload one version of the
 package before you load the next, which will work some percentage of the
 time between 50 and 100 (usually), but when it can be done it is
 relatively easy to do.
 
 Packages with C code will give you problems, or at least they used to. I
 haven't tried recently.  See Prof Ripley's response here: See
 https://stat.ethz.ch/pipermail/r-devel/2009-February/052229.html
 
 For packages that can be unloaded/reloaded safely, is there a reason you
 can't just use the existing example function with two different library
 locations (lib.loc argument) with the two package versions installed?
 
 ~G
 
 
 On Sun, Jun 15, 2014 at 6:22 PM, Adrian Dușa dusa.adr...@unibuc.ro wrote:
 
 Dear r-devel,
 
 I am trying to automatically check if two successive versions of a
 package have the same results (i.e. code not broken), by parsing the
 example sections for each function against a previously tested
 version.
 
 While trying to replicate the code from example(), I am facing an
 error related with te index.search function (line 7 in the example()
 code).
 This is the code I am using:
 
 example2 - function (topic, package = NULL, lib.loc = NULL,
 character.only = FALSE,
give.lines = FALSE, local = FALSE, echo = TRUE, verbose =
 getOption(verbose),
setRNG = FALSE, ask = getOption(example.ask), prompt.prefix =
 abbreviate(topic, 6), run.dontrun = FALSE)
 {
if (!character.only) {
topic - substitute(topic)
if (!is.character(topic))
topic - deparse(topic)[1L]
}
pkgpaths - find.package(package, lib.loc, verbose = verbose)
file - index.search(topic, pkgpaths, TRUE)
return(file)
 }
 
 example2(deMorgan, package=QCA)
 Error in example2(deMorgan, package = QCA) :
  could not find function index.search
 
 
 I've tried an explicit library(utils), with the same result.
 ?index.search doesn't yield anything better...
 
 Could anyone point me in the right direction, please?
 Thank you,
 Adrian
 
 
 --
 Adrian Dusa
 University of Bucharest
 Romanian Social Data Archive
 1, Schitu Magureanu Bd.
 050025 Bucharest sector 5
 Romania
 Tel.:+40 21 3126618 \
+40 21 3120210 / int.101
 Fax: +40 21 3158391
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 
 
 
 --
 Gabriel Becker
 Graduate Student
 Statistics Department
 University of California, Davis
 
 
 
 -- 
 Adrian Dusa
 University of Bucharest
 Romanian Social Data Archive
 1, Schitu Magureanu Bd.
 050025 Bucharest sector 5
 Romania
 Tel.:+40 21 3126618 \
+40 21 3120210 / int.101
 Fax: +40 21 3158391
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

[[alternative HTML version deleted]]

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


Re: [Rd] Ellipsis to Two Functions When One Has Nested Functions

2014-05-28 Thread Brian Lee Yung Rowe
Another option is to use a closure, which isolates the arguments explicitly.

aFunction - function(data, alpha, ...)
{
   transform(alpha, ...)
   rowMeans(data)  alpha
}

f - function(data, selection, ...)
{
   selected - selection(data) # Remove ellipsis from here
   plot(data[selected, ], ...)
}

f(aDataset, function(data) aFunction(data, alpha = 10, transform = sqrt), pch = 
19)

•
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY




On May 28, 2014, at 7:34 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:


 On 28/05/2014, 2:00 AM, Dario Strbenac wrote:
 Hello
 
 If I have a function
 
 aFunction - function(data, alpha, ...)
 {
 transform(alpha, ...)
 rowMeans(data)  alpha
 }
 
 f - function(data, selection, ...)
 {
 selected - selection(data, ...)
 plot(data[selected, ], ...)
 }
 
 f(aDataset, aFunction, alpha = 10, pch = 19, transform = sqrt)
 
 and selection calls another function, which has ... and that function calls 
 other functions, is there an easier way than getting the formals of all the 
 functions called internally by selection, and all of the formals of 
 functions called by plot ? Is there any option to change the error into a 
 warning message ?
 
 You can use try() to catch an error, but you can't ignore it.  The code that 
 triggered the error will still exit at that point.
 
 There are at least two common ways of handling the situation where you want 
 to pass optional args to two different functions.  One is to use
 
 args - list(...)
 
 to get all the arguments in a list, and then manually split up the list, and 
 use do.call() to pass some of them on.  Generally you would do this only if 
 you knew in advance how to split the args, you wouldn't try to call formals() 
 to work it out at run-time.
 
 Another way is to have an argument like control in optim(), and ask the 
 user to pass one set of options via that, and the other via ... . You'd use 
 do.call() again to construct that call.
 
 Duncan Murdoch
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


[[alternative HTML version deleted]]

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


Re: [Rd] Ellipsis to Two Functions When One Has Nested Functions

2014-05-28 Thread Brian Lee Yung Rowe
Another option is to use a closure, which isolates the arguments explicitly.

aFunction - function(data, alpha, ...)
{
   transform(alpha, ...)
   rowMeans(data)  alpha
}

f - function(data, selection, ...)
{
   selected - selection(data) # Remove ellipsis from here
   plot(data[selected, ], ...)
}

f(aDataset, function(data) aFunction(data, alpha = 10, transform = sqrt), pch = 
19)

•
Brian Lee Yung Rowe
Founder, Zato Novo
Professor, M.S. Data Analytics, CUNY




On May 28, 2014, at 7:34 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 28/05/2014, 2:00 AM, Dario Strbenac wrote:
 Hello
 
 If I have a function
 
 aFunction - function(data, alpha, ...)
 {
 transform(alpha, ...)
 rowMeans(data)  alpha
 }
 
 f - function(data, selection, ...)
 {
 selected - selection(data, ...)
 plot(data[selected, ], ...)
 }
 
 f(aDataset, aFunction, alpha = 10, pch = 19, transform = sqrt)
 
 and selection calls another function, which has ... and that function calls 
 other functions, is there an easier way than getting the formals of all the 
 functions called internally by selection, and all of the formals of 
 functions called by plot ? Is there any option to change the error into a 
 warning message ?
 
 You can use try() to catch an error, but you can't ignore it.  The code that 
 triggered the error will still exit at that point.
 
 There are at least two common ways of handling the situation where you want 
 to pass optional args to two different functions.  One is to use
 
 args - list(...)
 
 to get all the arguments in a list, and then manually split up the list, and 
 use do.call() to pass some of them on.  Generally you would do this only if 
 you knew in advance how to split the args, you wouldn't try to call formals() 
 to work it out at run-time.
 
 Another way is to have an argument like control in optim(), and ask the 
 user to pass one set of options via that, and the other via ... . You'd use 
 do.call() again to construct that call.
 
 Duncan Murdoch
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


[[alternative HTML version deleted]]

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


Re: [Rd] Behavior of --install-tests and testInstalledPackage

2014-01-27 Thread Brian Lee Yung Rowe
Winston,

Thanks for the pointer. Hadley made the same suggestion. One thing I was 
looking to do though was have something like this automated, so it would be 
nice to have a return value instead of just results written to files. That's 
one nice thing about the testInstalledPackage function, despite the issue with 
the test harness. Any additional pointers are greatly appreciated. 

Warm Regards,
Brian Rowe

•••••
Brian Lee Yung Rowe
Founder, Zato Novo
Professor 


On Jan 27, 2014, at 12:52 PM, Winston Chang winstoncha...@gmail.com wrote:

 On Wed, Jan 22, 2014 at 10:55 AM, Brian Lee Yung Rowe r...@muxspace.com 
 wrote:
 Hello,
 
 I'm writing a script that automates the testing of reverse dependencies of a 
 package. I found the function testInstalledPackage in the tools package, 
 which seems to do what I want. However, when I use it for a source package 
 that was installed with --install-tests, I've noticed that only the actual 
 test files (e.g. located in inst/tests) are available and run. In other 
 words the test harness script (e.g. in tests) is not copied, so any wiring 
 to run tests isn't available when running testInstalledPackage.
 
 I tried loading the required packages (i.e. the installed package to retest 
 plus the testing frameworks RUnit, testthat), but since testInstalledPackage 
 makes an external call to R CMD BATCH, any packages loaded in my current 
 environment have no effect on the tests. The only workaround that I've come 
 up with is to add require statements to the top of each test file, but this 
 is a bit onerous.
 
 My question is whether
 1) there is a technique to force the test harness script (e.g. 
 tests/run_tests.R, tests/doRUnit.R) to be copied into the installed source 
 package, or
 2) there is a way to have testInstalledPackage force the loading of required 
 packages prior to executing test scripts, or
 3) has someone already done this?
 
 
 I can answer (3). devtools already has a function that does this:
   library(devtools)
   revdep_check('mypackage')
 
 It's basically a wrapper for the revdep and check_cran functions from 
 devtools. In the development version of devtools (on Github) there are some 
 changes to improve the output of these functions.
 
 -Winston 

[[alternative HTML version deleted]]

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


[Rd] Behavior of --install-tests and testInstalledPackage

2014-01-22 Thread Brian Lee Yung Rowe
Hello,

I'm writing a script that automates the testing of reverse dependencies of a 
package. I found the function testInstalledPackage in the tools package, which 
seems to do what I want. However, when I use it for a source package that was 
installed with --install-tests, I've noticed that only the actual test files 
(e.g. located in inst/tests) are available and run. In other words the test 
harness script (e.g. in tests) is not copied, so any wiring to run tests isn't 
available when running testInstalledPackage. 

I tried loading the required packages (i.e. the installed package to retest 
plus the testing frameworks RUnit, testthat), but since testInstalledPackage 
makes an external call to R CMD BATCH, any packages loaded in my current 
environment have no effect on the tests. The only workaround that I've come up 
with is to add require statements to the top of each test file, but this is a 
bit onerous.

My question is whether
1) there is a technique to force the test harness script (e.g. 
tests/run_tests.R, tests/doRUnit.R) to be copied into the installed source 
package, or
2) there is a way to have testInstalledPackage force the loading of required 
packages prior to executing test scripts, or
3) has someone already done this?

Thanks and Regards,
Brian
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Where to drop a python script?

2013-11-01 Thread Brian Lee Yung Rowe
If that's all you want to do, you can ignore the headache by just calling 
system(python -V).

Then you don't need to save any python scripts.


On Nov 1, 2013, at 10:17 AM, Jonathan Greenberg j...@illinois.edu wrote:

 This was actually the little script I was going to include (prompting me to
 ask the question): a test for the python version number.
 Save this (between the ***s) as e.g. python_version.py:
 
 ***
 
 import sys
 print(sys.version_info)
 
 ***
 
 I've done almost no python coding, so I was going to call this with a
 system(/pathto/python /pathto/python_version.py,intern=TRUE) call and
 post-process the one-line text output.
 
 --j
 
 
 On Thu, Oct 31, 2013 at 12:45 PM, Paul Gilbert pgilbert...@gmail.comwrote:
 
 
 
 On 13-10-31 01:16 PM, Prof Brian Ripley wrote:
 
 On 31/10/2013 15:33, Paul Gilbert wrote:
 
 
 
 On 13-10-31 03:01 AM, Prof Brian Ripley wrote:
 
 On 31/10/2013 00:40, Paul Gilbert wrote:
 
 The old convention was that it went in the exec/ directory, but as you
 can see at
 http://cran.at.r-project.org/**doc/manuals/r-devel/R-exts.**
 html#Non_002dR-scripts-in-**packageshttp://cran.at.r-project.org/doc/manuals/r-devel/R-exts.html#Non_002dR-scripts-in-packages
 
 
 
  it can be in inst/anyName/. A minor convenience of exec/ is that the
 directory has the same name in source and when installed, whereas
 inst/anyName gets moved to anyName/, so debugging can be a tiny bit
 easier with exec/.
 
 Having just put a package (TSjson) on CRAN with a python script, here
 are a few other pointers for getting it on CRAN:
 
 -SystemRequirements: should indicate if a particular version of python
 is needed, and any non-default modules that are needed. (My package
 does
 not work with Python 3 because some modules are not available.) Some of
 the libraries have changed, so it could be a bit tricky to make
 something work easily with both 2 and 3.
 
 -You need a README to explain how to install Python. (If you look at or
 use mine, please let me know if you find problems.)
 
 
 Better to describe exactly what you need: installation instructions go
 stale very easily.
 
 -The Linux and Sun CRAN test machines have Python 2 whereas winbuilder
 has Python 3. Be prepared to explain that the package will not work on
 one or the other.
 
 
 Not true.  Linux and Solaris (sic) have both: the Solaris machines have
 2.6 and 3.3.
 
 
 For an R package how does one go about specifying which should be used?
 
 
 You ask the user to tell you the path or at least the command name, e.g.
 by an environment variable or R function argument.  Just like any other
 external program such as GhostScript.
 
 
 Yes, but since I don't have direct access to the CRAN test machines,
 specifically, on the CRAN test machines, how do I specify to use Python 2
 or Python 3? (That is, I think you are the user when CRAN tests are done on
 Solaris, so I am asking you.)
 
 
 
 
 Please do not spread misinformation about machines you do
 not have any access to.
 
 
 Another option to system() is pipe()
 
 Paul
 
 On 13-10-30 03:15 PM, Dirk Eddelbuettel wrote:
 
 
 On 30 October 2013 at 13:54, Jonathan Greenberg wrote:
 | R-developers:
 |
 | I have a small python script that I'd like to include in an R
 package I'm
 | developing, but I'm a bit unclear about which subfolder it should go
 in.  R
 | will be calling the script via a system() call.  Thanks!
 
 Up to you as you control the path. As Writing R Extensions explains,
 everything below the (source) directory inst/ will get installed.  I
 like
 inst/extScripts/ (or similar) as it denotes that it is an external
 script.
 
 As an example, the gdata package has Perl code for xls reading/writing
 below a
 directory inst/perl/ -- and I think there are more packages doing
 this.
 
 Dirk
 
 
 
 __**
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-develhttps://stat.ethz.ch/mailman/listinfo/r-devel
 
 
 
 
 
 
 __**
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-develhttps://stat.ethz.ch/mailman/listinfo/r-devel
 
 
 
 
 -- 
 Jonathan A. Greenberg, PhD
 Assistant Professor
 Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
 Department of Geography and Geographic Information Science
 University of Illinois at Urbana-Champaign
 259 Computing Applications Building, MC-150
 605 East Springfield Avenue
 Champaign, IL  61820-6371
 Phone: 217-300-1924
 http://www.geog.illinois.edu/~jgrn/
 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007
 
   [[alternative HTML version deleted]]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] declaring package dependencies

2013-09-16 Thread Brian Lee Yung Rowe
I haven't used rforge, but I will look check out the scripts. The reason it 
would be a six-pack of work is that there are generic build systems that handle 
most of this work. What they don't do is act as a repository, so rforge could 
remain that while separating out the build process. 


On Sep 16, 2013, at 4:58 AM, Matthew Dowle mdo...@mdowle.plus.com wrote:

 On Sep 16, 2013, at 01:46 PM, Brian Rowe wrote:
 
 That reminds me: I once made a suggestion on how to automate some of the CRAN
 deployment process, but it was shot down as not being useful to them. I do
 recall a quote that was along the lines of as long as you don't need help,
 do whatever you want, so one thought is to just set up a build server that
 does the building across the three versions of R, checks dependencies, 
 rebuilds
 when release, patch, or devel are updated, etc. This would ease the burden on
 package maintainers and would just happen to make the CRAN folks' lives 
 easier
 by catching a lot of bad builds. A proof of concept on AWS connecting to 
 github
 or rforge could probably be finished on a six-pack. Speak up if anyone thinks
 this would be useful.
 
 Yes useful. But that includes a package build system (which is what breaks on
 R-Forge). If you could do that on a six-pack then could you fix R-Forge on a
 three-pack first please? The R-Forge build system is itself an open source
 package on R-Forge. Anyone can look at it, understand it and change it to be
 more stable. That build system is here :
 
 https://r-forge.r-project.org/R/?group_id=34
 
 (I only know this because Stefan told me once. So I suspect others don't know
 either, or it hasn't sunk in that we're pushing on an open door.)
 
 Matthew
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] R CMD config for R = 3.0.1

2013-09-10 Thread Brian Lee Yung Rowe
As an alternative, you might consider installing a virtual machine in your user 
space and installing R from there. That way you don't have to do a bunch of 
one-off gymnastics to get R compiled. 



On Sep 11, 2013, at 1:40 AM, Simon Urbanek simon.urba...@r-project.org wrote:

 On Sep 10, 2013, at 5:30 PM, crunch wrote:
 
 Also have no cooperation from the admin of the machine, so can't ask for a
 yum install.
 
 Please follow Brian's advice. If you don't have even Fortran on that machine, 
 then you're really in a pickle: you can extract the gfortran rpm contents 
 (and all dependencies you may need) by hand in any place that you have access 
 to and adjust LD_LIBRARY_PATH for the runtime accordingly. However, it's not 
 a trivial task - it particular if you're not very familiar with subtleties of 
 Linux. (I had to do this fairly recently on a CentOS machine, so I know it's 
 possible, but there are a few gotchas that may require a few symlinks created 
 by hand).
 
 Cheers,
 Simon
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/R-CMD-config-for-R-3-0-1-tp4667399p4675814.html
 Sent from the R devel mailing list archive at Nabble.com.
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] legitimate use of :::

2013-08-22 Thread Brian Lee Yung Rowe
You raise an interesting point that I've mulled over a bit: namespace 
collisions. How many of these issues would go away if there were a better 
mechanism for managing namespaces? eg in other languages you can control which 
objects/modules you wish to import from a library. Under this regime I think 
package developers would be less concerned about exposing functions that 
otherwise would be private. 

On Aug 22, 2013, at 6:27 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote:

 If ::: is disallowed then its likely that package developers will need
 to export more functions to satisfy the consumers of those otherwise
 hidden functions but if more functions are exported then there
 will be a greater likelihood of conflicts among packages.
 
 The problem seems to be that there are potentially three sorts of
 functions here:
 
 1. a function is hidden
 2. a function is accessible via ::: but is not on the search path
 3. a function is on the search path
 
 The problem arises in attempting to force fit these three concepts
 into only two
 categories either by removing the first category (as was done previously)
 or by removing the second category (which seems to be the new approach).

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


Re: [Rd] legitimate use of :::

2013-08-22 Thread Brian Lee Yung Rowe
This is what I was getting at as well. It would be great to have a call like

require(package, c('funtion.1','function.2')) 

or similar that gives users granular control over what gets imported in the 
shell. I would be drunk with joy if the same mechanism could be used to 
automatically populate the package directives.


On Aug 22, 2013, at 8:01 PM, Peter Meilstrup peter.meilst...@gmail.com wrote:

 It would be nice if the functionality of importFrom() and import() were
 available to user level code, rather than just to people building packages
 for distribution. One most often encounters namespace conflicts at the user
 level, when loading two packages that have no logical connection other than
 both bearing on your problem of the moment.
 
 R conflates having namespaces with having a library distribution
 mechanism and while its library distribution mechanism is top notch, most
 modern languages do not require you to learn the distribution procedure in
 order to just have namespaces.
 
 For instance, in Python you merely put code in a file called foo.py and
 then in any other file in the same directory you type import functionName
 from foo. I.E. using namespaces does not require you to build/install
 packages. Python namespaces are also hierarchical so that the question of
 this thread would easily be resolved by putting functions into
 foo._internal and in other packages typing import * from foo._internal
 
 Peter
 
   [[alternative HTML version deleted]]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?

2013-07-05 Thread Brian Lee Yung Rowe
Here are two more standard emacs bindings that work:  Ctrl-K to cut and Ctrl-Y 
to paste. 

•
Brian Lee Yung Rowe
917 496 4583


On Jul 5, 2013, at 2:32 PM, William Dunlap wdun...@tibco.com wrote:

 But up-arrow, ctrl-A then z - is not much less convenient, is it?
 
 I didn't know that ctrl-A would bring me to the start of the line, nor
 that ctrl-E would bring me to the end.  Thanks.
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
 -Original Message-
 From: peter dalgaard [mailto:pda...@gmail.com]
 Sent: Friday, July 05, 2013 11:25 AM
 To: William Dunlap
 Cc: Barry Rowlingson; R-devel
 Subject: Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?
 
 
 On Jul 5, 2013, at 18:59 , William Dunlap wrote:
 
 Is there any reason right-assign with - still exists? How much
 code on CRAN uses it, and how trivially could it be excised?
 
 I use '-' a lot when doing interactive work.  I often first run a command
 to see its printed output then decide that I had better save its value.
 The up-arrow key gives me the previous command line with the cursor placed 
 at the
 end of the line so adding '- z' at the end of the line is convenient.
 (Not using the up-arrow key and doing 'z - .Last.value' also works, but
 I don't like its context sensitivity.)
 
 But up-arrow, ctrl-A then z - is not much less convenient, is it?
 
 I have used in with multi-line input, occasionally, though. As in
 
 replicate(1, {
   ysim - rbinom(length(p), n, p)
   glm(cbind(ysim, n - ysim) ~ x, binomial)$deviance
 })
 
 ... and then you realize that you probably don't want to look at 1 
 simulated
 deviances and add - simDev.
 
 
 I never use '-' when writing code in a file, so you would have to search
 my .Rhistory files, not my *.R files, for evidence of its usefulness to me.
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
 -Original Message-
 From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] 
 On
 Behalf
 Of Barry Rowlingson
 Sent: Friday, July 05, 2013 9:29 AM
 To: Duncan Murdoch
 Cc: R-devel
 Subject: Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?
 
 On Fri, Jul 5, 2013 at 12:57 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:
 
 R itself doesn't make use of the text column, it's for display of code
 by highlighters etc.  So if anyone does assume text is a function name,
 it's their bug, not ours.  In fact, the bug is already there, because
 there is actually one other example which was being parsed properly,
 ** is translated to ^.  There's no `**` function, but 2**3 works.
 
 Is there any reason right-assign with - still exists? How much
 code on CRAN uses it, and how trivially could it be excised? Can we
 also have 'up assign'  and down assign so I can do:
 
   3
 x -^
 x -v
   4
 
 - they make just as much sense.
 
 Okay, lets see all the edge cases.
 
 Barry
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 --
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk  Priv: pda...@gmail.com
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?

2013-07-05 Thread Brian Lee Yung Rowe
That is a more accurate statement regarding Ctrl-K. Nonetheless whatever is 
killed can be yanked back via Ctrl-Y, so the effect emulates cutting and 
pasting. I am also a vi user, but these four basic emacs bindings seem to 
perennially haunt numerous terminal apps. 

•
Brian Lee Yung Rowe
917 496 4583


On Jul 5, 2013, at 3:53 PM, William Dunlap wdun...@tibco.com wrote:

 Ctrl-K is delete from here to end of line on Linux-comand-line and 
 Windows-GUI R.
 (My fingers are not nimble enough for emacs, I'll stick with vi.)
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
 -Original Message-
 From: Brian Lee Yung Rowe [mailto:r...@muxspace.com]
 Sent: Friday, July 05, 2013 12:11 PM
 To: William Dunlap
 Cc: peter dalgaard; R-devel; Barry Rowlingson
 Subject: Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?
 
 Here are two more standard emacs bindings that work:  Ctrl-K to cut and 
 Ctrl-Y to paste.
 
 •
 Brian Lee Yung Rowe
 917 496 4583
 
 
 On Jul 5, 2013, at 2:32 PM, William Dunlap wdun...@tibco.com wrote:
 
 But up-arrow, ctrl-A then z - is not much less convenient, is it?
 
 I didn't know that ctrl-A would bring me to the start of the line, nor
 that ctrl-E would bring me to the end.  Thanks.
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
 -Original Message-
 From: peter dalgaard [mailto:pda...@gmail.com]
 Sent: Friday, July 05, 2013 11:25 AM
 To: William Dunlap
 Cc: Barry Rowlingson; R-devel
 Subject: Re: [Rd] should the text for RIGHT_ASSIGN be - in getParseData()?
 
 
 On Jul 5, 2013, at 18:59 , William Dunlap wrote:
 
 Is there any reason right-assign with - still exists? How much
 code on CRAN uses it, and how trivially could it be excised?
 
 I use '-' a lot when doing interactive work.  I often first run a command
 to see its printed output then decide that I had better save its value.
 The up-arrow key gives me the previous command line with the cursor 
 placed at the
 end of the line so adding '- z' at the end of the line is convenient.
 (Not using the up-arrow key and doing 'z - .Last.value' also works, but
 I don't like its context sensitivity.)
 
 But up-arrow, ctrl-A then z - is not much less convenient, is it?
 
 I have used in with multi-line input, occasionally, though. As in
 
 replicate(1, {
  ysim - rbinom(length(p), n, p)
  glm(cbind(ysim, n - ysim) ~ x, binomial)$deviance
 })
 
 ... and then you realize that you probably don't want to look at 1 
 simulated
 deviances and add - simDev.
 
 
 I never use '-' when writing code in a file, so you would have to search
 my .Rhistory files, not my *.R files, for evidence of its usefulness to 
 me.
 
 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com
 
 
 -Original Message-
 From: r-devel-boun...@r-project.org 
 [mailto:r-devel-boun...@r-project.org] On
 Behalf
 Of Barry Rowlingson
 Sent: Friday, July 05, 2013 9:29 AM
 To: Duncan Murdoch
 Cc: R-devel
 Subject: Re: [Rd] should the text for RIGHT_ASSIGN be - in 
 getParseData()?
 
 On Fri, Jul 5, 2013 at 12:57 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:
 
 R itself doesn't make use of the text column, it's for display of code
 by highlighters etc.  So if anyone does assume text is a function name,
 it's their bug, not ours.  In fact, the bug is already there, because
 there is actually one other example which was being parsed properly,
 ** is translated to ^.  There's no `**` function, but 2**3 works.
 
 Is there any reason right-assign with - still exists? How much
 code on CRAN uses it, and how trivially could it be excised? Can we
 also have 'up assign'  and down assign so I can do:
 
  3
 x -^
 x -v
  4
 
 - they make just as much sense.
 
 Okay, lets see all the edge cases.
 
 Barry
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 --
 Peter Dalgaard, Professor,
 Center for Statistics, Copenhagen Business School
 Solbjerg Plads 3, 2000 Frederiksberg, Denmark
 Phone: (+45)38153501
 Email: pd@cbs.dk  Priv: pda...@gmail.com
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] Patch proposal for R style consistency (concerning deparse.c)

2013-05-02 Thread Brian Lee Yung Rowe
Writing R in a declarative style a la functional programming makes this whole 
thread go away since you don't need if/else blocks. 

•
Brian Lee Yung Rowe


On May 2, 2013, at 8:27 AM, Terry Therneau thern...@mayo.edu wrote:

 I'll be the anybody to argue that
 }  else {
 is an ugly kludge which you will never find in my source code.  Yes, it's 
 necessary at the command line because the parser needs help in guessing when 
 an expression is finished, but is only needed in that case.  Since I can 
 hardly imagine using else at the command line (that many correct characters 
 in a row exceeds my typing skill) it's not an issue for me.  I most certainly 
 would not inflict this construction on my pupils when teaching a class, nor 
 that any break of a long line has to be after + but not before, nor other 
 crutches for the parser's sake.  Let them know about the special case of 
 course, but don't sacrifice good coding style the deficiency.
 
 That said, I am completely ambivalent to the result of deparse.  Just 
 throwing up an objection to the purity argument: things were beginning to 
 sound a bit too bombastic :-).
 
 Terry T.
 
 On 05/02/2013 05:00 AM, r-devel-requ...@r-project.org wrote:
  I want } else {.  Yihue wants } else {.  And I have not heard anybody
 say they prefer the other way, unless you interpret Duncan's comment
 that's nonsense as a blanket defense of the status quo. But I don't think
 he meant that.  This is a matter of style consistency and avoidance of new
 R-user confusion and error.
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] Suppress specific warnings

2013-04-18 Thread Brian Lee Yung Rowe
For my logging package (futile.logger) any log statements coming from a package 
are assigned to a package namespace. This way you have control of log messages 
at a package level (e.g. I can set the default log threshold to DEBUG, while 
package 'A' has a log threshold of WARN). 

I seems a hierarchical namespace facility would work for the below case as 
well. 


On Apr 18, 2013, at 9:29 AM, Martin Morgan mtmor...@fhcrc.org wrote:

 To suppress just this one, try this:
 
 withCallingHandlers(x + 1:3,
warning=function(w) {
   if (grepl(longer object length, w$message))
  invokeRestart(muffleWarning)
} )
 
 ...which are then caught as
 
  withCallingHandlers({
  warning(w)   # 'curves'; caught
  warning(another warning)
  }, curves=function(w) invokeRestart(muffleWarning))
 
 The tricky part is to come up with an appropriate scheme for classifying 
 warnings.

•
Brian Lee Yung Rowe
917 496 4583

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


Re: [Rd] Regression stars

2013-02-12 Thread Brian Lee Yung Rowe

I thought that the default was the way it was for performance reasons. For 
large data.frames or repeated applications, using factors should be faster for 
non-trivial strings.

 fs - c('apple','peach','watermelon','spinach','persimmon','potato','kale')
 n - 100

 a1 - data.frame(f=sample(fs,n,replace=TRUE), x1=rnorm(n), x2=rnorm(n), 
 stringsAsFactors=TRUE)
 a2 - data.frame(f=sample(fs,n,replace=TRUE), x1=rnorm(n), x2=rnorm(n), 
 stringsAsFactors=FALSE)

 fn - function(i,x) x[x$f %in% c('kale','spinach'),]
 system.time(z - sapply(1:100, fn, a1))
   user  system elapsed 
 19.614   4.037  24.649 
 system.time(z - sapply(1:100, fn, a2))
   user  system elapsed 
 19.726   7.715  36.761 


On Feb 12, 2013, at 10:40 AM, Ben Bolker bbol...@gmail.com wrote:
 
  Thanks, Uwe.
  Now let me go one step farther.
 
  Can you (or anyone) give a good argument **other than backward
 compatibility** for keeping the stringAsFactors=TRUE argument on
 data.frame()?
 
  I appreciate your distinction between data.frame() and read.table()'s
 use of stringAsFactors, and I can see that there is some point for
 quick-and-dirty interactive use in setting all non-numeric variables to
 factors (arguing that wanting non-numerics as factors is somewhat more
 common than wanting them as strings).
 
  It might be nice to add an optional stringsAsFactors (and check.names)
 argument to transform(): I've had to write my own Transform() function
 to allow the defaults to be overridden, since transform() calls
 data.frame() with the defaults.  (Setting the stringsAsFactors option
 globally would work, although not for check.names.)
 
  Ben BOlker
 
 
 
 What I will likely do is
 make a few changes so that character vectors are automatically changed
 to factors in modelling functions, so that operating with
 stringsAsFactors=FALSE doesn't trigger silly warnings.
 
 Duncan Murdoch
 
 
  [apologies for snipping context: gmane made me do it]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] Contract Syntactic Sugar

2013-02-04 Thread Brian Lee Yung Rowe
Ivo, 

You might be interested in my lambda.r package which provides syntax (using the 
%::% operator) for type constraints. Given a function with n arguments, the 
type constraint requires n + 1 types, as the last type listed is the return 
type. Lambda.r also provides syntax for specifying any arbitrary condition on 
the input arguments via the %when% operator. For your example below you could 
do the following:

exponentiate(x, exponent) %::% data.frame : numeric : numeric
exponentiate(x, exponent) %when% {
  is.positive(x)
} %as% {
  x$base ^ exponent 
}

You can see more examples in the package (available on CRAN) or in the source 
(https://github.com/muxspace/lambda.r).

HTH,
Brian


On Feb 4, 2013, at 4:53 PM, ivo welch ivo.we...@anderson.ucla.edu wrote:

 ## the following is a dream: add some sugar syntax to allow for
 contracts with teeth (in and out checking)
 
 is.positive - function(x) (all(x0))
 
 exponentiate - function( x ::is.data.frame , exponent ::is.numeric 
 is.positive)  :: is.vector is.numeric  {
x$base :: is.positive## error also if base does not exist
 in x; may need some special IQ
x$base^exponent
 }
 
 should be self-explanatory.  anything that has '::' means run what is
 before through all the functions after and barf if it is not true.
 any other operator rather than :: or other syntax would be as
 good---this is just illustratory.  in the end, this code should be
 viewed by R as the same as
 
 exponentiate - function( x, exponent ) {
stopifnot( is.data.frame(x) )
stopifnot( is.numeric(exponent) )
stopifnot( is.positive(exponent) )
stopifnot( exists(base, x) )
stopifnot( is.positive( x$base ) )
return.value - x$base^exponent
stopifnot( is.vector(return.value) )
stopifnot( is.numeric(return.value) )
return.value
 }
 
 is this a feasible summer project for a student with a prospect of
 inclusion of the completed code in the R core language itself if I pay
 for the development time?  {or does better syntax already exist and I
 am just ignorant (which I often am)?}
 
 regards,
 
 /iaw
 
 Ivo Welch (ivo.we...@gmail.com)
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [Rd] Contract Syntactic Sugar

2013-02-04 Thread Brian Lee Yung Rowe
Ivo,

If you don't like the multipart function syntax you can write a single 
definition. Personally I prefer this as it isolates data management logic and 
control flow from model/application logic. There are duck typing operators that 
you can use in the guard similar to the syntax you wrote. You can also create 
your own types and use that in a type constraint. However the type constraint 
syntax must be a distinct statement although you could embed it all within a 
guard. Here are three different approaches using lambda.r. 

NaturalNumber(x) %when% {
  all(is.positive(x))
} %as% { x }

# Using an explicit type constraint with a custom type
exponentiate(x, exponent) %::% data.frame : NaturalNumber : integer 
exponentiate(x, exponent) %when% {
  x %hasa% base
} %as% { x$base ^ exponent }

 -- or --

# Embedding everything in a guard
exponentiate(x, exponent) %when% {
  x %hasa% base
  x %isa% NaturalNumber
} %as% { x$base ^ exponent }

 -- or --

# Eschewing a custom type for explicit statements
exponentiate(x, exponent) %when% {
  x %hasa% base
  all(is.positive(x$base))
} %as% { x$base ^ exponent 

Warm Regards,
Brian

•
Brian Lee Yung Rowe
917 496 4583


On Feb 4, 2013, at 6:23 PM, ivo welch ivo.we...@gmail.com wrote:

 hi brian---interesting and very impressive.  is it possible to move
 everything into one definition and/or to chain multiple conditions?
 
 exponentiate(x, exponent) %::% data.frame : c(numeric,allpositive) :
 integer  %as% {
  x %has% base  ## my invention, since this is not checked, and R is
 not strict enough
  x$base %::% allpositive
  x$base ^ exponent
 }
 
 multiple creations as in your doc examples on the same function are a
 recipe for errors for me.  it's also why I am not too fond of
 TypeInfo.  chaining conditions in my c() is not important, as long as
 I can define my own types (which can check multiple aspects at the
 same time).  suggestion: in your doc example, can you define a
 different type than an integer?  it's a little confusing.  how about
 defining a strictly positive integer?
 
 regards,
 
 /iaw
 
 Ivo Welch (ivo.we...@gmail.com)
 http://www.ivo-welch.info/
 J. Fred Weston Professor of Finance
 Anderson School at UCLA, C519
 Director, UCLA Anderson Fink Center for Finance and Investments
 Free Finance Textbook, http://book.ivo-welch.info/
 Editor, Critical Finance Review, http://www.critical-finance-review.org/
 
 
 
 On Mon, Feb 4, 2013 at 2:10 PM, Brian Lee Yung Rowe r...@muxspace.com wrote:
 Ivo,
 
 You might be interested in my lambda.r package which provides syntax (using 
 the %::% operator) for type constraints. Given a function with n arguments, 
 the type constraint requires n + 1 types, as the last type listed is the 
 return type. Lambda.r also provides syntax for specifying any arbitrary 
 condition on the input arguments via the %when% operator. For your example 
 below you could do the following:
 
 exponentiate(x, exponent) %::% data.frame : numeric : numeric
 exponentiate(x, exponent) %when% {
  is.positive(x)
 } %as% {
  x$base ^ exponent
 }
 
 You can see more examples in the package (available on CRAN) or in the 
 source (https://github.com/muxspace/lambda.r).
 
 HTH,
 Brian
 
 
 On Feb 4, 2013, at 4:53 PM, ivo welch ivo.we...@anderson.ucla.edu wrote:
 
 ## the following is a dream: add some sugar syntax to allow for
 contracts with teeth (in and out checking)
 
 is.positive - function(x) (all(x0))
 
 exponentiate - function( x ::is.data.frame , exponent ::is.numeric 
 is.positive)  :: is.vector is.numeric  {
   x$base :: is.positive## error also if base does not exist
 in x; may need some special IQ
   x$base^exponent
 }
 
 should be self-explanatory.  anything that has '::' means run what is
 before through all the functions after and barf if it is not true.
 any other operator rather than :: or other syntax would be as
 good---this is just illustratory.  in the end, this code should be
 viewed by R as the same as
 
 exponentiate - function( x, exponent ) {
   stopifnot( is.data.frame(x) )
   stopifnot( is.numeric(exponent) )
   stopifnot( is.positive(exponent) )
   stopifnot( exists(base, x) )
   stopifnot( is.positive( x$base ) )
   return.value - x$base^exponent
   stopifnot( is.vector(return.value) )
   stopifnot( is.numeric(return.value) )
   return.value
 }
 
 is this a feasible summer project for a student with a prospect of
 inclusion of the completed code in the R core language itself if I pay
 for the development time?  {or does better syntax already exist and I
 am just ignorant (which I often am)?}
 
 regards,
 
 /iaw
 
 Ivo Welch (ivo.we...@gmail.com)
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 

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


Re: [Rd] Who does develop the R core and libs, and how / where is it hosted?

2013-01-14 Thread Brian Lee Yung Rowe

On Jan 14, 2013, at 6:32 PM, oliver oli...@first.in-berlin.de wrote:

 BTW: I looked up the string wish list in some of the mentioned docs 
 (mentioned in this thread)
 but did not found it.
 Can you please point me to it directly?
 Googling for R wish list brings me links to a producer of toys.
 
 Or did you mean I should ask R users for their wishes??!
 
 (Some R users - on this list - asked for Julia language as a speedup 
 alternative for R a while ago…)

Is this what you're looking for: http://developer.r-project.org/ (see TODO 
lists)


 All in all it seems like no special things need to be done.
 The FSF for example has a page where they ask for support in certain areas,
 so, this looks rather urgent.
 R seems not to have such urgent needs for support

How about cleaning up some of the documentation/wiki pages?


[[alternative HTML version deleted]]

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


Re: [Rd] Issue with getParserData in R3.0.0

2013-01-14 Thread Brian Lee Yung Rowe
Thanks that seems to work. It looks like other packages explicitly change this 
to FALSE, so I have to set this to TRUE for each function call. Is there any 
particular policy for packages that update this option? Should I restore the 
original value upon function exit?

Warm Regards,
Brian


On Jan 14, 2013, at 9:34 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 13-01-13 8:43 PM, Brian Lee Yung Rowe wrote: Hello,
 
  I am migrating my package lambda.r to R3.0.0 and am experiencing some 
  issues with the getParserData function (which replaces the parser package). 
  Basically the function works in the R shell but fails when either called 
  from RUnit or from R CMD check.
 
  I've narrowed it down to the function getSrcfile, which is returning 
  different values depending on the code path. From the command line (works 
  okay):
 
  debug: srcfile - getSrcfile(x)
  Browse[2]
  debug: if (is.null(srcfile)) return(NULL) else data - srcfile$parseData
  Browse[2] srcfile
  text
 
  When running from the Runit script I get this instead:
  debug: srcfile - getSrcfile(x)
  Browse[3]
  debug: if (is.null(srcfile)) return(NULL) else data - srcfile$parseData
  Browse[3] srcfile
  NULL
 
 
  Below is an example calling the getParserData from the command line:
  text - abs_max(a, b) %::% numeric:numeric:numeric
  parse(text=text)
  expression(abs_max(a, b) %::% numeric:numeric:numeric)
  getParseData(parse(text=text))
  line1 col1 line2 col2 id parenttoken terminaltext
  27 11 1   42 27  0 exprFALSE
  14 11 1   13 14 27 exprFALSE
  1  11 17  1  3 SYMBOL_FUNCTION_CALL TRUE abs_max
  3  11 17  3 14 exprFALSE
  2  18 18  2 14  '(' TRUE   (
  4  19 19  4  6   SYMBOL TRUE   a
  ...
 
  The RUnit call from the command line is
  runTestFile('/home/brian/workspace/lambda.r/inst/unitTests/runit.dispatching.4.R')
 
  and fails because of the NULL value of srcfile. The first line of the runit 
  test file is
 abs_max(a, b) %::% numeric:numeric:numeric
 
  Any insights are appreciated.
 
 I think in the case that is failing you just don't have any source info in 
 the parse.  parse() only installs it if the keep.source option is TRUE, and 
 the default for that is the result of interactive().  So when you are not 
 interactive you don't get source info.
 
 You can fix it by explicitly setting options(keep.source=TRUE).
 
 Duncan Murdoch
 

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


Re: [Rd] Who does develop the R core and libs, and how / where is it hosted?

2013-01-14 Thread Brian Lee Yung Rowe
Maybe the master Bugzilla is what you are looking for instead: 
  https://bugs.r-project.org/bugzilla3/buglist.cgi?quicksearch=wishlist


On Jan 14, 2013, at 7:55 PM, Oliver Bandel oli...@first.in-berlin.de wrote:

 
 
 Am 15.01.2013 um 01:11 schrieb Brian Lee Yung Rowe r...@muxspace.com:
 
 
 On Jan 14, 2013, at 6:32 PM, oliver oli...@first.in-berlin.de wrote:
 
 BTW: I looked up the string wish list in some of the mentioned docs 
 (mentioned in this thread)
 but did not found it.
 Can you please point me to it directly?
 Googling for R wish list brings me links to a producer of toys.
 
 Or did you mean I should ask R users for their wishes??!
 
 (Some R users - on this list - asked for Julia language as a speedup 
 alternative for R a while ago…)
 
 Is this what you're looking for: http://developer.r-project.org/ (see TODO 
 lists)
 
 Ah, yes,there are TODO lists, thanks.
 
 This is at least some kind of thing yi was looking for.
 But these are personell TODO lists.
 Are their any goals for R as whole project?
 
 
 
 
 
 All in all it seems like no special things need to be done.
 The FSF for example has a page where they ask for support in certain areas,
 so, this looks rather urgent.
 R seems not to have such urgent needs for support
 
 How about cleaning up some of the documentation/wiki pages?
 
 I'm not a friend of seperating design, coding, documentation, ...
 
 IMHO this should be something that is not seperated.
 And I also think, that the way, R packages will be written
 (code as well as documentation together) uses the same
 kind of philosophy.
 I was very happy about this close relation between code and
 documentation,mthat is necessary to wrte a package.
 
 I thought the same holds true for R project as a whole.
 So I maybe was wrong with this assumption.
 
 Ciao,
Olver
 


[[alternative HTML version deleted]]

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