Programming Articles

Page 1587 of 2547

How to solve the simultaneous linear equations in R?

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

The data in simultaneous equations can be read as matrix and then we can solve those matrices to find the value of the variables. For example, if we have three equations as −x + y + z = 6 3x + 2y + 4z = 9 2x + 2y – 6z = 3then we will convert these equations into matrices and solve them using solve function in R.Example1> A AOutput   [, 1] [, 2] [, 3] [1, ] 1    1    2 [2, ] 3    2    4 [3, ] 2    3    -6> b bOutput[, 1] ...

Read More

string.sub() function in Lua

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 81K+ Views

Another important function of the Lua’s string library is the string.sub() function. The string.sub() function is used to extract a piece of the string.The string.sub() function takes three arguments in general, the first argument being the name of the string from which we want to extract a piece, the second argument is the i-th index or say, the starting index of the string piece that we want, and the third and the last argument is the j-th index of the last index of the string piece we want.It should be noted that both the starting index and the ending index, ...

Read More

How to remove a character in an R data frame column?

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

To remove a character in an R data frame column, we can use gsub() function which will replace the character with blank. For example, if we have a data frame called df that contains a character column say x which has a character ID in each value then it can be removed by using the command gsub("ID", "", as.character(df$x)).Example1Consider the below data frame −> x1 x2 df1 df1Output        x1  x2 1    Male1  8 2  Female1  4 3    Male1  9 4    Male1  2 5    Male1  7 6  Female1  5 7    Male1  3 8 ...

Read More

How to convert more than one column in R data frame to from integer to numeric in a single line code?

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

To convert columns of an R data frame from integer to numeric we can use lapply() function. For example, if we have a data frame df that contains all integer columns then we can use the code lapply(df,as.numeric) to convert all of the columns data type into numeric data type.Example1Consider the below data frame −set.seed(871) x1

Read More

Difference between HashMap and HashSet in Java.

Nitin Sharma
Nitin Sharma
Updated on 11-Mar-2026 27K+ Views

HashMap and HashSet both are one of the most important classes of Java Collection framework.Following are the important differences between HashMap and HashSet.Sr. No.KeyHashMapHashSet1ImplementationHashmap is the implementation of Map interface.Hashset on other hand is the implementation of set interface.2Internal implementationHashmap internally do not implements hashset or any set for its implementation.Hashset internally uses Hashmap for its implementation.3Storage of elementsHashMap Stores elements in form of key-value pair i.e each element has its corresponding key which is required for its retrieval during iteration.HashSet stores only objects no such key value pairs maintained.4Method to add elementPut method of hash map is used to ...

Read More

C++ Stream Classes Structure

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 28K+ Views

In C++ stream refers to the stream of characters that are transferred between the program thread and i/o.Stream classes in C++ are used to input and output operations on files and io devices. These classes have specific features and to handle input and output of the program.The iostream.h library holds all the stream classes in the C++ programming language.Let's see the hierarchy and learn about them, Now, let’s learn about the classes of the iostream library.ios class − This class is the base class for all stream classes. The streams can be input or output streams. This class defines members that ...

Read More

Java Program to count letters in a String

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 22K+ Views

Let’s say we have the following string, that has some letters and numbers.String str = "9as78";Now loop through the length of this string and use the Character.isLetter() method. Within that, use the charAt() method to check for each character/ number in the string.for (int i = 0; i < str.length(); i++) {    if (Character.isLetter(str.charAt(i)))    count++; }We have set a count variable above to get the length of the letters in the string.Here’s the complete example.Examplepublic class Demo {    public static void main(String []args) {       String str = "9as78";       int count = ...

Read More

C Program for LowerCase to UpperCase and vice-versa

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 85K+ Views

Here is the program to convert a string to uppercase in C language,Example#include #include int main() {    char s[100];    int i;    printf("Enter a string : ");    gets(s);    for (i = 0; s[i]!='\0'; i++) {       if(s[i] >= 'a' && s[i] = 'a' && s[i] = 'A' && s[i] = 'A' && s[i]

Read More

How to find the R version you are using?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 47K+ 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().ExampleR.version.stringOutput[1] "R version 4.0.2 (2020−06−22)"

Read More

How to create date object in Java?

Maruthi Krishna
Maruthi Krishna
Updated on 11-Mar-2026 34K+ Views

Using the Date classYou can create a Date object using the Date() constructor of java.util.Date constructor as shown in the following example. The object created using this constructor represents the current time.Exampleimport java.util.Date; public class CreateDate {    public static void main(String args[]) {             Date date = new Date();       System.out.print(date);    } }OutputThu Nov 02 15:43:01 IST 2018Using the SimpleDateFormat classUsing the SimpleDateFormat class and the parse() method of this you can parse a date string in the required format and create a Date object representing the specified date.Exampleimport java.text.ParseException; import java.text.SimpleDateFormat; ...

Read More
Showing 15861–15870 of 25,466 articles
Advertisements