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.

You May Also Like

News

What is LaMDA? The LaMDA is an AI (neural network) developed to realize natural conversations with humans by extracting information from a large amount...

Programming

In this article, we will create a simple timer app for beginners with Swift and SwiftUI. Step 1: Create a Header First, we will...

Programming

Swift optionals can be a bit confusing, in this article we’ll go into detail about optionals. We will look at how they can be...

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...