Small example of R language---Simple data analysis and drawing

Source: Internet
Author: User


There are currently data on age and height ( fictional data)for children (males), who are interested in the relationship between elevated distribution and weight and age.

Age (years)

Weight (kg)

Age (years)

Weight (kg)

4

95

6

116

4

97

7

120

5

106

7

121

5

108

8

126

6

114

8

125

Use the function C () to enter the child's age and height data in vector form. Then, use some built-in functions to get the mean and standard deviation of height, as well as the correlation of age and weight.


> Age <-C (4,4,5,5,6,6,7,7,8,8) > Height <-C (95,97,106,108,114,116,120,121,126,125) > mean (height) [1] 112.8> SD (height) [1] 11.00303> cor (age,height) [1] 0.9822442> plot (age,height)




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Small example of R language---Simple data analysis and drawing

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.