Hello, please, I need help in programming R. Here is my file -------------- next part -------------- A non-text attachment was scrubbed... Name: help code.pdf Type: application/pdf Size: 79689 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20201116/9a808e24/attachment.pdf>
HI Ablaye, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html <http://www.r-project.org/posting-guide.html> before you post your question. This is not the place for posting your homework. Even if it is, your homework question is really hard to read. Cheers, Jiefei On Mon, Nov 16, 2020 at 8:46 PM Ablaye Ngalaba <ablayengalaba at gmail.com> wrote:> Hello, > please, I need help in programming R. > Here is my file > ______________________________________________ > R-help at 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. >[[alternative HTML version deleted]]
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 at 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. >