
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

3K+ Views
To display the star for significance in a base R boxplot, we can use text function. The text function will be helpful in defining the star sign (that is asterisk or *). If the significance is high then three stars are used and the significance is low then a single star is used. We need to use the appropriate position using x and y values.Example Live DemoConsider the below data frame −x

3K+ Views
The creation of stacked bar plot using ggplot2 can be done with the help of position="stack" argument inside geom_bar function. If we want to create the stacked bar plot then geom_text function will be used with the same position argument and the aes to define the labels as shown in the below example.Example Live DemoConsider the mtcars data −head(mtcars)Outputmpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1Example Live Demodf

7K+ Views
An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.Since Java8 static methods and default methods are introduced in interfaces. Unlike other abstract methods these are the methods can have a default implementation. If you have default method in an interface, it is not mandatory to override (provide body) it in the classes that are already implementing this interface.In short, you can access the default methods of an interface using the objects of the implementing classes.ExampleLive Demointerface MyInterface{ public static int num = 100; public default ... Read More

46K+ Views
Most of the times, we need to use packages in R and some packages are restricted to different versions in R, generally to newer versions. Therefore, we might need to find which version of R we are using. To find the R version, we can directly use the command R.Version().Example Live DemoR.Version()Output$platform [1] "x86_64−w64−mingw32" $arch [1] "x86_64" $os [1] "mingw32" $system [1] "x86_64, mingw32" $status [1] "" $major [1] "4" $minor [1] "0.2" $year [1] "2020" $month [1] "06" $day [1] "22" $`svn rev` [1] "78730" $language [1] "R" $version.string [1] "R version 4.0.2 (2020−06−22)" $nickname [1] "Taking Off Again"We can ... Read More

4K+ Views
To save a plot in pdf, we can use the pdf function in base R. For example, if we want to save a plot with the name PDF then it can be done using the below command −pdf("PDF.pdf")After this we can create the plot and use dev.off().Examplepdf("pdfExample.pdf") plot(1:10)OutputExample Live Demodev.off()OutputTo check where it is saved, find the working directory using getwd().

2K+ Views
Sometimes all the columns in a data frame have similar data characteristics representing a particular variable. For example, having a data frame containing five columns each with heights of people. To convert this type of data frame into a vector we can use as.vector function along with the as.matrix function. The as.matrix will read the data frame columns so that the array of values can be created.Example1 Live DemoConsider the below data frame −set.seed(101) x1

15K+ Views
Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{}The class which inherits the properties is known as sub class or, child class and the class whose properties are inherited is super class or, parent class.In inheritance a copy of super class members is created in the sub class object. Therefore, using the sub class object you can access the members of the both classes.Multiple inheritance is where one class inherits the properties of multiple classes. In other words, ... Read More

10K+ Views
Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{}The class which inherits the properties is known as sub class or, child class and the class whose properties are inherited is super class or, parent class.In inheritance a copy of super class members is created in the sub class object. Therefore, using the sub class object you can access the members of the both classes.Converting a super class reference variable into a sub class typeYou can try to convert ... Read More

366 Views
To create a step histogram using ggplot2, we can use geom="step" argument inside stat_bin function. For example, if we have a data frame that contains a single column then the step histogram can be created using the command − ggplot(df,aes(x))+stat_bin(geom="step",bins=30)Example Live DemoConsider the below data frame −set.seed(14) x