莉娜吧 关注:803贴子:17,326
  • 4回复贴,共1
1l防吞


IP属地:浙江1楼2019-06-07 14:06回复
    start_with_x <- str_detect(words, "^x")end_with_x <- str_detect(words, "x$")words[start_with_x | end_with_x]


    IP属地:浙江2楼2019-06-07 14:06
    回复
      isTwoFactor <- function(x){
      count = 0
      tmp1 <- c()
      tmp2 <- c()
      for (i in 1:(x/2)) {
      if(isPrime(i)&isPrime(x-i))
      {
      tmp1 <- c(tmp1,i)
      tmp2 <- c(tmp2,x-i)
      count <- count+1
      }
      }
      if(count<=2&&count>0){
      for (j in 1:count) {
      writeLines(paste(x,"=",tmp1[j],"+",tmp2[j]))
      }
      }
      }


      IP属地:浙江3楼2019-06-07 14:09
      回复
        看得见


        4楼2019-06-07 14:12
        回复
          sample <- rnorm(1000,mean=5,sd=10)
          confint <- function(x,sample){
          half_alpha <- qt(0.025,df=999)
          conf_int <- mean(sample)+(sd(sample))/sqrt(1000)*c(half_alpha,-half_alpha)
          if_include<- ifelse(conf_int[1]<x&conf_int[2]>x,TRUE,FALSE)
          return(if_include)
          }
          library(tidyverse)
          a <- map_lgl(sample,~confint(.x,sample))
          sum(a)


          IP属地:浙江5楼2019-06-07 14:19
          回复