Connect with us

Hi, what are you looking for?

Data Visualization Practice

Data Visualization In R

In this practice, we going to data visualization practice for game data. we will try to visualize the data in the game, what you need to know before starting this training is stated under this paragraph.

Creating Score Dataset

We need a basic high score for pulling score data, we can create this dataset in r with data.frame function if you read the previous article you know creating datasets if you don’t know please read Creating Dataset In R.

```Player_Name = c("Player1" , "Player2" , "Player3" , "Player4" , "Player5" , "Player6")
Game_Score = c(100 , 200 , 300 , 200 , 350 , 1200)

Game_Table = data.frame(Player_Name , Game_Score)```
Comparing Scores On a Chart

The easiest way to read our data is to analyze it in a chart first, because this dataset is small, let’s examine the data in the chart in the other example, we will follow a different path for the large dataset.

```Player_Index = c(1 , 2 , 3 , 4 , 5 , 6)
barplot(Player_Index , Game_Score)```

The chart we create is simple but useful now let’s sort them by value and then make them more useful with labels and styles. When we start working with large data sets, we’ll see why more complex graphs are important.

```past = 0
list = c()
count = 0

for(i in Game_Score)
{
count = count + 1
if(i > past)
{
list[count] = i
}
past = i
}```

It is more accurate to leave the style phase and label insertion operations to the end of your projects while we have a new dataset ready, and we will create a chart using this dataset. You will understand why we use these described concepts when we move to large data sets.

`barplot(list , Game_Score)`

To use sorted data, we use the list data type, add labels, and install them from this standard chart.

```barplot(list , Game_Score , xlab = "Player Index" , ylab = "Score",
col = "red" , density = 10 , border = "black" , main = "Game Score Char")

# density = determines the color ratio inside the column.
# border = Determines the color of the edges```

We’ve finished the basic editing, we haven’t learned a few of these arguments, so you can find the list below, it would be good to learn these arguments before moving on to the next project.

Comparing Large Datasets on Graphic

Creating graphics with big data can be more complicated, you can download the dataset we will use in this example from here, this graphic gives us the important values of the movies.

```film <- read.csv2("film.csv") # Reading dataset
str(film) # Detail this dataset```

After getting the details, we can start to create the chart, in this example we will examine the movie times by years.

`barplot(strtoi(film\$Length[2:20]) , strtoi(film\$Year[2:20]))`

The arguments here may have confused you, after looking we can see why we made such a graph. The strtoi function converts string data to int data type, [2:20] the reason for specifying indexes is that the initial value is NA.

This graph gives the duration of the movie by years and shows the duration of the movie by comparing it and shows how long the audience watched at what time.

```plot(strtoi(film\$Year[1:50]) , strtoi(film\$Popularity[1:50]) ,
xlab = "Year" , ylab = "Popularity") # Popularity and Year```
Click to comment

Cyber Security

TCP/IP is a set of rules that allow computers to communicate with each other on a network such as the Internet. Currently, we do...

Cyber Security

Search engines are filled with more and more data and information every day. Search engines are your best friend when you want to gather...

News

According to a study from Dartmouth College, Dartmouth’s Tuck School of Business, and Indiana University, artificial intelligence systems can be trained to produce human-like...

Cyber Security

There is a systematic order (layer ordering) in networks for data transfer to occur. These layers are responsible for transmitting the data to the...

©️Copyright 2020 - 2021 My Master Designer | All Right Reserved