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
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
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
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 ==
> 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
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
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
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
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
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
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]]
11 matches
Mail list logo