Connect with us

Hi, what are you looking for?

Data Science

Creating Datasets and Manage Datasets In R!

Creating Datasets and Managae Datasets!
Creating Datasets and Managae Datasets!

We going to learn how to create datasets also, we’ll learn to control and analyze these datasets in R programming language, before starting this tutorial, you can read pulling datasets in the internet article to prepare.

Datasets are data types that data scientist works with, you can create these data structures yourself, which are mostly found on the internet. You can create a dataset in any field you want, take the data over the internet, or enter it manually.

How To Create Datasets?

You do not need any module to create datasets in R programming, you can create it with data.frames function. The data frames module combines the given vectors to create a dataset.

Movie_Name = c("Harry Potter" , "Iron Man")
Movie_Type = c("Science Finction" , "Action")
data.frame(Movie_Name , Movie_Type)

There are 2 columns in the above dataset, the movie name and genre indicate the element (data) in the lines below. vectorless, you can create a data frame like the example below.

data.frame(First = 1:20, Second = 1:20 , Third = 1:20)
Indexing Data Frame

You can use index methods as in lists to access data from Data Frameler, although it is a bit more complicated than lists, it is not very difficult to access. There are 3 different methods, let’s start with the first method.

d1 = data.frame(First = 1:5 , Second = 6:10 , Third = 11:15)
d1["First"] #Get Column

We can write the column name to draw the columns. If you have not named them, you can draw the lines with their numbers.

d1[1,] # Access the first line
d1[1,1] # Access first row, first column value
Commands For Datasets

We have already seen some commands in the data analysis in the R article, and we will examine a few new functions. The functions here will also be useful for initial analysis.

dim(d1) # Show row and column count

If you know the str and summary functions, you can see that the information there contains row and column information. If you only get these two pieces of information, you can use the dim function.

nrow(d1) # row count
ncol(d1) # column count

In the previous article, we could write the first 5 lines on the screen with the head function, and you can write the last 5 lines with the tail function.

tail(d1) # print last 5 row
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Cyber Security

In this article, we are going to examine real-world logic bombs. Also, we are going to create one with Python for seeing how to...

Cyber Security

Welcome to the second tutorial on networks for hackers. We are going to learn network types and weaknesses and strengths of networks in this...


In this tutorial, we going to learn file handling with Python. At the end of the article, you will be ready to work with...

Cyber Security

In this article, we going to learn how networking works and simple terms in networking. Also, we are going to learn simple network attacks....