similar to: difficulties with "setMethod"

Displaying 20 results from an estimated 700 matches similar to: "difficulties with "setMethod""

2010 Mar 12
4
Getting multiple matrix-values using a single command
Dear all! I'm trying to get multiple values from a matrix by using a single command. Given a matrix A A <- matrix(seq(1,9),nrow=3,ncol=3) How can I get e.g. the values A[1,2] = 4 and A[3,3] = 9 with a single command and without using any loop? My first idea was to generate a row- and a column vector for the indices, i.e. c(1,3) indicating row number 1 (for A[1,2]) and row number
2009 May 21
3
[LLVMdev] Passing a pointer to a function
I recently began hacking around with my first LLVM pass. The big picture is that I would like to insert function calls for each instruction type, and pass some parameters based on the instruction type. Then I will link the output to some C file that implements those functions. Things were going well until I started trying to make function calls with a pointer as a parameter. For example, I would
2011 Apr 15
1
no solution yet, please help: extract p-value from mixed model in kinship package
I am making the question clear. Please help. > Dear R experts > > I was using kinship package to fit mixed model with kinship matrix. > The package looks like lme4, but I could find a way to extract p-value > out of it. I need to extract is as I need to analyse large number of > variables (> 10000). > > Please help me: > > require(kinship) > > #Generating
2011 Mar 15
1
Problem with nls.lm function of minpack.lm package.
Dear R useRs, I have a problem with nls.lm function of minpackl.lm package. I need to fit the Van Genuchten Model to a set of data of Theta and hydraulic conductivity with nls.lm function of minpack.lm package. For the first fit, the parameter estimates keep changing even after 1000 iterations (Th) and I have a following error message for fit of hydraulic conductivity (k); Reason for
2001 Apr 30
2
plotting an expression
I am sure it is just me not understanding how R works, but could somebody explain why curve(cos(x)) works and curve(expression(cos(x)) does not? I have done some investigating and here is what I found. If I comment out the line of curve indicated below, both calls work fine. function (expr, from, to, n = 101, add = FALSE, type = "l", ylab = NULL, log = NULL, xlim =
2009 Dec 15
2
split.data.frame
Hello, I very much enjoy "with" and "subset" semantics for data frames and was wondering if we could have something similar with split, basically by evaluating the second argument "with" the data frame : split.data.frame function(x, f, drop = FALSE, ...){ call <- match.call( ) fcall <- call( "with", data = call[["x"]],
2014 Jun 16
1
model.frame and parent environment
Someone has reported a problem with predict.coxph that I can't seem to solve. The underlying issue is with model.frame.coxph; the same issue is also found in lm so I'll use that for the example. -------------------------- > test <- data.frame(y = 1:10 + runif(10), x=1:10) > myfun <- function(formula, nd) { fit <- lm(formula, data=nd, model=FALSE)
2008 Mar 14
3
write function (PR#10953)
Full_Name: Alexander Yephremov Version: R 2.6.2 GUI 1.23 (4932) (4932) OS: Mac OS X 10.4 Submission from: (NULL) (193.174.239.91) Hi! > array <- 0*1:50 > array [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > write(array, "array.file", sep=",") This is how array.file looks: 0,0,0,0,0 0,0,0,0,0 0,0,0,0,0
2006 Jan 30
2
yet another vectorization question
Dear R-helpers, I'm trying to develop a function which specifies all possible expressions that can be formed using a certain number of variables. For example, with three variables A, B and C we can have - presence/absence of A; B and C - presence/absence of combinations of two of them - presence/absence of all three A B C 1 0 2 1 3 0 4 1 5 0 6 1
2006 Jul 24
5
change the name of file
Dear R Users, Is it possible to make file names dependent on a changing variable? For instance. I generate random numbers in a loop and at each iteration I want data to write to file (I do not want to write everything in one file using 'append'): for (i in 1:50){ x<-matrix(runif(100, min=0,max=1),nrow=5,ncol=20) Write(t(x),file="Data_i.txt",ncolumns=5,sep="\t") }
2005 Dec 15
1
millions of comparisons, speed wanted
Dear all, I have a 10 columns matrix which has 2^10=1024 unique rows, with values 0 and 1. What I would like to do is a little complicated; in a simple statement, for a subset (say 1000 rows) I want to perform pairwise comparisons between all rows, find out which rows differ by only one value, replace that value by "x", get rid of the comparisons that differ by more than one value
2006 Jul 04
1
[Fwd: formatting using the write statement]
>I have a series of write statements because >i am writing to a file >where the characters strings are the column names of a dataframe >and the numbers are the elements in a particular row. >So, a file might look like > >AAA 2.1 >BB 3.1 >AHLZ 0.2 > >and it would be named "rowname".mls. > >so, each time i get to a new row, i create a new file and
2011 Apr 29
3
How to define specially nested functions
Dear All, I would like to define a function: f(x,y,z) with three arguments x,y,z, such that: given values for x,y, f(x,y,z) is still a function of z and that I am still allowed to find the root in terms of z when x,y are given. For example: f(x,y,z) = x+y + (x^2-z), given x=1,y=3, f(1,3,z)= 1+3+1-z is a function of z, and then I can use R to find the root z=5. Thank you. -Chee [[alternative
2009 Apr 25
2
Extracting an object name?
Dear Sir or Madam: This is an extension to a earlier post, about looping through several thousand files, and testing student's models against a different data-set, called rclnow, for "recall now". The problem is, that the instructor never specified to the students, what they should name their "lm" object. So what they created was: "arbitrary variable name"
2006 Dec 18
2
write() gotcha
Hi I used write() the other day to save some results. It seems that write() does not record the full precision of the objects being written: > write(pi,file="~/f",ncolumns=1) > pi.saved <- scan("~/f") Read 1 item > dput(pi) 3.14159265358979 > dput(pi.saved) 3.141593 > pi-pi.saved [1] -3.464102e-07 > This difficulty was particularly difficult to
2009 Jul 21
3
writte file doubt
Hi I wrotte this function but when I get the "tmp.xls" file it shows data in a rare way. I mean not appears a matrix with 2000 rows and 100 columns. Can anyone help me, guide me? kim<-function(){ tmp<-randz<-matrix(rnorm(200000, mean=0,sd=0.01 ),2000,100); dim(tmp) write(tmp,file="tmp.xls") Thanks in advance. On the other hand, everytime I execute a function
2011 Sep 20
2
Is it possible to pass a function argument from R to compiled code in C?
I have a function in R that takes another function as argument: f <- function(g, ...) { #g is expected to be a function } I want to see if there is a way to implement "f" in C and calling it from R using ".C" interface. I know that I can use function pointers for my C implementation, but I imagine it's going to be nearly impossible to pass a function from R to C. Are
2010 Jul 07
2
how to define method for "+" function in a new class
Dear R developers, I have a new class, which I called "Molecule", and have tried to define = a "+" operation for 2 objects of this class. This is what I have written so far, although the method is not complete = (I'm trying to look at it at intermediate stages): setMethod( f=3D"+", signature(x=3D"Molecule",y=3D"Molecule"),
2011 Apr 18
2
help with eval()
I've narrowed my scope problems with predict.coxph further. Here is a condensed example: fcall3 <- as.formula("time ~ age") dfun3 <- function(dcall) { fit <- lm(dcall, data=lung, model=FALSE) model.frame(fit) } dfun3(fcall3) The final call fails: it can't find 'dcall'. The relevant code in model.frame.lm is: env <- environment(formula$terms)
2018 Jan 06
4
Error occurring in "emmeans" package for the two data sets I used. Please help.
I am a Professor of Statistics at Indira Gandhi Krishi Vishwavidyalaya, Raipur, India. While teaching in class about analysis of variance using R, I was doing a one-way analysis for the two data-sets given below in the R-class. I got a typical error in "emmeans" package, please help: Data-set-1: -------------- Medley and Clements (1998) investigated the impact of zinc contamination (and