[R] assistance programming R

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Mon Nov 16 18:30:13 CET 2020


Hello,

You should read an introductory text on R before posting questions. 
Start with file R-intro.pdf that comes your installation of R. There are 
also several books on CRAN and other on-line sites. Cost free.

As for the problem,


n_l <- function(y, q, na.rm = FALSE){
   sum(y %in% seq_len(q), na.rm = na.rm)
}

# Tests
set.seed(2020)
x1 <- rpois(10, lambda = 4)
x2 <- rpois(100, lambda = 10)

n_l(x1, q = 4)
n_l(x2, q = 21)


Hope this helps,

Rui Barradas


Às 12:45 de 16/11/20, Ablaye Ngalaba escreveu:
> Hello,
> please, I need help in programming R.
> Here is my file
> 
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list