Displaying 20 results from an estimated 30000 matches similar to: "pass-by-reference"
2011 Nov 27
1
Error in Rd[[which]] : subscript out of bounds
I'm getting the following form R CMD CHECK mypackage
-----------
* checking Rd files ... WARNING
Error in Rd[[which]] : subscript out of bounds
problem found in ?myfunction.Rd?
---------
This is... not the most helpful error.
I'd be happy to make a minimal .Rd example file if someone can point me to what a minimal .Rd file has in it.
The file is already pretty minimal, so it's
2011 Jan 28
2
help with S4 objects: trying to use a "link-glm" as a class in an object definition
Hi,
I'm trying to make a new S4 object with a slot for a "link-glm" object. R doesn't like me have a slot of class "link-glm"
> class(make.link("probit"))
[1] "link-glm"
> setClass("a",representation(item="link-glm"))
[1] "a"
Warning message:
undefined slot classes in definition of "a": item(class
2005 Oct 09
3
cor doesn't accept na.rm? (PR#8193)
Full_Name: Paul Bailey
Version: 2.1.1
OS: OS X 10.3
Submission from: (NULL) (68.252.250.144)
?cor
[tells me that it has a na.rm variable]
> cor(frame2[1,],frame2[2,],na.rm=T)
Error in cor(frame2[1, ], frame2[2, ], na.rm = T) :
unused argument(s) (na.rm ...)
hmm.
2011 Jan 26
1
aggregate(as.formula("some formula"), data, function) error when called from in a function
I'm having a problem with aggregate.formula when I call it in a function and the function is converted from a string in the funtion
I think my problem may also only occur when the left hand side of the formula is cbind(...)
Here is example code that generates a dataset and then the error.
The first function "agg2" fails
> agg2(FALSE)
do agg 2
Error in m[[2L]][[2L]] : object
2009 Dec 29
2
pass functions and arguments to function
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
process2(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3 are parameters and of different types. I
would like to pass g1, g2, g3 and their arguments to f and g1,
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
I'm solving 4 complex equations simultaneously. Code is below. The code
returns only zero's for the solution though there should also be a non-zero
result. I'm pretty confident that the equations are correct because they
are straight from a published paper and I checked them pretty thoroughly.
The parameter values I used are from the published paper as well. Any
suggestions for how
2006 Aug 29
2
lattice and several groups
Dear R-list,
I would like to use the lattice library to show several groups on
the same graph. Here's my example :
## the data
f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3"))
f1 <- rep(f1,3)
f2 <-
2009 May 27
3
Defining functions - an interesting problem
I define the following function:
(Please don't wonder about the use of this function, this is just a
simplified version of my actual function. And please don't spend your
time in finding an alternate way of doing the same as the following does
not exactly represent my function. I am only interested in a good
explanation)
> f1 =
2013 Jan 23
1
Arguments passing through dot-dot-dot lose ability to check for missing()?
Hi R-devel. Is the following behavior in g1() and h1() expected? It seems
to make "..." arguments work slightly differently from named arguments.
#missing() has the property that it looks "up the chain"
#for example, "z" can be missing in f3 even if
#that argument did have a name ("y") in f2
f1 <- function(x, ...) {
cat("In f1, missing(x) is
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more
complicated actually with
# three factor levels but these calculations need to
be done on one factor at a
#I then have a set of different rates that are applied
#to it.
#dataset
cata <- c( 1,1,6,1,1,2)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
data1 <- data.frame(cata, catb, doga)
rm(cata,catb,doga)
data1
# start rates
#
2012 Jun 04
1
simulation of modified bartlett's test
Hi, I run this code to get the power of the test for modified bartlett's
test..but I'm not really sure that my coding is right..
#normal distribution unequal variance
asim<-5000
pv<-rep(NA,asim)
for(i in 1:asim)
{print(i)
set.seed(i)
n1<-20
n2<-20
n3<-20
mu<-0
sd1<-sqrt(25)
sd2<-sqrt(50)
sd3<-sqrt(100)
g1<-rnorm(n1,mu,sd1)
g2<-rnorm(n2,mu,sd2)
2011 Dec 10
1
Difficult subset challenge
Hi,
I'm having difficulty coming up with a good way to subest some data to generate statistics.
My data frame has multiple observations by group.
Here is an overly-simplified toy example of the data
==========================
code v1 v2
G1 1.2 2.3
G1 0 2.4
G1 1.4 3.4
G2 2.9 2.3
G2 4.3 4.4
etc..
=========================
I want to normalize the data *by group* for certain variable.
2005 Aug 13
1
How to change the names in tone pitch column
Hi,
I have a column (V4) in a midi event list which includes tone pitch names,
i.e. "A4, E4, C#4, A3...":
> compo[1:10,]
V1 V2 V3 V4 V5 V6 V7
1 1 1 0 A4 96 2 0
2 1 1 0 E4 96 2 0
3 1 1 0 C#4 96 2 0
4 1 1 0 A3 96 2 0
5 1 3 0 B4 96 1 0
6 1 3 0 E4 96 1 0
7 1 3 0 B3 96 1 0
8 1 3 0 G#3 96 1 0
9 1 4 0 C#5 96 1 0
10
2009 May 27
1
How to write a loop?
Dear R helpers,
Following is a R script I am using to run the Fast Fourier Transform. The csv files has 10 columns with titles m1, m2, m3 .....m10.
When I use the following commands, I am getting the required results. The probelm is if there are 100 columns, it is not wise to define 100 commands as fk <- ONS$mk and so on. Thus, I need some guidance to write the loop for the STEP A and
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Evening,
I was writing some code that tried to insert calls to the
llvm.annotation intrinsic function, which has a signature of (i32,
i8*, i8*, i32). The code is below.
void addAnnotation( BasicBlock *block, Function *F)
{
string foo = "foo";
string bar = "barr";
Type *charTy = Type::getInt8Ty(block->getContext());
ArrayType *s1Ty =
2009 Oct 08
1
problem understanding factor levels for use lattice panel order
Hello all,
In order to get the desired order of panels within lattice I realized I needed to define my factor levels.
I now see how to properly do it (attached code), but:
1. I don't understand why I have to use factor() on a variable that is already a factor, and why levels() alone doesn't work to readjust the level order.
2. I just noticed that if I do use levels(xx$v1), it's
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
Andrew Ruef wrote:
> Evening,
>
> I was writing some code that tried to insert calls to the
> llvm.annotation intrinsic function, which has a signature of (i32,
> i8*, i8*, i32). The code is below.
>
> void addAnnotation( BasicBlock *block, Function *F)
> {
> string foo = "foo";
> string bar = "barr";
>
> Type
2007 Apr 24
2
Error in clusterApply(): recursive default argument reference
Hi,
I want to compute a distribution of the intersection of a graph and
'randomized' graphs induced by the permutations of node labels (to
preserve the graph topology).
Since I ll have many permutations to perform, I was thinking of using
the snow package and in particular "parSapply" to divide the work
between my 4 CPUs.
But I get the following error message :
Error in
2013 Mar 21
2
[LLVMdev] How to describe a pointer that points to All memory(include global memory, heap, stack)?
Hi, John
I am building a flow sensitive intra-procedural alias analysis(without interprocedural info).
So, the first thing I have to consider is where a parameter-pointer or a global-pointer might point to.
Then I defined several special Virtual Memory Locations: ALL_MEMORY, GLOBAL_MEMORY, STACK_MEMORY, HEAP_MEMORY. ALL_MEMORY contains GLOBAL_MEMORY, STACK_MEMORY, HEAP_MEMORY.
e.g1:
2009 Sep 18
3
Error: length(f1) == length(f2) is not TRUE
Dear R users,
I am trying to fit an lmer model with only random effects which is giving
me the following error:
Error : length(f1) == length(f2) is not TRUE
In addition: Warning messages:
1: In P1L55:family :
numerical expression has 390 elements: only the first used
2: In P1L55:family :
numerical expression has 390 elements: only the first used
I am trying to extract variance components