similar to: Recall for parent

Displaying 20 results from an estimated 1000 matches similar to: "Recall for parent"

2005 Nov 12
2
sibling list element reference during list definition
Can the value of a list element be referenced from a sibling list element during list creation without the use of a temporary variable? The following doesn't work but it's the general idea. > list(value = 2, plusplus = $value+1) such that the following would be the output from str() List of 2 $ value : num 2 $ plusplus: num 3
2006 May 03
3
sprintf question
How would one go about getting sprintf to use the values of a vector without having to specify each argument individually? > v <- c(1, 2, -1.197114, 0.1596687) > iv <- c(3, 1, 2, 4) > sprintf("%9.2f\t%d\t%d\t%8.3f", v[3], v[1], v[2], v[4]) [1] " -1.20\t1\t2\t 0.160" Essentially, desired effect would be something like: >
2005 Nov 14
1
Package manpage DCF hooks
Was looking at what was output for <pkgname>-package.Rd and wondered if any there was any means (via macro, etc) to merge some of the same information with a template for my package manpage? As much (all?) of the generated information was already provided in the DESCRIPTION, I'd prefer not to have to update the information in multiple places. I'm thinking here that I could provide a
2006 Apr 06
1
Indexing With List Of Vectors (Replacement)
I have the following: > a <- matrix(1:10, nrow = 2, byrow = TRUE) > b <- array(as.integer(0), c(7, 5)) > idx <- list() > length(idx) <- 2 > dim(idx) <- c(1, 2) > idx[[1]] <- as.integer(1:2) > idx[[2]] <- as.integer(1:5) I can do the following, which works if 'b' is a matrix. > b[idx[[1]], idx[[2]]] <- a > b [,1] [,2] [,3] [,4] [,5]
2006 Apr 12
1
S4 method dispatch matrixOrArray
I have some code where the primary dispatching is on other parameters so I'd like not to have to create a set of functions for "matrix" and another duplicate set for "array". But the class union technique isn't working as implemented below and I don't have my Green book with me. How do I fix my infinite recursion problem?
2006 Feb 08
1
invalid graphics state using dev.print (fwd)
On Mon, 6 Feb 2006 18:12, Simon Urbanek wrote: > On Feb 6, 2006, at 5:24 PM, Paul Roebuck wrote: > >> Tried on R-Sig-Mac with no responses, but I need some kind >> of answer. >> [...] >> Does the following work on your system? > > Interesting, no, it doesn't either. For png and pdf I use > Quartz + quartz.save (it produces much nicer results) so > I
2006 May 09
1
YA S4 method dispatch question
I recently encountered this and was wondering if someone could explain what happened. Basis of question involves what the difference between the calls makes as the end result is the same: > identical(matrix(1:8, nrow = 1), array(1:8, c(1, 8))) TRUE If I run the code below as shown, I get the following: > foo(1:8, 4) foo (vector, numeric) val = 4 foo (matrix, ANY) val = 500 foo
2006 Apr 13
2
[R] S4 method dispatch matrixOrArray (fwd)
What a delicious example! (I'm taking the liberty of sharing it with r-devel, since it raises some good issues.) You have two questions, presumably: 1 - how could the order of the setMethod calls make a difference in the results? 2 - what's causing the infinite loop & how could it be avoided, reliably? Second question first. The danger sign is the "vector" method:
2008 Jun 05
1
doc buglet / as.Date method
Under Details section for as.Date: as.Date will accept numeric data (the number of days since an epoch), but only is origin is supplied. ^^ should be "if" R version 2.7.0 Patched (2008-06-04 r45830) ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
2004 Sep 15
7
Splitting vector into individual elements
Is there a means to split a vector into its individual elements without going the brute-force route for arguments to a predefined function call? offred.rgb <- c(1, 0, 0) * 0.60; ## Brute force style offred.col <- rgb(offred.rgb[1], offred.rgb[2], offred.rgb[3], names = "offred") ## Desired style
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
I'm attempting to reflect the information for use with corresponding fields in GUI (in a different package), to provide default values, argname as key for UI label lookups, etc. So I want something much more like the formals of the implementation: { "object", "method": c("median", "vs", "tukey"),
2005 Feb 14
2
Test Tools
Anyone aware of tools available that can provide complexity metrics and/or code coverage analysis for R source? ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
2006 Oct 27
1
Overloading functions
Hi Everyone I have a function f which does something using a function g. Function f is in a library and g has a default stub in the library but will be mainly overloaded in a later R script. For example: ########## In a compiled package 'P' ################# g <- function() { cat("Original function g"); } f <- function( newGsource=NULL ) { if(
2006 Feb 21
4
simple C function segfaults
Hello, I use the simplest of examples that somebody can think of in order to generate a matrix of random numbers from within C, calling appropriate R functions. The concrete example is below: --- file pico.c #include <stdio.h> #include <stdlib.h> #include <math.h> #include <R.h> #include <Rmath.h> #define COLM( i, j, m ) ( m*j + i) void pico ( double *y, int n,
2004 Jul 12
2
.Platform addition (was Re: where does R search when source()?)
On Sun, 11 Jul 2004, Gabor Grothendieck wrote: > search.path <- > function(fn, > paths = strsplit(Sys.getenv("PATH"), split = ";")[[1]], > fsep = "\\") { > for(d in paths) { > f <- file.path(d, fn, fsep = fsep) > if (file.exists(f)) > return(f) > } > return(NULL) > } >
2004 Dec 31
4
install.packages() for local source file
Wish to install a local source package on Un*x platform from within R. Same thing as I can accomplish from cmdline as $ export R_LIBS=~/R/library $ cd /path/to/pkg $ R CMD INSTALL -l $R_LIBS <pkgname> So, how do you go about this anyway? And isn't this a bug in 'install.packages'? ------- $ R R : Copyright 2004, The R Foundation for Statistical Computing Version 1.9.0
2004 Sep 28
2
S4 method selection based on second argument
I'm translating some Matlab code and need some help figuring out how to change this call into an S4 generic method. In matlab, there's a function called 'repmat' with three calling sequences (all I have to deal with anyway): 1) B = repmat(A, m, n) 2) B = repmat(A, [m n]) 3) B = repmat(A, n) In all cases, A is the fill value, m is number of rows, and n is number of
2004 Aug 25
2
[Q] Apply Function Over Multiple Array Margins
Is there a canonical means to apply a function over multiple arrays simultaneously? For example, if I wanted to plot each line with a different color? Or is a for loop conversion my best option? x <- seq(0, 8, by = 2) y <- matrix(1:15, nrow = 5, byrow = TRUE) my.colors <- heat.colors(3) drawLines <- function(row) { lines(x, row) # want corresponding 'my.colors' here }
2005 May 18
2
R Include File Guards
R 2.1.0/src/include from 2005/04/18 download Naming inconsistent for guards as well but that's pedantic. Simple convention: file <foo.h> #ifndef R_FOO_H file <R_ext/bar.h> #ifndef R_EXT_BAR_H Missing guards: <IOStuff.h> <Internal.h> <Parse.h> <R_ext/GraphicsBase.h> <R_ext/GraphicsDevice.h> <R_ext/GraphicsEngine.h>
2005 Jul 19
2
R_AllocatePtr
Had been looking into Luke Tierney's R_AllocatePtr() and was left with a question about exactly when does R reclaim heap memory. Implication of 'simpleref.nw' is that one can allocate C data on the R heap, and as long as pointer object is alive, the data and pointer will remain valid. But it calls allocString() which is implemented using R_alloc(). 'Writing R Extensions" says