assistance programming R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

assistance programming R

Ablaye Ngalaba
Hello,
please, I need help in programming R.
Here is my file

______________________________________________
[hidden email] 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.

help code.pdf (106K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: assistance programming R

Jiefei Wang
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 <[hidden email]>
wrote:

> Hello,
> please, I need help in programming R.
> Here is my file
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: assistance programming R

Rui Barradas
In reply to this post by Ablaye Ngalaba
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
>
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.