(R Example for Citizen Data Scientist & Business Analyst) Check if a Number is Odd or Even in R Programming In this example, a number entered by the user is checked whether it’s an odd number or an even number. Example: Check Odd and Even Number # Program to check if the input …
Day: February 5, 2021
(R Example for Citizen Data Scientist & Business Analyst) R Program to Check for Leap Year This program checks whether an year (integer) entered by the user is a leap year or not. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Print the Fibonacci Sequence In this example, you’ll learn to print the Fibonacci sequence using a while loop. A Fibonacci sequence is the integer sequence of 0, 1, 1, 2, 3, 5, 8…. The first two terms are 0 and 1. All …
(R Example for Citizen Data Scientist & Business Analyst) R Program to check Armstrong Number In this example, you’ll learn to check whether a number is an Armstrong number or not using a while loop. An Armstrong number, also known as narcissistic number, is a number that is equal to the sum of …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Check Prime Number Example to check whether an integer (entered by the user) is a prime number or not using control statements. A positive integer greater than 1 which has no other factors except 1 and the number itself is called …
(R Example for Citizen Data Scientist & Business Analyst) R Multiplication Table In this example, you will learn to print the multiplication table of a number (entered by the user) from 1 to 10. Example: Multiplication Table # R Program to find the multiplicationtable (from 1 to 10) # take input from the …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Find the Factorial of a Number In this example, you’ll learn to find the factorial of a number without using a recursive function. The factorial of a number is the product of all the integers from 1 to that number. For …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Sort a Vector In this example, you’ll learn to sort a vector in R using sort() function. Sorting of vectors can be done using the sort() function. By default, it sorts in ascending order. To sort in descending order we can pass decreasing=TURE. Note …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Find Minimum and Maximum In this example, you’ll learn to find the minimum and maximum numbers from a list using min() and max() function respectively. You’ll also learn to use the range() function. We can find the minimum and the maximum …
(R Example for Citizen Data Scientist & Business Analyst) R Program to Sample from a Population In this example, you will learn to take sample from a population using sample() function. We generally require to sample data from a large population. R has a function called sample() to do the same. We need to provide the …