whileループ

金融のための中級R

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

whileループ

i <- 0
while(i < 3) {
    print(i)
    i <- i + 1
}
0
1
2
金融のための中級R

真の間は繰り返す

stock_price <- 52.1
while(stock_price <= 52.5) {
  stock_price <- stock_price * runif(1, .99, 1.01)
  print(stock_price)
}

print("Stock price is above 52.5! Sell!")
52.01159
52.46679
52.00211
52.48659
52.99241
"株価が52.5を超えました。売りましょう!"
金融のための中級R

練習しましょう!

金融のための中級R

Preparing Video For Download...