Basic Steps to Learn R

Ross Ihaka and Robert Gentleman created R as a statistical and graphical analysis system. It…

Ross Ihaka and Robert Gentleman created R as a statistical and graphical analysis system. It is commonly used by data analysts and data journalists to analyze and visualize data.

R is not only in the form of software, it is also a programming language that has its language characteristics.

What? Programming language? Do you have to be able to code?

Don’t panic just yet! It’s not a big problem if you don’t have basic coding skills. Because like a language, it can be learned and if it gets stuck, there are still search engines and ‘stack overflow’ that can help. For more information: r assignment help and Let’s just get started!

Install R and RStudio

R can be operated without RStudio. However, the emergence of RStudio makes it easier for R users. So, apart from installing R, you also have to install RStudio.

Install R here, and select the latest version.

Install R studio here, choose the one that suits your computer/laptop operating system.

Starting a New Project

Before creating your first project in RStudio, create a special folder for one project. This folder will later be a place to store all files that are processed or exported with R. This folder will also be a place to store R projects.

When RStudio is opened, click File > New Project > Existing Directory > select the folder you just created as the location for the new project directory.

A new file with the extension. R Proj will appear in the folder. If later you want to continue the project or want to look back on what you’ve done, just open the file.

See also  Proof of What? 5 Key Crypto Mechanisms Defined

Understanding “R Packages” and “Libraries”

“R Packages” are a collection of functions developed by the R user community. They strengthen R’s performance as a tool and language for processing and visualizing data.

By default, R already has built-in functions and packages. Package “dplyr” includes the most popular for processing data. However, imagine if you have to process data written in Arabic script, for example. Certain packages are required. In this case, “ArabicStemR” can be used for text analysis.

Currently, there are more than 10,000 R Packages available and can be used by R users. Perhaps you are asking, how to determine the R Packages that suit my needs?

The easiest and most effective way is to use a search engine. To create a map, for example, try typing: R Packages to create a map.

To confirm the functionality of a particular package, you can look at its description with a simple function:

packageDescription(“package name”)

To see the documentation that explains the functions in the package:

help(package = “package name”)

Another easier way is to click ‘help’ at the bottom right and type the package name in the ‘search’ field.

To be able to use certain packages, they must be installed and included in the library. For example, I want to use the ‘jsonlite’ package (to process data with formant json), then:

install.packages(‘jsonlite’)

Then, make sure to save it to the ‘library’ for later use. The method:

Library(‘jsonlite’)

List of some useful packages for data journalists: https://support.rstudio.com/hc/en-us/articles/1057987-Quick-list-of-useful-R-packages

Use ‘Notebooks’!

When I first learned R, I wrote all the code in the ‘console’. After studying, everything is lost. So don’t be like me!

See also  What are NFT video games and the way do they really work?

Get in the habit of writing code in “Notebook” because you can save it and look at it again if you need it later.

Click File > New File > R Notebook

The code in R Notebook is written between chunks:

“`{r}

Write code here, then click the run or play button

Import and Save Data

Like most programming languages, R allows users to import and store certain data in an object called a variable.

The variable name can be anything. It can consist of words or even just letters.

However, try to avoid the following letters as they have their meaning in R: c, q, s, t, C, D, F, I, and T.

If you want to import data, save it to the same folder as yours. R Proj file. That way, you no longer need to write down the detailed path. To store your data in a single variable:

yourvariable <- read.CSV(‘filename.CSV)

In this case, ‘filename.csv’ is your data in CSV format. Next, if you want to use that data in a function, just use ‘your variable’. For more details: r programming help

Summary of Statistics

R was created for statistical analysis. It has basic functions that allow you to quickly get summary statistics from a dataset. The method:

summary(your variable)

For data that contains numbers and values, you will get a summary in the form of:

Minimum value

median

mean

Greatest value

How many N/A cells are there?

With Sheets, you can get those results by entering the formulas one by one. In R, you get it once guys.

See also  Greatest Stream2Watch Alternate options to Look Ahead in 2022

For data containing words instead of numbers, the function will give us the six most frequently occurring words with the number of times they occur.