similar to: Avoiding for-loop for splitting vector into subvectors based on positions

Displaying 20 results from an estimated 7000 matches similar to: "Avoiding for-loop for splitting vector into subvectors based on positions"

2019 Oct 11
2
New matrix function
I think you are confusing package and function here. Plus some of the R Core packages, that you mention, contain functions that should probably be replaced by functions with better implementation from packages on CRAN. Best regards Morgan On Fri, 11 Oct 2019 15:22 Joris Meys, <jorismeys at gmail.com> wrote: > > > On Fri, Oct 11, 2019 at 3:55 PM Morgan Morgan <morgan.emailbox
2010 Mar 30
2
weighted.median function from package R.basic
Dear all, I want to apply a weighted median on a huge dataset, and I remember a function from the package R.basic that could do this using an internal sorting algorithm qsort. This speeded things up quite a bit. Alas, I can't find that package anywhere anymore. There is a weighted.median function in the package limma too, but I didn't use that before. Anybody who knows what happened to
2018 Jan 31
3
Best practices in developing package: From a single file
Dear All: stepping in late, but @Joris, if you would like to take 'from a single file' literally, have a look at: https://github.com/bpfaff/lp4rp (lp4rp: literate programming for R packages); Cheers, Bernhard ps: incidentally, within the noweb-file roxygen is employed. -----Urspr?ngliche Nachricht----- Von: R-devel [mailto:r-devel-bounces at r-project.org] Im Auftrag von Joris
2018 Jan 31
1
Best practices in developing package: From a single file
I fully agree with Joris and Hadley on roxygen2. Additionally: I wrote and published my first package before roxygen (or roxygen2) was available. I found editing .Rd extremely terse (especially when code is updated). For example, the fact that there are no spaces allowed between } and { in \param{}{} has hurt my brain quite a few times, especially since R CMD check did not give any useful error
2010 Apr 02
2
compare multiple values with vector and return vector
Dear all, I have a vector, and for each element I want to check whether it is equal to any element from another vector. I want a vector of logical values with the length of the first one as return. In R this would be : > x <- 1:10 > sapply(x,function(y){any(y==c("2","3","4"))}) [1] FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE It works pretty
2018 Mar 24
1
Possible bug: file.exists() always returns TRUE for prn.us.txt
Thank you. I was just replying my own message with the same information. Sorry for not doing the research properly before filing. Cheers Joris On Sat, Mar 24, 2018 at 11:36 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 24/03/2018 6:16 AM, Joris Meys wrote: > >> Dear all, >> >> while preparing some exercises I came across some highly surprising
2010 May 08
2
apply a function on elements of a list two by two
Dear all, I want to apply a function to list elements, two by two. I hoped that combn would help me out, but I can't get it to work. A nested for-loop works, but seems highly inefficient when you have large lists. Is there a more efficient way of approaching this? # Make some toy data data(iris) test <- vector("list",3) for (i in 1:3){ x <- levels(iris$Species)[i] tmp
2018 Apr 24
1
data.table not available as win binary for R 3.5 yet?
Dear all, to my astonishment data.table cannot be installed on R 3.5 Windows. When checking the package page, the Windows binary is available for download. When checking the server however, I can't seem to find data.table. Also install.packages() says the package is only available in source form and may need compilation. Compiling using Rtools 35 is no problem. Is this merely an issue of
2010 May 28
1
How to get values out of a string using regular expressions?
Dear all, I have a vector of filenames which begins like this : X <- c("OrthoP1_DNA_str.aln", "OrthoP10_DNA_str.aln", "OrthoP100_DNA_str.aln", "OrthoP101_DNA_str.aln", "OrthoP102_DNA_str.aln", "OrthoP103_DNA_str.aln", "OrthoP104_DNA_str.aln", "OrthoP105_DNA_str.aln", "OrthoP106_DNA_str.aln",
2018 Jun 09
4
Date class shows Inf as NA; this confuses the use of is.na()
And now I've seen I copied the wrong part of ?is.na > The default method for is.na applied to an atomic vector returns a logical vector of the same length as its argument x, containing TRUE for those elements marked NA or, for numeric or complex vectors, NaN, and FALSE otherwise. Key point being "atomic vector" here. On Sat, Jun 9, 2018 at 1:41 PM, Joris Meys <jorismeys at
2018 Sep 18
3
memory footprint of readRDS()
Dear all, I tried to read in a 3.8Gb RDS file on a computer with 16Gb available memory. To my astonishment, the memory footprint of R rises quickly to over 13Gb and the attempt ends with an error that says "cannot allocate vector of size 5.8Gb". I would expect that 3 times the memory would be enough to read in that file, but apparently I was wrong. I checked the memory.limit() and that
2018 Jan 31
3
Best practices in developing package: From a single file
On 31/01/2018 6:33 AM, Joris Meys wrote: > 3. given your criticism, I'd like your opinion on where I can improve > the documentation of https://github.com/CenterForStatistics-UGent/pim. > I'm currently busy updating the help files for a next release on CRAN, > so your input is more than welcome. After this invitation I sent some private comments to Joris. I would say his
2018 May 30
1
CRAN checks give errors when no tests are included
Dear all, as a follow-up to the question asked on R-package-devel (see link below): Someone sent a package to CRAN with a few problems. There's more things wrong with the submission, but one thing that really caught my eye was the following error: Warning message: running command '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD BATCH --vanilla "testthat.R"
2010 Jan 04
1
metafor: using mixed models
Dear all, I'm currently applying a mixed model approach to meta analysis using the package metafor. I use the "model.matrix()" function to create dummy variables. The option btt gives me the combined test for the dummies. Problem is, I don't know which indices I have to use, and can't really figure it out from the help file and the examples. I use following code : X <-
2010 May 25
2
Calculation time of isoMDS and the optimal number of dimensions
Dear all, I'm running a set of nonparametric MDS analyses, using a wrapper for isoMDS, on a 800x800 distance matrix. I noticed that setting the parameter k to larger numbers seriously increases the calculation time. Actually, with k=10 it calculates already longer than for k=2 and k=5 together. It's now calculating for 6 hours, and counting... There is quite a difference between the
2018 Apr 24
2
data.table not available as win binary for R 3.5
Dear all, to my astonishment data.table cannot be installed on R 3.5 Windows. When checking the package page, the Windows binary is available for download. When checking the server however, I can't seem to find data.table. Also install.packages() says the package is only available in source form and may need compilation. Compiling using Rtools 35 is no problem. Is this merely an issue of
2010 Apr 05
1
use of random and nested factors in lme
Dear all, I've read numerous posts about the random and nested factors in lme, comparison to proc Mixed in SAS, and so on, but I'm still a bit confused by the notations. More specifically, say we have a model with a fixed effect F, a random effect R and another one N which is nested in R. Say the model is described by Y~F Can anyone clarify the difference between : random = ~1|R:N random
2018 May 24
2
Creating S3 methods for S4 classes (coming from r-package-devel)
Dear all, I asked this question on r-package-devel but Martin Maechler pointed out this was more suited on R-devel. So here it goes: per the manual, one should create and register both the S3 and a S4 method if one needs a method for an S4 class for a function using S3 dispatching. This is cumbersome, and not very optimal. I was wondering if there's a better way to do this. Currently I
2018 Mar 16
2
Apparent bug in behavior of formulas with '-' operator for lm
Joris, the point is that 'z' is NOT used as a predictor in the model. Therefore it should not affect predictions. Also, I find it suspicious that the error only occurs when the response variable conitains missings and 'z' is unique (I have tested several other cases to confirm this). -Mark Op vr 16 mrt. 2018 om 13:03 schreef Joris Meys <jorismeys at gmail.com>: >
2018 Mar 14
2
truncation/rounding bug with write.csv
I don't see the issue here. It would be helpful if people would report their sessionInfo() when reporting whether or not they see this issue. Mine is > sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Arch Linux Matrix products: default BLAS/LAPACK: /usr/lib/libopenblas_haswellp-r0.2.20.so locale: [1] LC_CTYPE=en_US.UTF-8