similar to: NAMESPACE and tests for unexported functions

Displaying 20 results from an estimated 2000 matches similar to: "NAMESPACE and tests for unexported functions"

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
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
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)
2005 Aug 11
1
Registering S3 class from external package
The package I'm working on can extract data from external packages but would otherwise have no dependency on them. However, I desire to be able to dispatch based on an external S3 class if its package is attached (.First.lib). My code is S4-based and its package has NAMESPACE. Registering the external class prior to the other package being attached doesn't seem to work so I am attempting
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 }
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 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) > } >
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
2004 Jul 06
1
Enumeration in R
I want the equivalent of this 'C' declaration. enum StoplightColor { green = 3, yellow = 5, red = 7 }; This mostly works except the validity checking doesn't seem to occur automatically. What didn't I do to enable it? setClass("stoplightColor", representation(value = "integer"), prototype = integer(1))
2004 Nov 09
1
Need car() and cdr() for '...'
Needed to redefine function "sum" for my MATLAB package. There's something similar in Chambers's Green Book (pg 351) so I modified it as such: library(methods) setGeneric("sum", function(x, ..., na.rm = FALSE) { if (nDotArgs(...) > 0) sum(c(sum(x, na.rm = na.rm), sum(..., na.rm = na.rm))) else standardGeneric("sum") })
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: >
2004 Jul 07
2
Win32 & C code
Hi, I'm trying to get C code working with R. This is my first time writing C on Windows and I'm making a mess of it. Help! I'm following the example in Roger Peng's "An Introduction to the .C interface to R". The C code is: #include <R.h> void hello(int *n){ int i; for(i=0; i < *n; i++) { Rprintf("Hello, world!\n"); } } I seem to be unable
2006 Mar 29
2
Recall for parent
What's the best way to simulate Recall for parent function? Consider this one-time recursive code: alwaysEven <- function(x) { handleOdd <- function(x) { alwaysEven(x-1) # use Recall-like here } return(if (x %% 2) handleOdd(x) else x) } any2even <- alwaysEven rm(alwaysEven) any2even(3) ---------------------------------------------------------- SIGSIG --
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
2004 Jun 22
3
[Q] GET_DIM() crash on Windows only
I have the following contrived code in package format. On Solaris and Mac OS X, code runs just fine. On Windows, it crashes the R environment with the "Send Bug Report" dialog. I tried R 1.8.1 (Win2K) and R 1.9 (WinXP) binaries with the same result. PCs otherwise appear properly configured for creating R packages. Anything blatantly wrong? Suggestions? TIA Relevant files from package