BaşlayınÜcretsiz Başlayın

Avoiding the .

As we've mentioned, using . in object names can lead to confusion.

Bu egzersiz

Defensive R Programming

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Rename the objects and arguments below to use an underscore instead of a full stop.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Define a function to prevent pasting the code above
ci <- function(x, plot.it = FALSE) {
  # Plot the data
  if (isTRUE(plot.it)) hist(x)
  
  m <- mean(x); s <- sd(x); n <- length(x)
  c(m - 1.96 * s/sqrt(n), m + 1.96 * s/sqrt(n))
}

# Generate 100 normal random numbers
sample.values <- rnorm(100)
ci(sample.values)
Kodu Düzenle ve Çalıştır