R is a programming language possesses an extensive catalog of statistical and graphical methods. It includes machine learning algorithm, linear regression, time series, statistical inference to name a few. Most of the R libraries are written in R,but many large companies also use R programming language, including Uber, Google, Airbnb, Facebook and so on

AD1

Email subscriptions

Enter your email address:

Delivered by FeedBurner

Showing posts with label Data as vectors. Show all posts
Showing posts with label Data as vectors. Show all posts

Tuesday, November 27, 2018

Data as vectors, using R

Data as vectors, using R the function c()

> age <- c(1,3,5,2,11,9,3,9,12,3)
> weight <- c(4.4,5.3,7.2,5.2,8.5,7.3,6.0,10.4,10.2,6.1)
> age <- c(1,3,5,2,11,9,3,9,12,3)
> mean(weight)
[1] 7.06
> sd(weight)
[1] 2.077498
> cor(age,weight)
[1] 0.9075655
> plot(age,weight)
> q()
R-programming-statistics



You can see from listing that the mean weight for these 10 infants is 7.06 kilograms, that the standard deviation is 2.08 kilograms, and that there is a strong linear relationship between age in months and weight in kilograms (correlation = 0.91). The relationship can also be seen in the scatter plot in figure  Not surprisingly, as infants get older, they tend to weigh more. The scatter plot in the figure is informative but somewhat utilitarian and unattractive.

a