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
The error below was fairly clear. The R 'if" statement is not vectorized and
takes a single logical argument. It is not normally used in a pipeline
unless at that point the data has been reduced to a vector of length 1.
I do not want to look at your code further without the data behind it but
sugg
Sorry, forgot to point out that you would need something like this to
install ...
remotes::install_github("pmur002/gggrid")
Paul
On 27/10/2021 12:55 pm, p...@philipsmith.ca wrote:
Thanks for this. I was unable to install the gggrid package apparently
because it is unavailable for my versio
There can be people doing homework for a course and as noted, the normal
expectation is to use the resources provided including classroom instruction
(or the often ZOOM or recordings) as well as textbooks.
Forums like this are not a substitute and some nice people will sometimes
volunteer not to d
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
Thanks for this. I was unable to install the gggrid package apparently
because it is unavailable for my version of R (4.1.1 (2021-08-10)). But
I found it here https://github.com/pmur002/gggrid/releases/tag/v0.1-0,
copied the code into your code, and it worked very well.
On 2021-10-26 19:18, Pa
Hi
Another alternative (using 'gggrid' to add a 'grid' rect grob as the
background), just for the record ...
library(gggrid)
bgrect <- function(data, coords) {
rectGrob(gp=gpar(col=NA, fill=adjustcolor(data$fill[1], alpha=.3)))
}
ggplot(df, aes(x=date, y=vari)) +
grid_panel(bgrect, a
Hi R users,
I thought the follow R code should work, but I got error, Can you fix my code?
Thank you,
Ding
outlier_tcga_MAD3 <- outlier_tcga %>% filter(n_two >0) %>%
mutate(freqMAD3_gain2ratio = N_MAD3_gain2/n_two )%>%
if (N_MAD3 < 9) {filter(freqMAD3_gain >=1)} else if (N_MAD3 > n_t
Thanks.
Your method
mutate(
cases = ifelse(
country == 'Namibia'
& type == 'confirmed'
& date == '2021-10-23'
& cases == 357,
NA,
cases
)
)
works, as does Rui's
mutate(
cases = replace(
cases,
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
> Sparks, John
> on Mon, 25 Oct 2021 15:36:07 + writes:
> Hi, I tried using the mouse.get_cursor() function in the
> KeyboardSimulator library but it appears to no longer be
> working.
> When I first tried it I got an error message
> Error in get_cursor() :
15 matches
Mail list logo