Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 156 of 196

How to create a line that passes through specified points in an R plot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 21-Nov-2020 791 Views

To create a line that passes through specified points, we first need to create the plot then using plot function then xspline function can be used to join the points with straight lines. The xspline function is specifically designed to draw curves and hence it can be also used to join points in a plot as shown in the below examples.Example1> plot(rpois(10,5)) > xspline(c(4,3,1),c(7,5,2))Output:Example2> plot(rnorm(10)) > xspline(c(4,3,1),c(0.3,-0.5,-1.5))Output:

Read More

How to create two 3d plots at a time in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 21-Nov-2020 290 Views

The rgl package is specifically designed to create real-time interactive 3D plots and we can create two 3d plots using plot3d function of this package. Also, these plots can be viewed in the R console at a single point of time with the help of open3d() function.ExampleLoading rgl package:Example> library(rgl) > x y z plot3d(x,y,z)OutputExample> open3d() wgl 12 > plot3d(x,y,z,col=rainbow(5))Output

Read More

How to display the superscript for a single variable in a base R plot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 21-Nov-2020 194 Views

To display the superscript in a base R plot, we would need to use expression function inside text function. For example, if we want to display X-square inside a blank plot in base R then we can use the below code:plot(1:10,type="n") text(2,2,expression(X^2))Example1> plot(1:10,type="n") > text(2,2,expression(X^2==4))Output:Example2> text(5,5,expression(X^5==Center))Output:Example3> text(9,9,expression(Squared^2))Output:

Read More

How to create a sphere in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 21-Nov-2020 713 Views

To create a sphere, we can use spheres3d function of rgl package. The rgl package is specifically designed to create real-time interactive 3D plots. If we want to create a sphere then we need to pass the values for the three axes and the radius of the sphere. We can also change the color of the sphere by introducing color argument inside spheres3d function.Example1Loading rgl package and creating a sphere:> library(rgl) > spheres3d(x=1,y=1,z=1,radius=1)Output:Example2> spheres3d(0,0,0,radius=1,color="blue")Output:Example3> spheres3d(0,0,0,radius=1,color="red")Output:

Read More

How to get the list of packages installed in base R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 19-Nov-2020 713 Views

There is no limitation to installation of packages in R but base R also has some packages associated to it. Hence, there is no need to install or load them in R console every time. We can directly use any of the base R package functions to perform the analysis. If we want to get the list of these package then we can use the code as shown below:Example> installed.packages(priority="base")OutputPackage LibPath Version Priority base "base" "C:/Program Files/R/R-4.0.2/library" "4.0.2" "base" compiler "compiler" "C:/Program Files/R/R-4.0.2/library" "4.0.2" "base" datasets "datasets" "C:/Program Files/R/R-4.0.2/library" "4.0.2" "base" graphics "graphics" "C:/Program Files/R/R-4.0.2/library" "4.0.2" "base" grDevices "grDevices" "C:/Program ...

Read More

How to create QR code in R?

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

A QR code is a barcode which is used to read the information about the object on which it is printed. This helps us to detect the useful information relevant to the object so that we can proceed with the next step depending on the operation. In R, we can create QR code by using qrcode_gen function of qrcode package.Example1Loading qrcode package:> library(qrcode)Creating a QR code for tutorialspoint:> qrcode_gen('www.tutorialspoint.com')Output:Example2> qrcode_gen('www.tutorix.com')Output:Example3> qrcode_gen('www.r-project.org')Output:

Read More

How to add a picture to plot in base R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 19-Nov-2020 5K+ Views

To add a picture to a plot in base R, we first need to read the picture in the appropriate format and then rasterImage function can be used. The most commonly used format for picture in R is PNG. A picture in PNG format can be added to a plot by supplying the values in the plot where we want to add the picture.ExampleLoading png package:> library(png)Reading png file:> Picture plot(1:10,ty="n")Output:Adding the picture in png file to the above plot:Example> rasterImage(Picture,3,3,7,7)Output:Example> plot(1:10,ty="n") > rasterImage(Picture,5,5,7,7)Output:

Read More

How to perform cartesian join for two data.table objects in R?

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

The cartesian join is the joining of two objects that creates the combination of each value in object with all the values in the other object. For example, if we have a vector x that contains 1, 2, 3 and the other object y contains a, b, c then the cartesian join will be 1a, 2a, 3a, 1b, 2b, 3b, 1c, 2c, and 3c. Check out the below examples to understand how it can be done.Example> library(data.table) > DT1 DT1Output x 1: 1 2: 2 3: 3 4: 4Example> DT2 DT2Output y 1: 25 2: ...

Read More

How to create a blank csv file in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 19-Nov-2020 747 Views

We can create a blank csv file using a single line code in R and the function that can do this is cat. If we want to have the file blank then NULL value will be passed inside the function and the file name must be used. For example, if we want to create a blank file named as BlankCSV then it can be created by using the below code:> cat(NULL, file="BlankCSV.csv")Output:This is the output from documents folder of the system where all the R files are stored by default(we can change that location if we want to):The output of ...

Read More

How to determine if C# .NET Core is installed?

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

The following options are for dotnet by itself. For example, dotnet −−info. They print out information about the environment if not installed it will throw error.−−infoPrints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.−−versionPrints out the version of the .NET Core SDK in use.−−list−runtimesPrints out a list of the installed .NET Core runtimes. An x86 version of the SDK lists only x86 runtimes, and an x64 version of the SDK lists only x64 runtimes.−−list−−sdksPrints out a list of the installed .NET Core ...

Read More
Showing 1551–1560 of 1,958 articles
« Prev 1 154 155 156 157 158 196 Next »
Advertisements