Introduction to the basics of R language

Source: Internet
Author: User
Tags natural logarithm

Tutorial: Common arithmetic functions. Common functions for operations on general data:

1, round () #四舍五入Example: X <-C (3.1416, 15.377, 269.7) round (x, 0) #保留整数位round (x, 2) #保留两位小数round (x,-1) #保留到十位 2, signif () #取有效数字 (with a valid number learned is not a meaning)Example: slightly 3, Trunc () #取整Floor () #向下取整 ceiling () #向上取整例: xx <-C (3.60, 12.47, -3.60, -12.47) trunc (xx) floor (xx) ceiling (XX) 4, LOGB (A, B) #以b为底的对数, omit B to indicate natural logarithmLog () #自然对数 log10 () #以10为底的常用对数例: LOGB (8, 2) log (8); LOGB (8) log10 (100); LOGB (100, 10) 5, sqrt () #平方根exp () #指数 6. Sin () #正弦cos () #余弦 tan () #正切 ASIN () #反正弦 ACOs () #反余弦 atan () #反正切 sinh () #双曲正弦 tanh () #双曲正切 7, nchar () #字符长度Example: XX <-' China is a great country ' nchar (XX) 8, substring () #取子字符串Example: substring (XX, 1, 5) 9, paste () #连接字符The syntax is: Paste (..., Sep = "", collapse = NULL) example 1:x <-' I '; Y <-' am '; Z <-' a '; D <-' student ' paste (x, Y, Z, D) example 2:paste (C (' x ', ' y '), 1:4, Sep = ') example 3:paste (' x ', 1:4, Sep = ', collapse = ' + ')

Introduction to the basics of R language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.