Re: [R] Need help in R

2021-10-26 Thread Greg Minshall
Bert, > findprm <- function(n){ >nn <- seq.int(2, n) >i <- 2 >while(i <= floor(sqrt( n))){ > nn <- nn[(nn <= i) | (nn %% i > 0)] > i <- nn[nn > i][1] >} >nn > } +1 -- thanks! __ R-help@r-project.org mailing list -- To UN

Re: [R] Need help in R

2021-10-26 Thread Avi Gross via R-help
try to guess and certainly won't supply a valid solution here! -Original Message- From: R-help On Behalf Of Anas Jamshed Sent: Tuesday, October 26, 2021 4:39 PM To: Rolf Turner Cc: R-help Mailing List Subject: Re: [R] Need help in R Its not homework . Basically i want to get easy so

Re: [R] Need help in R

2021-10-26 Thread Bert Gunter
Well, OK. I'll provide you an alternative and explanation. The way you are going about it would work, but it is usually not the best approach in R. Typically, the key in R is to whenever possible use whole object manipulation rather than iteration. This hides the iteration details and often pushes

Re: [R] Need help in R

2021-10-26 Thread Anas Jamshed
Its not homework . Basically i want to get easy solution: I am trying this for ist problem: n= seq(1,100) for (j in n:100) { f = 1 i = 2 n = j while (i <= n / 2) { if (n %% i == 0) { f = 0 break } i = i + 1 } if (f ==

Re: [R] Need help in R

2021-10-26 Thread Jeff Newmiller
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. One of the items mentioned in the Posting Guide is that homework questions are not okay... we don't know what your instructor is looking for, and the

Re: [R] Need help in R

2021-10-26 Thread Rolf Turner
On Wed, 27 Oct 2021 01:09:50 +0500 Anas Jamshed wrote: > I need help to these questions > > ### Question 1 > Create a variable containing a sequence of numbers from 1 to 100: > > Iterate over the variables and print those numbers which are prime. > > > ### Question 2 > Create a matrix of si

Re: [R] Need help in R

2021-10-26 Thread Kevin Thorpe
This looks suspiciously like homework and this list does have a no homework policy. If it is not homework, please forgive the assumption. > On Oct 26, 2021, at 4:09 PM, Anas Jamshed wrote: > > I need help to these questions > > ### Question 1 > Create a variable containing a sequence of numbe

[R] Need help in R

2021-10-26 Thread Anas Jamshed
I need help to these questions ### Question 1 Create a variable containing a sequence of numbers from 1 to 100: Iterate over the variables and print those numbers which are prime. ### Question 2 Create a matrix of size 3x3 called mat_1: Iterate over all the values one by one and print the ele

Re: [R] Need help in R code of the functional data .

2020-10-17 Thread Richard O'Keefe
I do not understand your question. Are you talking about "functional data analysis", the statistical analysis of data where some of the covariates are (samples from) continuous functions? There are books and tutorials about doing that in R. Are you talking about "functional data structures", as

Re: [R] Need help in R code of the functional data .

2020-10-16 Thread Rui Barradas
Hello, You have asked several times about functional data, I really do not understand what you mean but if you want to learn about writing R functions, take a look at doc/manual/R-intro.pdf, that comes with any installation of R, chap. 10 Writing your own functions. And at any of Hadley Wi

[R] Need help in R code of the functional data .

2020-10-16 Thread Ablaye Ngalaba
Hello, Please, I want to know how the functional data are defined in programming code R. If possible an illustrative example of code can help me to understand better. Yours sincerely. [[alternative HTML version deleted]]