Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishnakalyan3/8d356d430e40fe0d8b5bb25e6f0e4f8d to your computer and use it in GitHub Desktop.
Save krishnakalyan3/8d356d430e40fe0d8b5bb25e6f0e4f8d to your computer and use it in GitHub Desktop.
Introduction to R
---
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