> For the complete documentation index, see [llms.txt](https://compgenomr.kaopubear.top/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://compgenomr.kaopubear.top/02/2.3-r-zhong-de-ji-suan.md).

# 2.3 R 中的计算

R 可以当作普通计算器来使用，也有人说 R 其实就是一个非常复杂的计算器。这里有一些例子，请记住 `#` 是注释字符，注释给出了操作的细节含义。

```r
2 + 3 * 5       # 注意运算符的优先级.
log(10)        # 以e为底的自然对数
5^2            # 5的平方
3/2            # 除法
sqrt(16)      # 开平方
abs(3-7)      # 绝对值
pi             # 数字
exp(2)        # 指数函数
# 这是注释
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://compgenomr.kaopubear.top/02/2.3-r-zhong-de-ji-suan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
