Articles on Trending Technologies

Technical articles with clear explanations and examples

Difference between single quote (') and double quote (") in PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 09-Nov-2020 6K+ Views

There is no such difference between the single quote (‘) and double quote(“) in PowerShell. It is similar to a programming language like Python. We generally use both quotes to print the statements.ExamplePS C:\> Write-Output 'This will be printed using Single quote' This will be printed using Single quote PS C:\> Write-Output "This will be printed using double quote" This will be printed using double quoteBut when we evaluate any expression or print variable it makes a clear difference.$date = Get-Date Write-Output 'Today date is : $date' Today date is : $date Write-Output "Today date is : $date" Today date ...

Read More

How to find the distance among matrix values in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 244 Views

Finding the distance among matrix values means that we want to find the distance matrix and it can be directly found by using dist function with the matrix name. For example, suppose we have a matrix of size 5x5 named as M then the distance matrix can be calculated as dist(M).Example1M1

Read More

How to plot the X-axis labels on the upper-side of the plot in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 1K+ Views

By default, the X−axis labels are plotted on the bottom−axis of the plot and that is referred to as the first axis of axis 1, the second axis is the axis on the left−side, the third axis is the axis on the upper side of the plot, and the fourth axis is on the right−side of the plot. If we want to plot the X−axis labels on the upper−side of the plot then we can use xaxt="n" inside the plot function then define axis for upper−side using axis(3) with semi−colon.Example1x

Read More

How to add a data frame inside a list in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 3K+ Views

A list may contain many objects such as vector, matrix, data frame, list etc. In this way, we can have access to all the necessary objects at the same time. If we want to add a data frame inside a list then we can use the length of the list. For example, if we have a list defined as List and we want to add a data frame df to the List then it can be added as follows −List[[length(List)+1]]

Read More

How to create polynomial regression model in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 1K+ Views

A Polynomial regression model is the type of model in which the dependent variable does not have linear relationship with the independent variables rather they have nth degree relationship. For example, a dependent variable x can depend on an independent variable y-square. There are two ways to create a polynomial regression in R, first one is using polym function and second one is using I() function.Example1set.seed(322) x1

Read More

How to change the thickness of the borders of bars in bar plot created by using ggplot2 in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 4K+ Views

The border thickness highlights the bars and this could be useful in situations where we have similar frequencies. If we want to change the thickness of the bars then size argument under geom_bar function of ggplot2 package can be used and it can be set according to our need starting from 1.ExampleConsider the below data frame −x

Read More

How to create geometric progression series in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 2K+ Views

A geometric progression series is a sequence of numbers in which all the numbers after the first can be found by multiplying the previous one by a fixed number. To generate a geometric progression series in R, we can use seq function. For example, to generate a geometric progression series of 2 by having the difference of multiplication value equal to 1 up to 5 can be found as 2^seq(0, 5, by=1) and the output would be 1, 2, 4, 8, 16, 32.Examples2^seq(0, 5, by=1) [1] 1 2 4 8 16 32 2^seq(0, 5, by=2) [1] 1 4 16 2^seq(0, ...

Read More

How to combine two columns of a data.table object in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 3K+ Views

A data.table object is almost same as a data frame. To combine two columns of a data.table object, we can use paste0 function. For example, if we have a data frame defined as DT that contains two columns named as x and y then we can combine them using the below command.DT[, xy:=paste0(x, y)]ExampleLoading data.table package.> library(data.table)Consider the below data.table object.Example> x y dt1 dt1Outputx y 1: 1 a 2: 2 b 3: 3 c 4: 4 d 5: 5 e 6: 6 f 7: 7 g 8: 8 h 9: 9 i 10: 10 j 11: 11 k 12: ...

Read More

How to extract a data.table row as a vector in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 2K+ Views

A data.table object is similar to a data frame object but there are few things that can be specifically applied to a data.table because data.table package functions was defined for a data.table object only. If we want to extract a data.table row as a vector then we can use as.vector function along with as.matrix so that the as.vector can read the row properly.Loading data.table package:> library(data.table)Consider the below vectors and create a data.table object:Example> x1 x2 x3 x4 x5 DT1 DT1Outputx1 x2 x3 x4 x5 1: B C C D E 2: B C D B E 3: B C ...

Read More

How to create a bar chart using ggplot2 with dots drawn at the center of top edge of the bars in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Nov-2020 745 Views

Aesthetics is one of the most important aspect of a chart, hence we should try to use the best possible aesthetic properties in a plot. In a bar chart, we can represent the center of bars in many ways and one such way is using dots at the center of the top edge of the bars. We can use geom_point function by defining colour argument to put points at the center of top edge of the bars in a bar chart created by using ggplot2.ExampleConsider the below data frame:> freq df dfOutputx freq 1 Mango 212 2 Guava 220 3 ...

Read More
Showing 51041–51050 of 61,299 articles
Advertisements