similar to: 'seq' help page: seq_length -> seq_len?

Displaying 20 results from an estimated 3000 matches similar to: "'seq' help page: seq_length -> seq_len?"

2010 Sep 16
1
The permutation of one vector into another
Dear R-help-list I have two character vectors a <- c("A", "B", "C") b <- c("A", "C", "B") Then sapply(a, function(i) grep(i, b)) computes the permutation of the entries in 'b' needed to bring 'b' into the same order as 'a'. I have searched around, but haven't been able to find any existing function
2010 Sep 30
1
Assignment to a slot in an S4 object in a list seems to violate copy rules?
Dear R-developers I came across the following issue, which I find strange: setClass("A", representation(a = "numeric")) B <- list() myA <- new("A", a = 1) B$otherA <- myA B$otherA at a <- 2 myA at a Assigning a new value to slot 'a' in the _copy_ of myA stored in B$otherA changes the original value of myA -- this was surprising to me, and I
2010 Nov 19
0
Error from sparse pattern matrix product
Hi The following attempt to minimize memory consumption fails. m1 <- Matrix(c(rep(1,1000), rep(0,2000)), 1500) m2 <- as(m1, "ngCMatrix") Then m1 %*% c(1,2) produces the desired matrix product, while m2 %*% c(1,2) results in the error Error in x %*% y : Cholmod error 'invalid xtype' at file:../MatrixOps/cholmod_sdmult.c, line 82 I might be making a wrong
2010 Dec 17
0
How to use the RUnit tracker in unit tests?
R-developers Does anybody know how I incorporate the use of the tracker in RUnit in the unit tests? I have read the RUnit Vignette, help pages and searched around, but I could find no examples of using 'inspect' in the unit test functions. Moreover, doing so, I tried something like library(RUnit) myFunction <- function(x) { return(x) } track <- tracker() track$init()
2010 Dec 11
1
'identical' and the warning "ignoring non-pairlist attributes"
Dear R developers Using the 'foreach' package I encounter warnings like Warning message: In identical(.combine, cbind) : ignoring non-pairlist attributes Warnings appear once in a new R-session when I run a particular piece of code - and not again. I understand from the source code of 'identical' that the function checks and believes that .combine and cbind have non-pairlist
2011 Apr 14
2
Krylov subspace computations of matrix exponentials
I use the very nice expm functions available from the expm and Matrix packages. My understanding is that for large sparse matrices the currently best methods available are Krylov subspace methods, but they are as far as I can tell not implemented in either of the packages mentioned, nor in any other R package I have found. Does anybody know if Krylov subspace methods are available from any R
2009 Feb 19
0
Meaning of .local and the special token ..1 returned from match.call
I am writing a version of the subset function for a new class. I don't understand the behavior of match.call in this particular case, and I didn't seem to be able to find much help in the language definition or the email archive. Here follows a minimal example: setClass("myClass", representation(id = "factor") )
2009 Feb 23
1
Slow indexing access for Matrix
Consider the following little "benchmark" > require(Matrix) > tmp <- Matrix(c(rep(1,1000),rep(0,9000)),ncol=1) > ind <- sample(1:10000,10000) > system.time(tmp[ind,]) user system elapsed 0.004 0.001 0.005 > ind <- sample(1:1000,10000,replace=TRUE) > system.time(tmp[ind,]) user system elapsed 0.654 0.006 0.703 >
2010 Jun 22
4
seek() and gzfile() on 32-bit R2.12.0 in linux
I have installed both 32-bit and 64-bit versions of R2.12.0 (2010-06-15 r52300) on my Ubuntu 10.04 64-bit system. I observe the following behavior when running the examples from base::connections. There appears to be a problem with seek() on a .gz file when using a 32-bit installation of R2.12.0, but the problem doesn't appear in the 64-bit installation. I realize that seek() has been
2007 Dec 08
1
seq_len
In a post on R-devel, Prof Ripley add the following comment | > BTW, 1:dim(names)[1] is dangerous: it could be 1:0. That was the | > motivation for seq_len. I use the dim(names)[1] and dim(x)[2] along with length(x) with varying levels of frustration depending on the object which I am trying to get the dimensions. I found the reference to seq_len interesting since it is a function that
2010 Feb 11
2
Using seq_len() vs 1:n
R-people, Duncan Murdoch's response in https://stat.ethz.ch/pipermail/r-help/2010-February/227869.html reminded me of something I had been meaning to ask. A while ago I started using for(i in seq_len(v)) {....} in preference to for(i in 1:n) {....} Duncan's post shows that if n can be zero, there is an advantage to using seq_len. Is there ever a *dis*advantage? Peter Ehlers
2010 Feb 12
1
Using seq_len() vs 1:n]
Pat Burns makes a good point. -Peter -------- Original Message -------- Subject: Re: [R] Using seq_len() vs 1:n Date: Fri, 12 Feb 2010 09:01:20 +0000 From: Patrick Burns <pburns at pburns.seanet.com> To: Peter Ehlers <ehlers at ucalgary.ca> References: <4B746AEF.10900 at ucalgary.ca> If you want your code to be compatible with S+, then 'seq_len' isn't going to work.
2010 Aug 26
1
Passing arguments between S4 methods fails within a function:bug? example with raster package.
Dear all, This problem came up initially while debugging a function, but it seems to be a more general problem of R. I hope I'm wrong, but I can't find another explanation. Let me illustrate with the raster package. For an object "RasterLayer" (which inherits from Raster), there is a method xyValues defined with the signature
2010 Aug 26
3
Using termplot() with transformations of x
Hi all I was playing with termplot(), and came across what appears to be an inconsistency. It would appreciate if someone could enlighten me: > # First, generate some data: > y <- rnorm(100) > x <- runif(length(y),1,2) > # Now find the log of x: > logx <- log(x) > > # Now fit two models that are exactly the same, but specified differently: > m1 <-
2002 Oct 03
1
File corruption with write cache enabled - patch included
I recently found out that write caching in samba sometimes leads to file corruption (the setup program for Sophos Antivirus generates corrupted files when making a "central installation" on a Samba share). This morning I tracked down the place in the Samba code that leads to corruption. Here is what happened to me: "write cache size" is 8192 bytes. A client opens a new file
2010 Sep 30
4
interactive session
Hi guys, My concern is to create an automated process from the beginning to the end. I want to copy all my code together in one piece and paste it to R console and sit back and relax :) except one moment in which the program should ask me to enter a number.. and only then (only after getting a valid number from me) it should continue to read and process the rest of the code. I tried lots of
2000 Apr 17
0
Problem: Samba 2.0.7pre4 --with-utmp on OSF1
I tried configuring Samba 2.0.7pre4 on a OSF1 machine (actually a DEC Alpha running Digital Unix 4.0d) with --with-utmp. The autoconf system sets the variable HAVE_UTMPX_H The linking of smbd aborts with the message ---------------------------------------------------------- ld: Unresolved: getutmpx utmpxname updwtmpx *** Exit 1 ---------------------------------------------------------- If I
2010 Nov 26
1
R Tools & Vista_x64: Problem compiling RMySQL?
Hello: What do I need to do to compile R packages (especially RMySQL) for the 64-bit version of R 2.12.0 under Vista_x64? I upgraded to "Rtools212.exe" yesterday but immediately got errors from "R CMD check RMySQL_0.7-5.tar.gz". After the first error, I installed it a second time, then got "undefined reference to" roughly 50 different names beginning
2011 Apr 22
1
Seeking help re: ? single apply command or an alternative
Dear R-help list, Sorry to trouble everyone. This seems like it could be achieved with a single command (? variant of apply), but I am not quite seeing it. I am trying to multiply one vector (a1 below) by corresponding values in a3 (as determined by matching element in a vector a2). The example below might be clearer. a1 <- c(4,3,4,6,8,9,2,3,4,6,7,4) a2 <-
2010 Oct 29
7
date calculation
Hi list, Could someone explain to me why the following result is not a integer? > difftime(strptime("24NOV2004", format="%d%b%Y"), strptime("13MAY2004", >format="%d%b%Y"), units="days") Time difference of 195.0417 days I'm using R2.12.0 on WinXP. Thanks! ...Tao