similar to: creating a '[' method for an S4 class

Displaying 20 results from an estimated 1000 matches similar to: "creating a '[' method for an S4 class"

2013 Sep 20
1
Rmpfr question
Hello everyone, R beginner, I am confronted with the need to use Rmpf. In my first scripts I made use of X=read.table(file.choose(), header=FALSE, sep=",",dec=".") X=as.matrix(X) to load into a matrix data from file before matrix use. How can I do to load the same data in a "mpfrMatrix". Is it possible to use with "mpfrMatrix" the same as operations
2012 Feb 18
4
assigning NULL to a list element
Hi everyone, For reasons beyond the scope of this message, I'd like to append a NULL element to the end of a list. tmp0 <- list(a=1, b=NULL, c=3) append(tmp0, c(d=4)) ## works as expected append(tmp0, c(d=NULL)) ## list with a/b/c only Given that I could use tmp0$a <- NULL to remove 'a', I seem to understand why appending NULL returns me the original list... But how should I
2012 Mar 26
2
read.csv and field containing single quotes
I need to read in csv files, created by 3rd party, with fields containing single quotes (as shown below). "header1","header2","header3","header4" "field1r1","field2r1","field3r1","field4r1" "field1r2","field2r2","field3r2PartA), field3r2PartB Very" Long","field4r2"
2012 Mar 09
1
extracting the i-th row of a matrix in a list of lists
Hi, what is the proper of of "passing a missing value" so I can extract the entire i-th row of a matrix (in a list of lists) without pre-computing the number of cols? For example, if I know that the matrices have 2 columns, I can do the following: set.seed(1) x0 <- lapply(1:10, function(i) replicate(4, list(matrix(rnorm(10), nc=2)))) lapply(lapply(x0, '[[', 3), '[',
2018 Oct 26
1
Rmpfr: build vector sequentially -- c(.) not working
I've been asked in private, but am answering in public so others can comment / or find this answer in the future after a web search. This is about the package 'Rmpfr' (R interface to MPFR, the GNU C library for arbitrary precise numbers). > How can you build a vector of mpfr numbers sequentially? > Typically I would do something like the following (and try to > replace the
2012 Mar 11
2
Efficient access to elements of a list of lists
Hi, I have a long list of lists from which I want to efficiently extract and rbind elements. So I'm using the approach below: f <- function(i){ out <- replicate(5, list(matrix(rnorm(80), nc=20))) names(out) <- letters[1:5] out } set.seed(1) lst <- lapply(1:1.5e6, f) (t0 <- system.time(tmp <- do.call(rbind, lapply(lst, '[[', 'b')))) Is there
2016 Sep 10
3
c(<Matrix>, <Matrix>) / help(dotsMethods) etc
I have been asked (by Roger; thank you for the good question, and I hope it's fine to answer to the public) : > with Pi a sparse matrix and x,y, and ones > compatible n-vectors ? when I do: >> c(t(x) %*% Pi %*% ones, t(ones) %*% Pi %*% y ) > [[1]] 1 x 1 Matrix of class "dgeMatrix" > [,1] [1,] > 0.1338527 >
2015 Apr 30
2
R CMD check and missing imports from base packages
On Wed, Apr 29, 2015 at 8:12 PM, Paul Gilbert <pgilbert902 at gmail.com> wrote: > > As I recall, several packages mask the simulate generic in stats, if you > are looking for examples. > FWIW, here is a list of base* functions masked** by CRAN packages: https://github.com/gaborcsardi/rfunctions/blob/master/rfunctions.md Look at the long table in the end. simulate indeed comes up
2019 Jun 03
2
Converting non-32-bit integers from python to R to use bit64: reticulate
Thank you Martin for giving to know and developing 'Rmpfr' library for unlimited size integers (GNU C GMP) and arbitrary precision floats (GNU C MPFR): https://cran.r-project.org/package=Rmpfr My question is: In the long term (For R3.7.0 or R3.8.0): Does it have sense that CMP substitutes INTSXP, and MPFR substitutes REALSXP code? With this we would achieve that an integer is always an
2019 May 30
2
Converting non-32-bit integers from python to R to use bit64: reticulate
Thank you Gabriel for valuable insights on the 64-bit integers topic. In addition, my statement was wrong, as Python3 seems to have unlimited (and variable) size integers. Here is related CPython Code: https://github.com/python/cpython/blob/master/Objects/longobject.c Division between Int-32 and Int-64 seems to only happen in Python2. Best, Juan El mi?rcoles, 29 de mayo de 2019, Gabriel
2010 Oct 16
1
Rmpfr question
Hi: I'm trying to reproduce an arbitrary precision constant from 'Why and How to Use Arbitrary Precision' (Ghazi et al., COMPUTING IN SCIENCE & ENGINEERING May/June 2010; http://perso.ens-lyon.fr/philippe.theveny/cise.pdf): d = 173746a + 94228b ? 78487c where: a = sin(1022), b = log(17.1), and c = exp(0.42). Ghazi et al. report: d = ?1.341818958e?12 whit IEEE-754 quadruple
2010 Jan 19
3
problem with the precision of numbers
Hi All, I was wodering if it is possible to increase the precision using R. I ran the script below in R and MAPLE and I got different results when k is large. Any idea how to fix this problem? thanks for your help for (k in 0:2000){ s=0 for(i in 0:k){ s=s+((-1)^i)*3456*(1+i*1/2000)^3000 } } -- View this message in context:
2016 Aug 15
2
ifelse() woes ... can we agree on a ifelse2() ?
On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham <h.wickham at gmail.com> wrote: >> >> One possibility would also be to consider a "numbers-only" or >> >> rather "same type"-only {e.g., would also work for characters} >> >> version. >> >> > I don't know what you mean by these. >> >> In the
2016 Nov 15
2
ifelse() woes ... can we agree on a ifelse2() ?
All, Martin: Thanks for this and all the other things you are doing to both drive R forward and engage more with the community about things like this. Apologies for missing this discussion the first time it came around and if anything here has already been brought up, but I wonder what exactly you mean when you want recycling behavior. Specifically, based on an unrelated discussion with Henrik
2016 Aug 06
4
ifelse() woes ... can we agree on a ifelse2() ?
Dear R-devel readers, ( = people interested in the improvement and development of R). This is not the first time that this topic is raised. and I am in now state to promise that anything will result from this thread ... Still, I think the majority among us has agreed that 1) you should never use ifelse(test, yes, no) if you know that length(test) == 1, in which case if(test) yes
2016 Sep 10
1
c(<Matrix>, <Matrix>) / help(dotsMethods) etc
>>>>> John Chambers <jmc at r-project.org> >>>>> on Sat, 10 Sep 2016 09:16:38 -0700 writes: > (Brief reply, I'm traveling but as per below, this is on my radar right now so wanted to comment.) > Two points regarding "dotsMethods". > 1. To clarify the limitation. It's not that all the arguments have to be of the same
2011 Feb 09
3
precision of gamma function
Dear R users, I have to calculate gamma functions for negative numbers beyond -171.4. e.x. gamma(-500.4) I got following: > gamma(-170.4) [1] -5.824625e-308 > gamma(-171.4) [1] 0 Warning message: underflow occurred in 'gammafn' I have tried to use a recursion getting values a little futher -180. How could I solve this problem? Thank you beforehand. Chuse.
2011 Oct 28
1
Question about how to compile .zip for Windows
Dear all, Thanks for Baptiste's help. He offered me the website http://win-builder.r-project.org/ This is very good. However, I face another problem recently that I need to program a package, which require 'multiple-precision floating-point computations'. I found that MPFR is very good tools. It can be installed on the linux system, if you want to use it just include some head
2016 Nov 26
3
ifelse() woes ... can we agree on a ifelse2() ?
Just stating, in 'ifelse', 'test' is not recycled. As I said in "R-intro: length of 'ifelse' result" (https://stat.ethz.ch/pipermail/r-devel/2016-September/073136.html), ifelse(condition, a, b) returns a vector of the length of 'condition', even if 'a' or 'b' is longer. On current 'ifelse' code in R: * The part ans[nas] <- NA
2012 Mar 21
1
enableJIT() and internal R completions (was: [ESS-bugs] ess-mode 12.03; ess hangs emacs)
Hello, JIT compiler interferes with internal R completions: compiler::enableJIT(2) utils:::functionArgs("density", '') gives: utils:::functionArgs("density", '') Note: no visible global function definition for 'bw.nrd0' Note: no visible global function definition for 'bw.nrd' Note: no visible global function definition for 'bw.ucv'