similar to: Capturing argument values

Displaying 20 results from an estimated 20000 matches similar to: "Capturing argument values"

2006 Oct 03
1
do.call with Vectorial Argument
Dear All, I am trying to use the do.call command to avoid tedious loops in R when I need to call repetitively a function. I am experiencing a problem when the arguments of a function are given with a vector (I need to express then this way to be able later on to integrate them numerically with the adapt package). Consider the small script: remove(list=ls()) #library(adapt) # first a list of the
2017 Jun 06
0
Force argument to have quotes
Harold: As a general rule, if you are using eval(parse(...)) you are doing it poorly in R; cf library("fortunes") fortune(106) Why is something like this not suitable: fun1 <- function(a1,a2,a3 = c("hi","by")) { cat(a3,a1+a2,"\n") } > fun1 (1,2) hi by 3 > fun1(1,2, a3 = "whoopee") whoopee 3 ... or, if you want to include the
2002 Jun 25
1
commandArgs: feature request
Dear R-core Team, As Thomas Lumley pointed out in one of his e-mails one can use commandArgs() to get a copy of the command line arguments supplied when R session was invoked and then use grep to extract parameters of interest. His solution works very well if the custom options are passed by names, e.g. --my-option=value, but what if one wants to pass parameters by their positions. Then it's
2015 Nov 19
2
Re: recovering corrupt file system
well, the next place to go, if fsck isn't enough would be to to try debugfs(1) man debugfs. On Wed, Nov 18, 2015 at 8:39 PM, Boylan, Ross <Ross.Boylan@ucsf.edu> wrote: > I guess some of the trouble was that the virtual disk was mounted > read-only at the VM level. When I mounted read/write I was able to do > fsck, which gave messages about replaying the logs and a couple
2007 Feb 16
1
pinning down symbol values (Scoping/Promises) question
I would like to define a function using symbols, but freeze the symbols at their current values at the time of definition. Both symbols referring to the global scope and symbols referring to arguments are at issue. Consider this (R 2.4.0): > k1 <- 5 > k [1] 100 > a <- function(z) function() z+k > a1 <- a(k1) > k1 <- 2 > k <- 3 > a1() [1] 5 > k <- 10 >
2024 May 10
1
R CMD check vs RStudio check
Ivan, thank you for the tips; they allowed me to move on to the next problems. By building the tar file first and checking it later, and fixing several other problems I got R CMD check to work. It does *not* delete inst/doc. It also does not run boostrap.R, as far as I can tell, presumably because only devtools does. Check within RStudio continues to delete inst/doc, so this behavior is
2005 Jun 04
3
How to change the value of a class slot
I defined an S4 class with a slot i. Then I wrote a regular function that attempted to increment i. This didn't work, apparently because of the general rule that a function can't change the values of its arguments outside the function. I gather there are ways around it, but the Green book admonishes "cheating on the S evaluation model is to be avoided" (p. 190). Thinking that
2006 May 18
3
S4 classes and C
Is there any good source of information on how S4 classes (and methods) work from C? E.g., for reading how to read a slot value how to invoke a method how to test if you have an s4 object For writing, how to make a new instance of an S4 object. I've found scattered hints in the archive, including a link to a talk on this subject "I am using C code to create an S4 object based on
2006 Nov 24
1
Missing values for S4 slots
Using R 2.4, the following fails: setClass("testc", representation(a="ANY")) makeC <- function(myarg) new("testc", a=myarg) makeC() -> Error in initialize(value, ...) : argument "myarg" is missing, with no default On the other hand, this is OK: f <- function(a) g(b=a) g <- function(b) if(missing(b)) "missing" else "valid
2015 Mar 20
1
Re: getting oriented/networking [some success]
I seem to have run into https://bugzilla.redhat.com/show_bug.cgi?id=855640, because when I tried the fix/work-around at the end (comment 11), ethtool -K eth0 gro off, my download speed by speedtest went from undetectable to ~150Mb/s. However, it was not able to connect for the upload test, and so something may still be off. Non-virtual machines can do the upload test, so it's not just a
2006 Nov 15
1
tail recursion in R
Apparently Scheme is clever and can turn certain apparently recursive function calls into into non-recursive evaluations. Does R do anything like that? I could find no reference to it in the language manual. What I'm wondering is whether there are desirable ways to express recursion in R. Thanks. -- Ross Boylan wk: (415) 514-8146 185 Berry St #5700
2010 Jan 15
2
optional package dependency
I have a package that can use rmpi, but works fine without it. None of the automatic test code invokes rmpi functionality. (One test file illustrates how to use it, but has quit() as its first command.) What's the best way to handle this? In particular, what is the appropriate form for upload to CRAN? When I omitted rmpi from the DESCRITPION file R CMD check gave <quote> * checking
2016 Apr 22
2
S4 non-virtual class with no slots?
It seems that if an S4 class has no slots it can't be instantiated because it is assumed to be virtual. Is there a way around this other than adding a do-nothing slot? A singleton would be OK, though is not essential. Problem: EmptyFitResult <- setClass("EmptyFitResult", representation=representation()) # also tried it without the second argument. same result. > e <-
2024 May 03
1
R CMD check vs RStudio check
? Fri, 3 May 2024 19:45:08 +0000 "Boylan, Ross via R-help" <r-help at r-project.org> ?????: > & $R CMD check . > * checking for file './DESCRIPTION' ... ERROR > Required fields missing or empty: > 'Author' 'Maintainer' You're checking a source package directory. This could work, but it's much easier and more reliable to (1) build
2009 Dec 17
5
?setGeneric garbled (PR#14153)
Full_Name: Ross Boylan Version: 2.10.0 OS: Windows XP Submission from: (NULL) (198.144.201.14) Some of the help for setGeneric seems to have been garbled. In the section "Basic Use", 5th paragraph (where the example counts as a single line 3rd paragraph) it says <quote> Note that calling 'setGeneric()' in this form is not strictly necessary before calling
2014 Nov 13
1
Non-webby links on Windows web page
On the Windows download page the second link is "Installation and other instructions" http://cran.cnr.berkeley.edu/bin/windows/base/README.R-3.1.2. Clicking on this gets me a "download or open as" dialogue rather than a page of text. I think something like this happened a few years ago, and the problem was the MIME type of the link. It would be nice to fix. Thanks. Ross
2007 Jun 05
1
ggplot aspect ratio
Is there a way to control the aspect ratio of plots using ggplot? Specifically, I'm using the formula=a~b argument to produce a grid of plots, but the overall width of the result seems to vary for reasons that are obscure to me. This affects not only the appearance of the plots but the amount of space available for the title (which seems to be right justified relative to the right edge of the
2004 Feb 07
2
R does in memory analysis only?
I wonder if someone would confirm something I'm 99% sure of from the docs and discussion on the list, but can't find stated explicitly: R works only on problems that fit into (real or virtual) memory. Thus, even if you have a problem (e.g., simple regression) that could be solved by doing some operation on each row of a dataset at a time, you can't solve it unless the entire dataset
2011 May 26
1
Is it possible to define a function's arguments via a wildcard in 'substitute()'?
Dear List, just out of pure curiosity: is it possible to define a function via 'substitute()' such that the function's formal arguments are specified by a "wildcard" that is substituted when the expression is evaluated? Simple example: x.args <- formals("data.frame") x.body <- expression( out <- myArg + 100, return(out) ) expr <-
2006 Sep 26
3
S4 accessors
I have a small S4 class for which I've written a page grouping many of the accessors and replacement functions together. I would be interested in people comments on the approach I've taken. The code has a couple of decisions for which I could imagine alternatives. First, even simple get/set operations on class elements are wrapped in functions. I suppose I could just use myinstance at