
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

2K+ Views
The na.omit performs any calculation by considering the NA values but do not include them in the calculation, on the other hand, na.rm remove the NA values and then perform any calculation. For example, if a vector has one NA and 5 values in total then their sum using na.omit will be calculated by excluding NA and by using na.rm it will be calculated by removing NA.Consider the below data frame −Example Live Demox1

2K+ Views
Performing Wilcoxon test for all columns in an R data frame means that we want to use this test for single samples and the Wilcoxon test for single sample is used to test for the median of the sample, whether the median is equal to something or not. And if we do not provide any value then zero is the reference value. To perform Wilcoxon test for all columns can be done with the help of apply function and wilcox.test as shown in the below example.Consider the below data frame −Example Live Demox1

375 Views
When we create a plot in base R the Y-axis values are generated automatically and mostly zero is now shown except in few cases that can’t be defined in particular but happens when there exists a zero in data. Therefore, if we want to include a zero with tick in base R plot then ylim argument can be used with the plot function.Exampleplot(5,ylim=c(0,5))OutputExampleplot(rnorm(100),ylim=c(-5,5))OutputExampleplot(rpois(10,2),ylim=c(0,10))Output

2K+ Views
A list in R can contain many types of elements such as vector, data frame, matrices, etc. Sometimes the order of these elements matter, especially in situations when we have large size elements because it is difficult to view large size elements of a list. This ordering can be done with the help of single square bracket and combine operator c as shown in the below examples.Example Live DemoList1

1K+ Views
Java provides certain classes called wrapper classes in the java.lang package. The objects of these classes wrap primitive datatypes within them.Using wrapper classes, you can also add primitive datatypes to various Collection objects such as ArrayList, HashMap etc. You can also pass primitive values over network using wrapper classes.ExampleLive Demoimport java.util.Scanner; public class WrapperExample { public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.println("Enter an integer value: "); int i = sc.nextInt(); //Wrapper class of an integer Integer obj ... Read More

471 Views
An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.Just like classes you can extend one interface from another using the extends keyword. You can also extend multiple interfaces from an interface using the extends keyword, by separating the interfaces using comma (, ) as −interface MyInterface extends ArithmeticCalculations, MathCalculations{ExampleFollowing is the Java program demonstrating, how to extend multiple interfaces from a single interface.interface ArithmeticCalculations{ public abstract int addition(int a, int b); public abstract int subtraction(int a, int b); } interface MathCalculations { public abstract double ... Read More

2K+ Views
To match a regular expression with the given string You need to:.Compile the regular expression of the compile() method of the Pattern class.Get the Matcher object bypassing the required input string as a parameter to the matcher() method of the Pattern class.The matches() method of the Matcher class returns true if a match occurs else it returns false. Therefore, invoke this method to validate the data.ExampleFollowing is a Java regular expression example matches only dateLive Demoimport java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Sample { public static void main(String args[]){ //Creating the list to ... Read More

2K+ Views
The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.One of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object. To parse/convert a string as a Date object Instantiate this class by passing desired format string.Parse the date string using the parse() method.You can get the epoch time using the getTime() method.ExampleLive Demoimport java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Sample { public static void main(String args[]) throws ParseException { //Instantiating the SimpleDateFormat class SimpleDateFormat dateformatter = new ... Read More

7K+ Views
The getTime() method of the Date class retrieves and returns the epoch time (number of milliseconds from Jan 1st 1970 00:00:00 GMT0.ExampleLive Demoimport java.util.Date; public class Sample { public static void main(String args[]){ //Instantiating the Date class Date date = new Date(); long msec = date.getTime(); System.out.println("Milli Seconds: "+msec); } }OutputMilli Seconds: 1605160094688The getTimeInMillis() method of the calendar class retrieves and returns the time in milli seconds from the epochepoch time (Jan 1st 1970 00:00:00 GMT).ExampleLive Demoimport java.util.Calendar; public class Sample { public static ... Read More

2K+ Views
The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.One of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object.To format milli seconds to date −Create the format string as dd MMM yyyy HH:mm:ss:SSS Z.The Date class constructor accepts a long value representing the milliseconds as a parameter and creates a date object.Finally format the date object using the format() method.Exampleimport java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Sample { public static void main(String args[]) throws ParseException { ... Read More