Created
April 9, 2020 15:52
-
-
Save krishnakalyan3/8d356d430e40fe0d8b5bb25e6f0e4f8d to your computer and use it in GitHub Desktop.
Introduction to R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Introduction to R" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` | |
## Vector | |
This is a vector | |
```{r} | |
vector <- c(1,2,3,4,5) | |
``` | |
## Mean | |
Mean is basically adding numbers and divided by the count. | |
```{r} | |
vector <- c(1,2,3,4,5) | |
mean(vector) | |
``` | |
## Strings | |
We learnt that vectors can hold strings | |
```{r} | |
vs <- c("Krishna", "Adi", "Niyati") | |
``` | |
## Plot | |
We learnt about plotting below is an example of scatter plot | |
```{r} | |
age <- c(13, 13, 16, 16, 11.5, 11, 8) | |
weight <- c(48, 60, 50, 32, 34, 28, 48) | |
plot(x=age,y=weight, main="Age Group", xlab = "Age", | |
ylab = "Weight", pch=19, col="red") | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment