เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Your first function: tossing a coin

Time to write your first function! It's a really good idea when writing functions to start simple. You can always make a function more complicated later if it's really necessary, so let's not worry about arguments for now.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Introduction to Writing Functions in R

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

coin_sides <- c("head", "tail")

# Sample from coin_sides once
___
แก้ไขและรันโค้ด