Found 26504 Articles for Server Side Programming

Dealing with Missing Data in R

Bhuwanesh Nainwal
Updated on 17-Jan-2023 16:12:22

30K+ Views

In data science, one of the common tasks is dealing with missing data. If we have missing data in your dataset, there are several ways to handle it in R programming. One way is to simply remove any rows or columns that contain missing data. Another way to handle missing data is to impute the missing values using a statistical method. This means replacing the missing values with estimates based on the other values in the dataset. For example, we can replace missing values with the mean or median value of the variable in which the missing values are found. ... Read More

Data Manipulation in R with data.table

Bhuwanesh Nainwal
Updated on 17-Jan-2023 14:17:38

2K+ Views

Data manipulation is a crucial step in the data analysis process, as it allows us to prepare and organize our data in a way that is suitable for the specific analysis or visualization. There are many different tools and techniques for data manipulation, depending on the type and structure of the data, as well as the specific goals of the manipulation. The data.table package is an R package that provides an enhanced version of the data.frame class in R. It’s syntax and features make it easier and faster to manipulate and work with large datasets. The date.table is one ... Read More

Golang program to remove all elements from an array

Akhil Sharma
Updated on 17-Jan-2023 12:35:42

6K+ Views

In this tutorial, we will execute the program of removing all the elements of array using different set of examples. An array is a well-defined collection of elements stored at contiguous memory locations. The output is printed in the screen using fmt.Println() function. Let’s see few examples to get a clear understanding of this concept. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. It takes number of arguments. The first argument is the array to which we wish to add the values followed by the values to ... Read More

Golang program to get the first and last element from a slice

Akhil Sharma
Updated on 17-Jan-2023 12:32:32

2K+ Views

In this tutorial, we will discuss how to obtain the first and last element from a slice. A slice is a dynamic-sequence that stores elements of a similar type. It is similar to array but it can be resized whereas an array is of fixed range. Let’s understand the concept using some examples. Method 1: Using integer values In this method, we will use integer values to get the first and last element from a slice. The output will be printed on the screen using fmt.Println() function. Let’s go through the example to understand how it can be done. Algorithm ... Read More

Golang program to compare elements in two slices

Akhil Sharma
Updated on 17-Jan-2023 12:29:33

3K+ Views

In this tutorial, we will learn how to compare elements in two slices. In slices a simple equality comparison is not possible so the slices are compared with their lengths and the elements present in the loop. The output will be printed in the form of Boolean value on the console with the help of fmt.Println() function. Let’s see how to execute this with the help of an example. Method 1: Using a user-defined function In this method, we will compare elements in two slices using an external function and, in that function, we will set some conditions, if the ... Read More

Golang program to replace elements in a slice

Akhil Sharma
Updated on 17-Jan-2023 12:27:30

4K+ Views

In this tutorial, , we will grasp how to replace elements in a slice using different set of examples. A slice is a dynamic array which means that its value is not fixed like array. The output will be printed on the screen using fmt.Println() function. Let’s see how it can be implemented with crystal-clear examples. Method 1: Using built-in copy function In this method, we will use the built-in function copy to replace elements in slice which means at the place of original element and new element will be placed. The built-in functions shorten the code and easily solve ... Read More

Golang program to print a slice

Akhil Sharma
Updated on 17-Jan-2023 12:25:09

3K+ Views

In this tutorial, we will learn different methods to print a slice. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s understand this basic concept using different set of examples and algorithms based upon them. Method 1: Using make function In this method, we will create a slice with the help of make function and ... Read More

Golang program to reverse a slice

Akhil Sharma
Updated on 17-Jan-2023 12:19:09

4K+ Views

In this tutorial, we will learn how to reverse a slice using variety of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. It takes number of ... Read More

Golang program to search an element in the slice

Akhil Sharma
Updated on 17-Jan-2023 13:08:47

4K+ Views

In this tutorial, we will grasp how to search an element in slice using different set of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. It takes number of arguments. The first argument ... Read More

Golang program to remove an element from a slice

Akhil Sharma
Updated on 17-Jan-2023 12:03:48

1K+ Views

In this tutorial, we will learn how to remove an element from a slice using variety of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. Syntax func copy(dst, str[] type) int The copy function in go language is used to copy the values of ... Read More

Advertisements