Displaying 20 results from an estimated 500 matches similar to: "duplication regression (?)"
2002 Dec 17
3
Changing "..." inside a function: impossible? desirable?
This is was something like a request for your comments, thoughts
on the topic...
Many of you will know that the "..." (aka \dots) argument is
very useful for passing ``further graphical parameters'',
but can be a pain when itself is passed to too many plotting
functions inside your own function.
An artificial example being
myplot <- function(x,y, ...) {
plot(0:1, 0:1,
2009 Jan 03
1
Equivalent of match for data.frame
Dear R-users,
I am translating a S script into R and having some troubles with the
match function. This function appears to work with vector and data.frame
in S, but not in R, e.g.:
a <- rep((1:4), each = 10)
b <- rep((1:10), times = 4)
mydf <- data.frame(a,b)
myarg <- mydf[1,]
match(myarg, mydf)
# S returns 1 but R returns NA NA
I guess one could use match(interaction(myarg),
2010 Jan 15
2
processing all files with certain extension in a directory
Hi all,
I'm trying to process all files with a certain extension "*.ext" in a
directory like this:
> R --slave --args /my/dir < dir_plot.r
where I then I want to do something like:
myarg <- commandArgs()
inputdir <- myarg[length(myarg)]
print(inputdir)
"for file with extension "*.ext in inputdir"
do
data = process.data(file)
outfile =
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 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
2009 Mar 23
4
newton method
Hi R-users,
Does R has a topic on newton's method?
Thank you for the info.
2003 Mar 06
1
Proper way to document print( ) functions
Frequently we have a print method, say print.myclass, that has a variety of arguments. If in the .Rd file I say
\usage{
\method{print}{myclass}(x, myarg)
}
I get a warning when running R CMD chk:
* checking generic/method consistency ... WARNING
print:
function(x, ...)
print.myclass:
function(x, myarg)
What is the proper way to handle this?
Thanks
--
Frank E Harrell Jr
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to
unit test instance variables that are created by actions. It was
more difficult than I expected. It seems like there should have been
a more straight forward way to do this. Can someone enlighten me? A
simplified and somewhat contrived example of what I am current doing:
Thanks.
Matt
>>
# My Controller of interest
2014 Jun 11
1
R CMD check and DESCRIPTION file with Authors@R only
Section 1.1 of R-exts mentions that the Maintainer and Author fields can be
omitted from the DESCRIPTION file if Authors@R is supplied. However, R CMD
check does not seem to like this.
package.skeleton("foo")
desc <- readLines("foo/DESCRIPTION")
desc[6] <- "Authors@R: person('Mathew', 'McLean', email = 'name@example.com',
role =
2002 Nov 21
2
[LLVMdev] DSnode type question
Dear LLVM,
When I use analyze to construct the DSGraph for the lists.c program in
test/Programs/SingleSource/Shootout directory. I found out the heap node
in the function test_list() all have type FOLDED:R. I was wondering why
it's not heapnode anymore? My pass need to use this type information to
determine whether a node is heap node. Is there any way I can know this is
a heap node in this
2002 Dec 02
1
[LLVMdev] DSnode type question
Hi, Chris,
I was wondering if you had a chance to look at this problem. Could
you let me know how to decide if this is a heap node in this case? It's
important because my code depends on this information.
Thanks,
Jerry
On Thu, 21 Nov 2002, Chris Lattner wrote:
> > When I use analyze to construct the DSGraph for the lists.c program in
> > test/Programs/SingleSource/Shootout
2006 May 18
4
WebServices and DateTime - 3 elements of civil date are necessary
I simply trying to receive an array of objects, retrieved by
ActiveRecord from table with datetime column and I have:
test_list(SoapControllerApiTest):
ArgumentError: 3 elements of civil date are necessary
/usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash''
/usr/lib/ruby/1.8/date.rb:1258:in `parse''
....
It''s a bug or I am wrong somewhere?
2005 Dec 20
2
printing/logging during tests
Hi all,
I''m trying to output some info to see what''s happening in a controller
during functional tests.
Problem: ''print'' only works in the test code, but not in the production
code that''s being called by the tests.
Example:
In FooControllerTest:
def test_list
print "1: starting" <<----- WORKS FINE
get
2012 Jan 18
1
use of UTF-8 \uxxxx escape sequences in function arguments
While preparing a function that contained non-ASCII characters for inclusion
into a package, I replaced all non-ASCII characters with UTF-8 escape
sequences (using \uxxxx) in order to make the package portable (and adhere to
"R CMD check"). What I didn't expect: when one uses UTF-8 escape sequences in
function arguments, one needs to use UTF-8 escape sequences when calling the
2010 Feb 28
1
dots for sample
Dear R-Developers,
could 'sample' gain a ... argument?
As a convenience function, I added a sample Method to my hyperSpec
class. This function however has a flag indicating whether the results
should be returned directly as a hyperSpec object or rather as indices
that give a random sample.
For the moment, I use SetGeneric to add the dots argument, but this of
course gives a warning
2010 Sep 06
2
dataframe row names from list
Hi,
I have a list which looks like this...
> str(y)
List of 10
$ : chr [1:4] "ABCD" "5" "0" "1"
$ : chr [1:4] "DEF" "15" "1" "16"
$ : chr [1:4] "AAA" "2" "17" "8"
$ : chr [1:4] "SSS" "15" "25" "1"
$ : chr [1:4] "III"
2009 Apr 17
2
suggestion for R >= 3.0: computer-readable CHANGELOG
Hello,
Here are a few questions that would be useful to get an answer via
dedicated functions in utils or tools packages:
- When did function foo appeared in R or in a given package?
- When did argument myarg appeared in function foo?
- When did function bar get deprecated or when did it disappeared?
- I wrote a script using functions foo and bar with R 1.9.1. My script
does not work any more
2020 Jan 04
1
[patch] add sanity checks to quantile()
On 04/01/2020 4:35 p.m., Scott Kostyshak wrote:
> On Fri, May 31, 2019 at 01:28:55AM -0400, Scott Kostyshak wrote:
>> The attached patch adds some sanity checks to the "type" argument of
...
> Bump. For this type of patch proposal, is it better to use the
> bug tracker?
For almost any patch proposal it is. Certainly if you don't get action
(or at least discussion)
2019 May 31
2
[patch] add sanity checks to quantile()
The attached patch adds some sanity checks to the "type" argument of
quantile(). Output from the following commands show the change of
behavior with the current patch:
vec <- 1:10
quantile(vec, type = c(1, 2))
quantile(vec, type = 10)
quantile(vec, type = "aaa")
quantile(vec, type = NA_real_)
quantile(vec, type = 4.3)
quantile(vec, type = -1)
Current behavior
2014 Jul 09
1
[patch] Rscript off-by-one error in output
Rscript eats up the last argument when reporting the command it runs:
$ Rscript --verbose "/tmp/test.R" one two three
running
'/usr/local/lib/R-devel/lib/R/bin/R --slave --no-restore
--file=/tmp/test.R --args one two'
With the patch below, I get the following:
$ Rscript --verbose "/tmp/test.R" one two three
running
'/usr/local/lib/R-devel/lib/R/bin/R --slave