similar to: Using seq_len() vs 1:n

Displaying 20 results from an estimated 9000 matches similar to: "Using seq_len() vs 1:n"

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 Sep 03
1
'seq' help page: seq_length -> seq_len?
In the Value section of the 'seq' help page it says 'seq_along' and 'seq_length' always return an integer vector. I believe it should be 'seq_along' and 'seq_len' always return an integer vector. as there are no seq_length function? Best, Niels -- Niels Richard Hansen Web: www.math.ku.dk/~richard Associate Professor
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
2018 Aug 05
2
Is this a bug in `[`?
Thanks. This is exactly the doubt I had. Rui Barradas ?s 05:26 de 05/08/2018, Kenny Bell escreveu: > This should more clearly illustrate the issue: > > c(1, 2, 3, 4)[-seq_len(4)] > #> numeric(0) > c(1, 2, 3, 4)[-seq_len(3)] > #> [1] 4 > c(1, 2, 3, 4)[-seq_len(2)] > #> [1] 3 4 > c(1, 2, 3, 4)[-seq_len(1)] > #> [1] 2 3 4 > c(1, 2, 3, 4)[-seq_len(0)]
2018 Aug 04
3
Is this a bug in `[`?
?s 15:51 de 04/08/2018, I?aki ?car escreveu: > El s?b., 4 ago. 2018 a las 15:32, Rui Barradas > (<ruipbarradas at sapo.pt>) escribi?: >> >> Hello, >> >> Maybe I am not understanding how negative indexing works but >> >> 1) This is right. >> >> (1:10)[-1] >> #[1] 2 3 4 5 6 7 8 9 10 >> >> 2) Are these right? They
2018 Aug 05
2
Is this a bug in `[`?
El dom., 5 ago. 2018 a las 6:27, Kenny Bell (<kmbell56 at gmail.com>) escribi?: > > This should more clearly illustrate the issue: > > c(1, 2, 3, 4)[-seq_len(4)] > #> numeric(0) > c(1, 2, 3, 4)[-seq_len(3)] > #> [1] 4 > c(1, 2, 3, 4)[-seq_len(2)] > #> [1] 3 4 > c(1, 2, 3, 4)[-seq_len(1)] > #> [1] 2 3 4 > c(1, 2, 3, 4)[-seq_len(0)] > #>
2011 Jan 17
1
median by geometric mean -- are we missing what's important?
Folks: I know this may be overreaching, but are we missing what's important? WHY do the zeros occur? Are they values less then a known or unknown LOD? -- and/or is there positive mass on zero? In either case, using logs to calculate a geometric mean may not make sense. Paraphrasing Greg Snow, what is the scientific question? What is the model? Cheers, Bert On Mon, Jan 17, 2011 at 9:13 AM,
2011 May 17
1
Subsetting depth profiles based on maximum depth by group with plyr
Hello, Apologies for a similar earlier post. I didn't include enough details in that one. I am having a little trouble subsetting some data based on a grouping variable. I am using an instrument that does depth profiles of a water column. The instrument records on the way down as well as the way up. So thanks to an off-list reply I can subset the data so that all data collected at the
2004 Nov 24
2
text() with invalid argument type crashes RGui.exe
Dear Rexperts: (R 2.0.1 on Windows XP Pro) Is the following problem unique to my setup? If it's a known problem, I didn't see it at http://bugs.r-project.org/ nor find discussion in the archives. plot(1:10) loc <- c(5, 6) text(loc, labels = "a") Produces expected results according to ?xy.coords. plot(1:10) loc <- list(x = 5, y = 6) text(loc, labels = "a") No
2018 Aug 04
2
Is this a bug in `[`?
Hello, Maybe I am not understanding how negative indexing works but 1) This is right. (1:10)[-1] #[1] 2 3 4 5 6 7 8 9 10 2) Are these right? They are at least surprising to me. (1:10)[-0] #integer(0) (1:10)[-seq_len(0)] #integer(0) It was the last example that made me ask, seq_len(0) whould avoid an if/else or something similar. Thanks in advance, Rui Barradas
2010 Feb 05
2
(Another) Bates fortune?
I vote to 'fortunize' Doug Bates on Hierarchical data sets: which software to use? "The widespread use of spreadsheets or SPSS data sets or SAS data sets which encourage the "single table with a gargantuan number of columns, most of which are missing data in most cases" approach to organization of longitudinal data is regrettable."
2005 Oct 24
3
download problem: Windows binaries - patched/devel versions
Lately, I get a "page cannot be found" error (IE 6.0, Windows XP) when I try to download the following: http://cran.us.r-project.org/R-2.2.0pat-win32.exe http://cran.us.r-project.org/R-2.3.0dev-win32.exe (Same for all other mirrors (about 6) that I've tried. Could someone please check if these files are accessible to them? I'm guessing there's something haywire in my setup.
2010 Apr 02
1
packages with DLLs under 2.12.0
I realize that R-core must be busy with the imminent release of 2.11.0, so please consider this not urgent. The NEWS file for 2.12.0 (Windows-specific) says, in part: For now, 32-bit packages with compiled code built under 2.{10,11}.x can be used, but this will be disabled before release. For me, this doesn't work without a tweak. For example, > library(mvtnorm) #Error:
2011 Mar 26
1
bwplot [lattice]: how to get different y-axis scales for each row?
Dear expeRts, How can I get ... (1) different y-axis scales for each row (2) while having the same y-axis scales for different columns? I coulnd't manage to do this with relation="free" [which gives (1) but not (2)]. I also tried relation="sliced", but it did not give the same y-axis scales within each row (see the fourth row). Further, it "separates" the
2010 Nov 24
1
segfault interest?
in a long program, I ran into ?*** caught segfault *** address 0xdc3f9b48, cause 'memory not mapped' Traceback: ?1: rep.int(seq_len(nx), rep.int(rep.fac, nx)) ?2: rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) ?3: expand.grid(seq_len(nx), seq_len(ny)) ?4: merge.data.frame(d, ss) ?5: merge(d, ss) ?6: valid.range(opt) ?7: eval.with.vis(expr, envir, enclos) ?8: eval.with.vis(ei,
2008 Mar 10
2
write.table with row.names=FALSE unnecessarily slow?
write.table with large data frames takes quite a long time > system.time({ + write.table(df, '/tmp/dftest.txt', row.names=FALSE) + }, gcFirst=TRUE) user system elapsed 97.302 1.532 98.837 A reason is because dimnames is always called, causing 'anonymous' row names to be created as character vectors. Avoiding this in src/library/utils, along the lines of Index:
2007 Jul 27
3
(PR#9811) sequence(c(2, 0, 3)) produces surprising results,
This is as doumented, and I think you could say the same thing of seq(). BTW, sequence() allows negative inputs, and I don't think you want sum(input) in that case. I've never seen the point of sequence(), but it has been around in R for a long time. It is used in packages eRm, extRemes, hydrosanity, klaR, seas. Who knows what people have in private code, so I don't see any
2013 Apr 24
1
Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?
Dear list, When using as.POSIXlt with times measured down to microseconds the default format.POSIXlt seems to cause some possibly undesirable behaviour: According to the code in format.POSIXlt the maximum accuracy of printing fractional seconds is 1 microsecond, but if I do; options( digits.secs = 6 ) as.POSIXlt( 1.000002 , tz="", origin="1970-01-01") as.POSIXlt( 1.999998 ,
2012 Jan 06
1
seq_along and rep_along
Hi all, A couple of ideas for improving seq_along: * It would be really useful to have a second argument dim: seq_along(mtcars, 1) seq_along(mtcars, 2) # equivalent to seq_len(dim(mtcars)[1]) seq_len(dim(mtcars)[2]) I often find myself wanting to iterate over the rows or column of a data frame, and there isn't a particularly nice idiom if you want to avoid problems
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine. I find myself with such mixed feelings about R. After finding that addTA worked fine at the command line but not in a function, I puzzled for a long time about what kind of virtual machine structure could possibly account for that. I couldn't think of any. It turns out that this isn't due to an R virtual machine structure. The reason addTA adds