開始使用免費開始

這台機器有多少個核心?

parallel 套件有個函式 detectCores(),可以用來判定機器上的核心數量。

這台機器有多少個核心?

本練習屬於課程

撰寫高效 R 程式碼

檢視課程

練習說明

  • 載入 parallel 套件。
  • 使用 detectCores() 函式,將核心數量存到名為 no_of_cores 的物件中。
  • 列印 no_of_cores

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Load the parallel package
___

# Store the number of cores in the object no_of_cores
no_of_cores <- ___

# Print no_of_cores
___
編輯並執行程式碼