Server Side Programming Articles

Page 1132 of 2109

How to find the fractional power of a negative number in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 389 Views

To find the fractional power of a negative number, we can find the power separately for the numerator and denominator where denominator will have the numerator 1. For example, if we have a vector called x that contains a single value -10 then the fractional power 15/7 of x can be found by using the command ((x)^15)^(1/7)Examplex1

Read More

How to test for significant relationship between two categorical columns of an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 745 Views

To test for the significance of proportion between two categorical columns of an R data frame, we first need to find the contingency table using those columns and then apply the chi square test for independence using chisq.test. For example, if we have a data frame called df that contains two categorical columns say C1 and C2 then the test for significant relationship can be done by using the command chisq.test(table(df$C1,df$C2))Examplex1

Read More

Golang Program to insert a node at the ith index node, when the index is at the 0th position in the linked list.

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 11-Mar-2026 468 Views

ExamplesApproach to solve this problemStep 1 − Define a method that accepts the head of a linked list.Step 2 − If head == nil, create a new node and make it head and return it as the new head.Step 3 − When index == 0, then update the head.Step 4 − Iterate the given linked list from its head. Also, initialize preNode that will keep the store address of the previous node.Step 5 − If index i matches with the given index, then then delete that node.next, break the loop.Step 6 − Return, at the end of loop.Examplepackage main import ...

Read More

Unsafe Operation in Rust Programming

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 284 Views

Unsafe Operations are done when we want to ignore the norm that Rust provides us. There are different unsafe operations that we can use, mainly:dereferencing raw pointersaccessing or modifying static mutable variablescalling functions or methods which are unsafeThough it is not recommended by Rust that we should use unsafe operations at all, we should use them only when we want to bypass the protections that are put in by the compiler.Raw Pointers In Rust, the raw pointers * and the references &T perform almost the same thing, but references are always safe, as they are guaranteed by the compiler to point ...

Read More

How to find the unique combinations of a string vector elements with a fixed size in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

A unique combination of vector elements can be found by using combn function with unique function and size argument will help us to identify the size of each of combination. For example, if we have a vector containing string values defined as x then the unique combinations of vector elements of size 2 can be created by using combn(unique(x),2).Example1x1

Read More

How to round exponential numbers in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

The exponential numbers are also called scientific numbers and these numbers have exponent representation by the letter e. For example, a number 12340000 can be represented as 1.234e + 107. We can round this to 1.2e + 107 and in R it can be done with the help of singif function.Example1x1

Read More

How to create a random sample of week days in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 499 Views

To create a vector of weekdays we can use the command weekdays(Sys.Date()+0:6) and if we want to create a random sample of week days then sample function can be used along with the weekdays command. For example, if we want to create a random sample of 20 days then it can be done as sample(weekdays(Sys.Date()+0:6),20,replace=TRUE).ExamplesExample1

Read More

How to split comma separated values in an R vector?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 12K+ Views

The splitting of comma separated values in an R vector can be done by unlisting the elements of the vector then using strsplit function for splitting. For example, if we have a vector say x that contains comma separated values then the splitting of those values will be done by using the command unlist(strsplit(x,",")).Examplex1

Read More

How to extract all string values from a vector in R with maximum lengths?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 247 Views

If we have a string vector then all the values in the vector are not likely to be of same size and we might be looking for smaller size or bigger size values. Therefore, if we want to extract all string values from a vector in R with maximum lengths even if there are duplicates can be done by using the max and nchar function as shown in the below examples.Examplex1

Read More

What is the use of set.seed in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

The set.seed helps to create the replicate of the random generation. If the name of the object changes that does not mean the replication will be changed but if we change the position then it will. Here, in the below example x4 in the first random generation and the x_4 in the second random generation with the same set.seed are same but x4 and x4 in both are different.Exampleset.seed(101) x1

Read More
Showing 11311–11320 of 21,090 articles
Advertisements