1
anonymous No title
R
kagayaku <-
  function(n = 10, prob_eye = .3){
    
    bubble_col <-
      round(runif(3, 0, 255)) %>%
      as.hexmode() %>%
      str_c(collapse = "") %>%
      paste0("#", .)
  
    eye_col <-
      round(runif(3, 0, 255)) %>%
      as.hexmode() %>%
      str_c(collapse = "") %>%
      paste0("#", .)
    
    
    x <- cos(seq_len(n) * 2 / pi)/10 + rnorm(n, 0, .01)
    y <- sin(seq_len(n) * 2 / pi)/10 + rnorm(n, 0, .01)
    
    bubble_xy <- tibble(x, y)
    bubble_size <- 35 + rnorm(n, 0, 5)
    add_eyes <- sample(c(NA_real_, 1), size = n, replace = TRUE, prob = c(1-prob_eye, prob_eye))
    
    inochi <-
      bubble_xy %>%
      mutate(eye_x = x + rnorm(n, 0, .007) * add_eyes,
             eye_y = y + rnorm(n, 0, .007) * add_eyes) %>%
      ggplot(aes(x, y)) +
      theme_void() +
      geom_point(size = bubble_size, col = bubble_col) +
      geom_point(aes(eye_x, eye_y), size = 15, shape = 21, fill = "white", col = bubble_col) +
      geom_point(aes(eye_x, eye_y), size = 5, col = eye_col) +
      lims(x = c(-.2, .2), y = c(-.15, .15))
    
    suppressWarnings(plot(inochi))
  }

kagayaku()
anonymous No title
R
 sum1 <- 0                        
 for (i in 1:10000) {             
   sum1 <- sum1 + i                  
 }                             
 sum1 #2-1
 
 
 sum2 <- 0
 for(n in 1:1000){
     sum2 <- sum2 + (2 * n + 1)
 } 
 sum2 #2-2
 
 
 product <- 1
 for(n in 1:10){
     product <- product * exp(n);
 }
 product <- sqrt(product)
 product #2-3
anonymous No title
R
 sum1 <- 0                        
 for (i in 1:10000) {             
   sum1 <- sum1 + i                  
 }                             
 sum1 #2-1
 
 
 sum2 <- 0
 for(n in 1:1000){
     sum2 <- sum2 + (2 * n + 1)
 } 
 sum2 #2-2
 
 
 sum3 <- 1
 for(n in 1:10){
     sum3 <- sum3 * exp(n);
 }
 sum3 <- sqrt(sum3)
 sum3 #2-3
Don't you submit code?
Submit
1
年末年始は機械学習・深層学習を勉強しませんか?
広告
未経験から最短でエンジニアへの転職を目指すなら