#RStudio #R #R_Programming_language
RStudio is an integrated development environment that allows you to create and manage projects using R language. R is a programming language for statistical computing and data visualization.
Sign up for an account at the RStudio Cloud in https://posit.cloud/

Create a New Project


This will open the RStudio Cloud console.

Then you need to install the packages to RStudio Cloud. Packages are units of reproducible R code.
First install tidyverse: the tidyverse is a collection of packages in R for data manipulation, exploration, and visualization. To install the core tidyverse packages and load them: in the bottom of the console, type install.packages(“tidyverse”) and press Enter.

To load the core tidyverse, type library(tidyverse) and press Enter

Many of the `tidyverse` packages contain sample datasets to practice `R` skills, e.g. the `diamonds` dataset (already loaded together with tidyverse package).
To preview the data use the `head()` function, which displays the columns and the first several rows of data.

Other useful functions to summarize or preview the data:
- str() and glimpse() functions will both return summaries of each column in your data arranged horizontally.
- the colnames() function returns a list of column names from your dataset
- the summarize() function generates a wide range of summary statistics for your data. For example, to know what the mean for `carat` was in this dataset use summarize(diamonds, mean_carat = mean(carat))
To clean data:
- the function to rename the columns, or variables, in your data is rename(), e.g.rename(diamonds, carat_new = carat, cut_new = cut)
To visualize data:
The most commonly used visualization packages is ggplot2, automatically loaded together tidyverse.
The code that takes the `diamonds` data, plots the carat column on the X-axis, the price column on the Y-axis, and represents the data as a scatter plot using the `geom_point()` command and changes the color of each point so that it represented another variable, such as the cut of the diamond is:


To create a different plot for each type of cut use the `facet_wrap()` function:

