similar to: modifying argument of a .C call (DUP=FALSE)

Displaying 20 results from an estimated 5000 matches similar to: "modifying argument of a .C call (DUP=FALSE)"

2003 Oct 06
1
visualizing transition probability matrices
Dear List, I have a couple of (~200) 3x3 transition probability matrices (ie each defines a Markov chain). They are all estimated from the same underlying process, so it ie meaningful to take their elemetwise mean and standard deviation. [1] First question: supposing that they are given in a list l, how do I get their elementwise mean and standard deviation? Fortunately, the mean of trans. prob.
1998 Nov 26
1
Saving memory usage -- .C(....., DUP = FALSE) danger?
Just found out [R 0.63, standard -v -n] : > rm(list=ls()) > gc() free total Ncells 96538 200000 Vcells 214008 250000 > hist(runif(50000)) Error: heap memory (1953 Kb) exhausted [needed 390 Kb more] which is a bit astonishing given that I still have room for 214000 double's > u1 <- runif(50000) > u2 <- runif(50000) > gc()
2010 May 08
1
matrix cross product in R different from cross product in Matlab
Hi all, I have been searching all sorts of documentation, reference cards, cheat sheets but can't find why R's crossprod(A, B) which is identical to A%*%B does not produce the same as Matlabs cross(A, B) Supposedly both calculate the cross product, and say so, or where do I go wrong? R is only doing sums in the crossprod however, as indicated by (z <- crossprod(1:4)) # = sum(1 +
2020 May 01
4
paste(character(0), collapse="", recycle0=FALSE) should be ""
Without 'collapse', 'paste' pastes (concatenates) its arguments elementwise (separated by 'sep', " " by default). New in R devel and R patched, specifying recycle0 = FALSE makes mixing zero-length and nonzero-length arguments results in length zero. The result of paste(n, "th", sep = "", recycle0 = FALSE) always have the same length as
2003 Apr 23
1
Setting up Xemacs + Sweave
Dear list, I have tried to setup my Xemacs for use with Sweave, which I indend to learn. I have followed the instructions in the Sweave FAQ, that is to say, I put (defun Rnw-mode () (require 'ess-noweb) (noweb-mode) (if (fboundp 'R-mode) (setq noweb-default-code-mode 'R-mode))) (add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode)) (add-to-list
2020 May 15
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
Totally agree with that. H. On 5/15/20 10:34, William Dunlap via R-devel wrote: > I agree: paste(collapse="something", ...) should always return a single > character string, regardless of the value of recycle0. This would be > similar to when there are no non-NULL arguments to paste; collapse="." > gives a single empty string and collapse=NULL gives a zero long
2003 Jul 12
2
using cut on matrices
Dear list, I'd like to use the function cut() on matrices, ie that when I apply it to a matrix, it would return a matrix of the same dimensions instead of a vector. I wonder if there is a better (more elegant) solution than matrix(cut(a, ...), ncol=ncol(a), nrow=nrow(a)) because I would like to use cut on both vectors and matrices and avoid testing whether a is a matrix. Thanks, Tamas
2004 Jul 05
1
general questions about R on debian/powerpc
Hi, I am about to but a laptop, and have narrowed the choices down to a Dell Latitude 600 and an Apple Powerbook G4 Aluminium (Princeton provides these models at a discount for grad students). I am biased towards the Powerbook, and would like to run Debian on it. I have only used debian on i386 platforms so far. I use R quite frequently, so I would be interested in your experience of running R
2003 Oct 01
3
fitting Markov chains
I need to find a computationally simple process for the movement of interest rates. In this simplified model, an interest rate can have 3--5 possible values, and its movement is characterized by a matrix of transition probabilities (ie, it is a Markov process). I would like to estimate this process from a given set of data. For example, let the interest rate time series be: 7 3 8 2 5 9 6
2008 Nov 12
2
Outer, kronecker, etc.
`outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that outer( 1:2, 3:4, list) or outer(1:2,3:4,function(a,b){1}) gives an error. Is there a version of `outer`/`kronecker`/etc. that takes arbitrary functions and does its own elementwise mapping? In the first example above, I'd expect the
2011 Feb 07
1
Unusual slowing of R matrix multiplication version 2.12.1 (2010-10-15) vs 2.12.0
R Version 2.12.1 (2010-10-15) vs 2.12.0 has slowed down 8 fold for dual core and 17 fold for dual-core-dual-processor Macs. I have checked this result on 3 different macs using the following R-script: Using Version 2.12.0 on a dual core dual processor Mac: > source("http://www.bio.umass.edu/biology/kunkel/pub/R/CuriousResult.R") matrix multiplication 43.543 1.308 14.788
2004 Apr 10
4
(offtopic) I need two sets of 5 different color scales
Hi, I am plotting a policy function (result from a dynamic stochastic optimization problem, discretized approximation). The policy function maps from an 2 x 2 x 2 x 3 x B x F state space to a B x F state space (B and F are usually between 4-6, and represent domestic and foreign savings. The other variables are income (Y), inflation (Pi), domestic and foreign interest rates (R and Z)). I
2012 Sep 14
4
concatenating two vectors
Dear all, I want to concatenate the elements of two vectors such as a<-c("a1","a2") b<-c("b1","b2") and obtain "a1b1", "a1b2","a2b1","a2b2" I tried the paste and paste0 functions, but they yielded elementwise concatenation such as "a1b1","a2b2" I am wondering that is there an efficient
2008 Nov 06
3
.C(..., DUP=FALSE) memory costs depending on input size?
Hello, I'm trying to create my own C code for use within R. While optimizing the code I've noticed that even while only using pointers to get my data to C the time needed still depends on data (vector) size. To test this, I've created an empty C function to which I've send vectors containing various sizes of elements. The time needed for each call is measured and plotted. I would
2003 Apr 17
1
Testing for whole numbers
Is there a way in R to test if a given number is an integer, ie a whole number? I am not referring to the data type of a number, but to its value. That is to say, is.whole(pi-pi+2) would be TRUE, whereas is.whole(4/3) would be false. At the moment I am using is.whole <- function(a) { floor(a)==a } which is OK for real numbers, but not for complex ones (a+bi would be a whole number if both a
2000 Sep 26
1
Permutations
Hi, this is maybe not a real R problem but I want to solve this in R ;-) Consider the set of all permutations of 1:N (=: S, say) and a fixed element a from S. I now need to compute the number of permutations s from S which are elementwise less or equal to a: | { s \in S | s <= a } | Of cource, backtracking using a tree structure is possible. Does anyone know an efficient way? Torsten
2004 May 21
2
Re: Windows versus Unix packages in CRAN ...
Janusz Kawczak wrote: > You simply need to remove the stuff related to MS Win from zzz.R; > in partricular the lines after if( .... ) to clear your message. > As you can see, the info relates to the WinMenu under MS Win. I think people have been more than a little disingenuous in claiming that getting the Rmetrics package to go under Linux is transparent. If you have to dig into the
2000 Sep 07
1
.C and DUP=TRUE versus .Call
Hi Everyone, I have a piece of C code that uses R_alloc, and so I set DUP=TRUE in the call using ".C". As I understand it this takes a copy of each object passed to my function. If these objects are large then this could be expensive. My question is, if I rewrote the code to use .Call, would I avoid this duplication by using the objects themselves (they are not modified in the code)
2000 Mar 20
1
Elementwise c() for lists
I have two lists of equal lengths. Each one consists of vectors. Is there an elegant way to combine them elementwise? Elegant means: without loops. For instance, for > jja_list(1:3,4:7) > jjb_list(rep(0,4),(2,5)) I would like to get: > list(c(1:3,rep(0,4)),c(4:7,rep(2,5))). --- D.Trenkler --- ************************************************************************ *********
2004 Mar 31
1
extracting values from a 3d array using a matrix from indices
Suppose I have A, an n x m matrix, each element is an integer (an index). I also have B, an n x l x m array. I need C, where C[n,m] = B[n, A[n, m], m] I am currently using loops, what would be the "R way" to do this? Another question: let A[n, m] <- argmax_l B[n, l, m] what would be the nicest way of doing this? Currently I am using max.col and a single loop, going though the