RfastOfficial / Rfast

A collection of Rfast functions for data analysis. Note 1: The vast majority of the functions accept matrices only, not data.frames. Note 2: Do not have matrices or vectors with have missing data (i.e NAs). We do no check about them and C++ internally transforms them into zeros (0), so you may get wrong results. Note 3: In general, make sure you give the correct input, in order to get the correct output. We do no checks and this is one of the many reasons we are fast.
139 stars 19 forks source link

Let `elems` argument of `rownth()` expand to corresponding length if length is 1 #108

Open psychelzh opened 2 months ago

psychelzh commented 2 months ago

For example:

set.seed(123)
x <- matrix(rnorm(1000), nrow = 10)
Rfast::rownth(x, 1)
#> [1] -2.809775
# expect this instead:
Rfast::rownth(x, rep(1, nrow(x)))
#>  [1] -2.809775 -2.309169 -1.943651 -1.779977 -2.249051 -2.660923 -2.014210
#>  [8] -2.070751 -2.465898 -2.078489

Created on 2024-04-15 with reprex v2.1.0

ManosPapadakis95 commented 1 month ago

I will think about it. The reason i didn't do it is because i want be clear that each cell of that argument corresponds to each row.