- R Programming By Example
- Omar Trejo Navarro
- 144字
- 2021-07-02 21:30:36
Numerics
Numbers in R behave pretty much as you would mathematically expect them to. For example, the operation 2 / 3 performs real pision, which results in 0.6666667 in R. This natural numeric behavior is very convenient for data analysis, as you don't need to pay too much attention when using numbers of different types, which may require special handling in other languages. Also the mathematical priorities for operators applies, as well the use of parenthesis.
The following example shows how variables can be used within operations, and how operator priorities are handled. As you can see, you may mix the use of variables with values when performing operations:
x <- 2 y <- 3 z <- 4 (x * y + z) / 5
#> [1] 2
The modulo operation can be performed with the %% symbol, while integer pision can be performed with the %/% symbol:
7 %% 3
#> [1] 1 7 %/% 3
#> [1] 2
- 傳感器技術實驗教程
- Python Artificial Intelligence Projects for Beginners
- 程序設計缺陷分析與實踐
- 數據中心建設與管理指南
- 嵌入式Linux上的C語言編程實踐
- 電腦主板現場維修實錄
- Storm應用實踐:實時事務處理之策略
- Visual FoxPro數據庫基礎及應用
- Pentaho Analytics for MongoDB
- C++程序設計基礎(上)
- Learning Apache Apex
- 步步驚“芯”
- PowerPoint 2010幻燈片制作高手速成
- 精通ROS機器人編程(原書第2版)
- Hands-On Agile Software Development with JIRA