Title: | Imports Excel Functions to R |
---|---|
Description: | Implements 'Excel' functions in 'R' for your calculation simplicity.You can use most of the aggregate functions, addressing functions,logical functions and text functions. Helps you a ton in learning how 'R' works as some 'Excel' users might be struggling with the program. |
Authors: | Irakli Salia <[email protected]> |
Maintainer: | Nika Salia <[email protected]> |
License: | GPL-3 |
Version: | 0.1.4 |
Built: | 2025-02-16 03:30:19 UTC |
Source: | https://github.com/cran/ExcelFunctionsR |
It acts similiarly to Excel's AND function. You give the function logical arguments and it either returns true or false.
AND( logical1, logical2 = TRUE, logical3 = TRUE, logical4 = TRUE, logical5 = TRUE, logical6 = TRUE, logical7 = TRUE, logical8 = TRUE, logical9 = TRUE, logical10 = TRUE, logical11 = TRUE, logical12 = TRUE, logical13 = TRUE, logical14 = TRUE, logical15 = TRUE, logical16 = TRUE, logical17 = TRUE, logical18 = TRUE, logical19 = TRUE, logical20 = TRUE, logical21 = TRUE, logical22 = TRUE, logical23 = TRUE, logical24 = TRUE, logical25 = TRUE, logical26 = TRUE, logical27 = TRUE, logical28 = TRUE, logical29 = TRUE, logical30 = TRUE, logical31 = TRUE, logical32 = TRUE )
AND( logical1, logical2 = TRUE, logical3 = TRUE, logical4 = TRUE, logical5 = TRUE, logical6 = TRUE, logical7 = TRUE, logical8 = TRUE, logical9 = TRUE, logical10 = TRUE, logical11 = TRUE, logical12 = TRUE, logical13 = TRUE, logical14 = TRUE, logical15 = TRUE, logical16 = TRUE, logical17 = TRUE, logical18 = TRUE, logical19 = TRUE, logical20 = TRUE, logical21 = TRUE, logical22 = TRUE, logical23 = TRUE, logical24 = TRUE, logical25 = TRUE, logical26 = TRUE, logical27 = TRUE, logical28 = TRUE, logical29 = TRUE, logical30 = TRUE, logical31 = TRUE, logical32 = TRUE )
logical1 , logical2 , logical3 , logical4 , logical5 , logical6 , logical7 , logical8 , logical9 , logical10 , logical11 , logical12 , logical13 , logical14 , logical15 , logical16 , logical17 , logical18 , logical19 , logical20 , logical21 , logical22 , logical23 , logical24 , logical25 , logical26 , logical27 , logical28 , logical29 , logical30 , logical31 , logical32
|
Specify logicals as arguments. The function follows OR logic. |
In the example we take a built-in dataset called iris and see which species are called setosa and which one has a petal length of 1.4. If both of these conditions return true then the final answer will also be true. Function will always return a logical class.
AND(iris$Species == "setosa", iris$Petal.Length == 1.4)
AND(iris$Species == "setosa", iris$Petal.Length == 1.4)
It acts similiarly to Excel's AVERAGE function. It simply calculates average of the given numbers.
AVERAGE( number1, number2 = NA, number3 = NA, number4 = NA, number5 = NA, number6 = NA, number7 = NA, number8 = NA, number9 = NA, number10 = NA, number11 = NA, number12 = NA, number13 = NA, number14 = NA, number15 = NA, number16 = NA, number17 = NA, number18 = NA, number19 = NA, number20 = NA, number21 = NA, number22 = NA, number23 = NA, number24 = NA )
AVERAGE( number1, number2 = NA, number3 = NA, number4 = NA, number5 = NA, number6 = NA, number7 = NA, number8 = NA, number9 = NA, number10 = NA, number11 = NA, number12 = NA, number13 = NA, number14 = NA, number15 = NA, number16 = NA, number17 = NA, number18 = NA, number19 = NA, number20 = NA, number21 = NA, number22 = NA, number23 = NA, number24 = NA )
number1 , number2 , number3 , number4 , number5 , number6 , number7 , number8 , number9 , number10 , number11 , number12 , number13 , number14 , number15 , number16 , number17 , number18 , number19 , number20 , number21 , number22 , number23 , number24
|
Give this function number, same goes for other number arguments as well, but they are optional. |
As you can see in the example below, the average of numbers 10,20,30,40 is 25. By default excel removes NA values, by NA values I mean Excel's blank cells. Function will always return numeric class.
AVERAGE(10,20,30,40)
AVERAGE(10,20,30,40)
It acts similiarly to Excel's AVERAGEIF function. It calculates the average of the values where certain criterias are met.
AVERAGEIF(range, criteria, average_range)
AVERAGEIF(range, criteria, average_range)
range |
Give this function argument range for it to evaluate your criteria. |
criteria |
Give this function a criteria so it can check the range for this criteria. |
average_range |
Give this function a range for it to average on. So first it evaluates range argument based on criteria and it averages the numbers that meet the criteria. |
It takes the average of the column data where there are certain conditions met. In the example you can see we are testing if Species equal setosa and wherever this holds true we average the numbers. Example's result show the average of the Petal width of setosa Species. Function will always return numeric class.
AVERAGEIF(iris$Species,"setosa",iris$Petal.Width)
AVERAGEIF(iris$Species,"setosa",iris$Petal.Width)
It acts similiarly to Excel's AVERAGEIFS function. It calculates the average of the values where several criterias are met(it mimics and expression for criterias).
AVERAGEIFS( average_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
AVERAGEIFS( average_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
average_range |
Give this function a range for it to average on. So first it evaluates range argument based on criteria and it averages the numbers that meet the criteria. |
criteria_range1 , criteria_range2 , criteria_range3 , criteria_range4 , criteria_range5 , criteria_range6 , criteria_range7 , criteria_range8 , criteria_range9 , criteria_range10
|
Give this function a criteria_range/ranges so it can check the range for the appropriate criteria. criteria_range1 is checked against criteria1 |
criteria1 , criteria2 , criteria3 , criteria4 , criteria5 , criteria6 , criteria7 , criteria8 , criteria9 , criteria10
|
Give this function a criteria so it can check the appropriate criteria_range for it. criteria1 for criteria_range1 |
In this example we average Sepal Width of virginica species who have petal width less than 2. Function will always return numeric class.
AVERAGEIFS(iris$Sepal.Width,iris$Species,"virginica",iris$Petal.Width,"<2")
AVERAGEIFS(iris$Sepal.Width,iris$Species,"virginica",iris$Petal.Width,"<2")
It acts similiarly to Excel's CONCAT function. It concatenates given strings together, it can concatenates maximum 32 values.
CONCAT( text1, text2, text3 = "", text4 = "", text5 = "", text6 = "", text7 = "", text8 = "", text9 = "", text10 = "", text11 = "", text12 = "", text13 = "", text14 = "", text15 = "", text16 = "", text17 = "", text18 = "", text19 = "", text20 = "", text21 = "", text22 = "", text23 = "", text24 = "", text25 = "", text26 = "", text27 = "", text28 = "", text29 = "", text30 = "", text31 = "", text32 = "" )
CONCAT( text1, text2, text3 = "", text4 = "", text5 = "", text6 = "", text7 = "", text8 = "", text9 = "", text10 = "", text11 = "", text12 = "", text13 = "", text14 = "", text15 = "", text16 = "", text17 = "", text18 = "", text19 = "", text20 = "", text21 = "", text22 = "", text23 = "", text24 = "", text25 = "", text26 = "", text27 = "", text28 = "", text29 = "", text30 = "", text31 = "", text32 = "" )
text1 , text2 , text3 , text4 , text5 , text6 , text7 , text8 , text9 , text10 , text11 , text12 , text13 , text14 , text15 , text16 , text17 , text18 , text19 , text20 , text21 , text22 , text23 , text24 , text25 , text26 , text27 , text28 , text29 , text30 , text31 , text32
|
Give this function the text to concatenate.text1 and text2 arguments are mandatory, while others are optional. |
In the example we can see the string. We had two different strings and after concatenating we get them together. This function will always return string class.(Character in Excel language).
CONCAT("Concatenate this ","to this")
CONCAT("Concatenate this ","to this")
It acts similiarly to Excel's CONCATENATE function. Same as the CONCAT function but for users of old Excel the version to concatenate strings is CONCATENATE so I include it in this package.
CONCATENATE( text1, text2, text3 = "", text4 = "", text5 = "", text6 = "", text7 = "", text8 = "", text9 = "", text10 = "", text11 = "", text12 = "", text13 = "", text14 = "", text15 = "", text16 = "", text17 = "", text18 = "", text19 = "", text20 = "", text21 = "", text22 = "", text23 = "", text24 = "", text25 = "", text26 = "", text27 = "", text28 = "", text29 = "", text30 = "", text31 = "", text32 = "" )
CONCATENATE( text1, text2, text3 = "", text4 = "", text5 = "", text6 = "", text7 = "", text8 = "", text9 = "", text10 = "", text11 = "", text12 = "", text13 = "", text14 = "", text15 = "", text16 = "", text17 = "", text18 = "", text19 = "", text20 = "", text21 = "", text22 = "", text23 = "", text24 = "", text25 = "", text26 = "", text27 = "", text28 = "", text29 = "", text30 = "", text31 = "", text32 = "" )
text1 , text2 , text3 , text4 , text5 , text6 , text7 , text8 , text9 , text10 , text11 , text12 , text13 , text14 , text15 , text16 , text17 , text18 , text19 , text20 , text21 , text22 , text23 , text24 , text25 , text26 , text27 , text28 , text29 , text30 , text31 , text32
|
Give this function the text to concatenate.text1 and text2 arguments are mandatory, while others are optional. |
In the example we can see the string. We had two different strings and after concatenating we get them together. This function will always return string class(Character in Excel language).
CONCATENATE("Thanks to GM"," for datacamp")
CONCATENATE("Thanks to GM"," for datacamp")
It acts similiarly to Excel's COUNT function. It counts the amount of values in the given array.
COUNT(value)
COUNT(value)
value |
Count amount of the values in the range. |
In this example we count the amount of species in the built-in iris dataset. Function will always return numeric class.
COUNT(iris$Species)
COUNT(iris$Species)
It acts similiarly to Excel's COUNTIF function. It counts the amount of cells that comply with the given criteria.
COUNTIF(range, criteria)
COUNTIF(range, criteria)
range |
Specify range for Countif |
criteria |
Give the criteria to check the range for. |
In this example we count the amount of setosa in iris dataset. Function will always return numeric class.
COUNTIF(iris$Species,"setosa")
COUNTIF(iris$Species,"setosa")
It acts similiarly to Excel's COUNTIFS function. Counts values in a range which comply with given criteria.
COUNTIFS( criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
COUNTIFS( criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
criteria_range1 , criteria_range2 , criteria_range3 , criteria_range4 , criteria_range5 , criteria_range6 , criteria_range7 , criteria_range8 , criteria_range9 , criteria_range10
|
Specify range for Countifs, only criteria_range1 is mandatory. |
criteria1 , criteria2 , criteria3 , criteria4 , criteria5 , criteria6 , criteria7 , criteria8 , criteria9 , criteria10
|
Give the criteria to check the range for.Only criteria1 is necessary, others are optional. |
In this example we count the amount of cells where Spcies are setosa and has a Petal Width of 0.2 .Function will always return numeric class.
COUNTIFS(iris$Species,"setosa",iris$Petal.Width,0.2)
COUNTIFS(iris$Species,"setosa",iris$Petal.Width,0.2)
It acts similiarly to Excel's DATE function. You give 3 arguments which are year,month and day and it will give you the date in a date format.
DATE(year, month, day)
DATE(year, month, day)
year |
Give year argument to the function. |
month |
Give month argument to the function. |
day |
Give day argument to the function. |
This example returns 23rd June of 2020. Function will always return Date class.
DATE(2020,23,06)
DATE(2020,23,06)
It acts similiarly to Excel's DATEDIF function. It returns difference between two dates, either day,month or year, it's up to the user to specify which type of difference user wants.
DATEDIF(start_date, end_date, difference = "d")
DATEDIF(start_date, end_date, difference = "d")
start_date |
Start date to evaluate the difference |
end_date |
End Date to evaluate the difference |
difference |
What type of difference do you want? Year,Month or Day? Specify "m" for example for month/months, "d" for day/days and "y" for year/years. |
In these examples we have all 3 types of returns, first is difference between specified two dates in days, second one is difference in months and third one is difference in years.Function will always return numeric class.
DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"d") DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"m") DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"Y")
DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"d") DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"m") DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"Y")
Functions converts dates to Excel General date series which might be useful when writing Excel files.
DATETOEXCELSERIES(date)
DATETOEXCELSERIES(date)
date |
Convert R date type to Excel general date series, this might be helpful for Excel users. |
In this example it returns the Excel's general date series equivalent of date 1st January of 2020. Function will always return numeric class.
DATETOEXCELSERIES(DATE(2020,1,1))
DATETOEXCELSERIES(DATE(2020,1,1))
It acts similiarly to Excel's DAY function. It gives you the day from specified date.
DAY(date)
DAY(date)
date |
Give the date argument so it can extract day from the date. |
in this example we have 13th of January. Function will return 13 as it is the day from the date. Function will always return numeric class.
DAY(DATE(2020,1,13))
DAY(DATE(2020,1,13))
It acts similiarly to Excel's DAYS function. It calculates the difference between two dates in days.
DAYS(start_date, end_date)
DAYS(start_date, end_date)
start_date |
Give the start_date argument so it can calculate days. |
end_date |
Give the end_date argument so it can calculate days. |
In this example we are interested how many days there are between 1st February 2020 and 15th February 2020 which is 14. Function will always return numeric class.
DAYS(DATE(2020,2,1),DATE(2020,2,15))
DAYS(DATE(2020,2,1),DATE(2020,2,15))
It acts similiarly to Excel's EOMONTH function. It returns the end of month date for the specified date.
EOMONTH(date, months = 0)
EOMONTH(date, months = 0)
date |
Give the date argument so it can give you the end of the month. |
months |
The number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date. |
In this case we specify 2nd June 2008. Function returns end of the month which is 30th June 2008. Function will always return Date class.
EOMONTH(DATE(2008,6,2))
EOMONTH(DATE(2008,6,2))
It acts similiarly to Excel's FIND function. It finds the starting point of the string where it matches your find_text value.
FIND(find_text, within_text)
FIND(find_text, within_text)
find_text |
Find the text in the text. |
within_text |
Where should the function find the text. |
in this example we try to find on which place does CRAN start. Function will always return numeric class.
FIND("CRAN","I LOVE CRAN")
FIND("CRAN","I LOVE CRAN")
It acts similiarly to Excel's If function. Works on vectors as well. IF function is one of the first logical functions which has 3 arguments, logical test, value if true and value if false. If logical test passes(meaning it returns true) then function goes to value if true, otherwise it goes to value if false argument.
IF(logical_test, valueifTrue = 0, valueifFalse = 0)
IF(logical_test, valueifTrue = 0, valueifFalse = 0)
logical_test |
This is the usual test we run in excel which returns either TRUE or FALSE value. Use double equal signs for logical test if you want to equal. |
valueifTrue |
If the logical_test evaluates to TRUE then function will return the value you input here |
valueifFalse |
If the logical_test evaluates to FALSE then function will return the value you input here |
In this example we test if Species equal virginica and if it does we get a return Yes, otherwise it returns No. Function can return different classes, it depends on what you specify in value if true and what you specify in value if false.
IF(iris$Species == "virginica","Yes","No")
IF(iris$Species == "virginica","Yes","No")
It acts similiarly to Excel's IFNA function. If value is NA(or blank in Excel terms) then the function will return the second argument, if not then it will return the non-NA value which is the first argument.
IFNA(value, value_if_na)
IFNA(value, value_if_na)
value |
Evaluate if it is NA. |
value_if_na |
What should the function do if the value is NA. |
In this case the function returns "It is NA" as we specify the first value NA. Function can return different classes because first argument can be either character,numeric, logical or anything else.
IFNA(NA,"It is NA")
IFNA(NA,"It is NA")
It acts similiarly to Excel's INDEX function. It gives you the value from dataframe when you specify the array indices(row and column)
INDEX(array, row_num, column_num = 1)
INDEX(array, row_num, column_num = 1)
array |
Which array/table should it use? |
row_num |
Which row should it return the value from? |
column_num |
Which column should it return the value from? |
In this example we get 3rd row and 2nd column from the dataframe. This function can return different classes numeric, character, logical etc. It depends on what is in array/dataframe.
INDEX(iris,3,2)
INDEX(iris,3,2)
It acts similiarly to Excel's ISBLANK function. If the value you give is blank(NA in R terms) then it returns true, in other cases it returns false.
ISBLANK(value)
ISBLANK(value)
value |
Give the function the value for it to evaluate if it is blank?In R words if it is NA. NA is blank in R. |
Function returns logical class. If the value specified is blank then it returns true, in all other cases it returns false. Function will always return logical class.
ISBLANK(NA) ISBLANK(212) ISBLANK("asdasd") ISBLANK(iris$Species)
ISBLANK(NA) ISBLANK(212) ISBLANK("asdasd") ISBLANK(iris$Species)
It acts similiarly to Excel's ISEVEN function. If the specified number is even then it returns true, if not then false.
ISEVEN(number)
ISEVEN(number)
number |
Input the number for it to evaluate if it is even? |
First example returns true as it is an even number 2, second example returns false as it isn't an even number. Function will always return logical class.
ISEVEN(2) ISEVEN(1)
ISEVEN(2) ISEVEN(1)
It acts similiarly to Excel's ISLOGICAL function. If specified value is true or false then it returns true, if not then it returns false.
ISLOGICAL(value)
ISLOGICAL(value)
value |
Input the number for it to evaluate if it is logical? Works on vectors/arrays as well. |
We have 3 cases in the examples. First one is logical therefore function returns true, second one is also logical and it returns true as well. Third example isn't logical therefore function returns false. Function will always return logical class.
ISLOGICAL(TRUE) ISLOGICAL(FALSE) ISLOGICAL("Is this a logical?")
ISLOGICAL(TRUE) ISLOGICAL(FALSE) ISLOGICAL("Is this a logical?")
It acts similiarly to Excel's ISNUMBER function. If the specified value is a number it returns true, in all other cases it returns false.
ISNUMBER(value)
ISNUMBER(value)
value |
Input the number for it to evaluate if it is number? Works on vectors/arrays as well. |
first example returns true as it is a number. Second example returns false as it isn't a number, it's a string. Function will always return logical class.
ISNUMBER(2) ISNUMBER("2")
ISNUMBER(2) ISNUMBER("2")
It acts similiarly to Excel's ISODD function. If the specified number is odd then it returns true, if not then false.
ISODD(number)
ISODD(number)
number |
Input the number for it to evaluate if it is an odd number? Works on vectors/arrays as well. |
First example returns true as it is an odd number 1, second example returns false as it isn't an odd number. Function will always return logical class.
ISODD(1) ISODD(2)
ISODD(1) ISODD(2)
It acts similiarly to Excel's LEFT function. It takes the text and gives you the amount of characters you want to get from the string.
LEFT(text, num_chars)
LEFT(text, num_chars)
text |
the text you want to select characters from left. |
num_chars |
How many characters should it select? |
In this case we have a sentence and we want to extract first 4 characters from the sentence. Therefore we specify the argument 4 and it gives us the first word.Function will always return character class.
LEFT("Fear what happens",4)
LEFT("Fear what happens",4)
It acts similiarly to Excel's LEN function. This function gives you the length of a string.
LEN(text)
LEN(text)
text |
amount of characters in the word. |
in this example we see how long the sentence is. Function will always return numeric class.
LEN("This is great!")
LEN("This is great!")
It acts similiarly to Excel's LOWER function. It converts the sentence/word to lowercase characters.
LOWER(text)
LOWER(text)
text |
Give the function a word to make it lower.Give the texts via vector if you want to perform it on multiple texts. |
In this case we lower the whole specified sentence and return the sentence in all lower characters. Function will always return character class.
LOWER("THIS IS SPARTAA! IS IT THOUGH AFTER LOWERING?")
LOWER("THIS IS SPARTAA! IS IT THOUGH AFTER LOWERING?")
It acts similiarly to Excel's MATCH function. It matches the value in the array.
MATCH(lookup_value, lookup_array)
MATCH(lookup_value, lookup_array)
lookup_value |
what value to lookup |
lookup_array |
Where should it lookup the value |
This example gives us the first index of an array where Species is virginica. Function will always return numeric.
MATCH("virginica",iris$Species)
MATCH("virginica",iris$Species)
It acts similiarly to Excel's MAXIF function. It returns the maximum value from an array after testing for certain criterias.
MAXIF(range, criteria, max_range)
MAXIF(range, criteria, max_range)
range |
Range where it should check the criteria |
criteria |
Where should it lookup the value |
max_range |
Which array should it return the max from. |
In this case we get the maximum value of Sepal Length from Species which are virginica. Function will always return numeric class.
MAXIF(iris$Species,"virginica",iris$Sepal.Length)
MAXIF(iris$Species,"virginica",iris$Sepal.Length)
It acts similiarly to Excel's MAXIFS function. It returns the maximum value from an array after testing for several criterias.
MAXIFS( max_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
MAXIFS( max_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
max_range |
Range from where it should return the maximum value from. |
criteria_range1 , criteria_range2 , criteria_range3 , criteria_range4 , criteria_range5 , criteria_range6 , criteria_range7 , criteria_range8 , criteria_range9 , criteria_range10
|
Which range should the criteria tested for.Only criteria_range1 is mandatory,others are optional. |
criteria1 , criteria2 , criteria3 , criteria4 , criteria5 , criteria6 , criteria7 , criteria8 , criteria9 , criteria10
|
What criteria should the range be checked against. Only criteria1 is mandatory, others are optional. |
This example returns maximum value of Petal Length of species setosa who have petal width 0.2. Function will always return numeric class.
MAXIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
MAXIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
It acts similiarly to Excel's MID function. Function is for string extraction. You select the starting number and the amount of characters you want to extract.
MID(text, start_num, num_chars)
MID(text, start_num, num_chars)
text |
From whch text should it return the string? |
start_num |
Where should it start counting from? |
num_chars |
How many characters should it return? |
In this example we want to extract "kata" from this string. So we specify 5 as the starting number and 4 as the amount of characters to extract. Function will always return character class.
MID("Kayakata",5,4)
MID("Kayakata",5,4)
It acts similiarly to Excel's MINIF function. It returns the minimum value from an array after testing for certain criterias.
MINIF(range, criteria, min_range)
MINIF(range, criteria, min_range)
range |
Which range should it check the criteria against? |
criteria |
What should be checked? |
min_range |
From which range should it return the minimum from? |
In this case we get the minimum value of Sepal Length from Species which are virginica. Function will always return numeric class.
MINIF(iris$Species,"virginica",iris$Sepal.Length)
MINIF(iris$Species,"virginica",iris$Sepal.Length)
It acts similiarly to Excel's MINIFS function. It returns the minimum value from an array after testing for several criterias.
MINIFS( min_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
MINIFS( min_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
min_range |
From which range should it return the minimum from? |
criteria_range1 , criteria_range2 , criteria_range3 , criteria_range4 , criteria_range5 , criteria_range6 , criteria_range7 , criteria_range8 , criteria_range9 , criteria_range10
|
Which range should the criteria tested for.Only criteria_range1 is mandatory,others are optional. |
criteria1 , criteria2 , criteria3 , criteria4 , criteria5 , criteria6 , criteria7 , criteria8 , criteria9 , criteria10
|
What criteria should the range be checked against. Only criteria1 is mandatory, others are optional. |
This example returns minimum value of Petal Length of species setosa who have petal width 0.2. Function will always return numeric class.
MINIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
MINIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
It acts similiarly to Excel's MONTH function. It extracts the month part from the date.
MONTH(date)
MONTH(date)
date |
Enter the date to get the month from. |
In this case the function will give you 12 as it is the month of the date we have specified.Function will always return numeric class.
MONTH(DATE(2020,12,1))
MONTH(DATE(2020,12,1))
It acts similiarly to Excel's NOT function. It returns the opposite of the logical you specify.
NOT(logical)
NOT(logical)
logical |
Enter the logical to get the opposite logical of it. For example if you input TRUE, it will get FALSE. |
in the first example it will return false while in the 2nd example it will return true. Function will always return logical class.
NOT(TRUE) NOT(FALSE)
NOT(TRUE) NOT(FALSE)
It acts similiarly to Excel's NOW function. It gives the system time in character format.
NOW()
NOW()
As the function has no arguments it simply returns current system time in character format. Function will always return character class.
NOW()
NOW()
It acts similiarly to Excel's OR function. Logical operator where if at least only one logical is true it returns true.
OR( logical1, logical2 = FALSE, logical3 = FALSE, logical4 = FALSE, logical5 = FALSE, logical6 = FALSE, logical7 = FALSE, logical8 = FALSE, logical9 = FALSE, logical10 = FALSE, logical11 = FALSE, logical12 = FALSE, logical13 = FALSE, logical14 = FALSE, logical15 = FALSE, logical16 = FALSE, logical17 = FALSE, logical18 = FALSE, logical19 = FALSE, logical20 = FALSE, logical21 = FALSE, logical22 = FALSE, logical23 = FALSE, logical24 = FALSE, logical25 = FALSE, logical26 = FALSE, logical27 = FALSE, logical28 = FALSE, logical29 = FALSE, logical30 = FALSE, logical31 = FALSE, logical32 = FALSE )
OR( logical1, logical2 = FALSE, logical3 = FALSE, logical4 = FALSE, logical5 = FALSE, logical6 = FALSE, logical7 = FALSE, logical8 = FALSE, logical9 = FALSE, logical10 = FALSE, logical11 = FALSE, logical12 = FALSE, logical13 = FALSE, logical14 = FALSE, logical15 = FALSE, logical16 = FALSE, logical17 = FALSE, logical18 = FALSE, logical19 = FALSE, logical20 = FALSE, logical21 = FALSE, logical22 = FALSE, logical23 = FALSE, logical24 = FALSE, logical25 = FALSE, logical26 = FALSE, logical27 = FALSE, logical28 = FALSE, logical29 = FALSE, logical30 = FALSE, logical31 = FALSE, logical32 = FALSE )
logical1 , logical2 , logical3 , logical4 , logical5 , logical6 , logical7 , logical8 , logical9 , logical10 , logical11 , logical12 , logical13 , logical14 , logical15 , logical16 , logical17 , logical18 , logical19 , logical20 , logical21 , logical22 , logical23 , logical24 , logical25 , logical26 , logical27 , logical28 , logical29 , logical30 , logical31 , logical32
|
Give the function a logical argument. The one that returns either TRUE or FALSE. |
In this example either if species is virginica or sepal length is more than 6 then it returns true. Function will always return logical class.
OR(iris$Species == "virginica",iris$Sepal.Length > 6)
OR(iris$Species == "virginica",iris$Sepal.Length > 6)
It acts similiarly to Excel's RAND function. No need to specify the arguments/parameters. It gives you the random number from 0 to 1.
RAND()
RAND()
This example simply returns a number from 0 to 1. Function will always return numeric class.
RAND()
RAND()
It acts similiarly to Excel's RANDBETWEEN function. it takes several arguments like bottom,top and number, you specify the floor, ceiling and the amount of numbers you want to generate and it gives you the random between the floor and ceiling.
RANDBETWEEN(bottom, top, number = 1)
RANDBETWEEN(bottom, top, number = 1)
bottom |
Give the function a bottom floor for the randbetween |
top |
Give the function a top ceiling for the randbetween |
number |
How many numbers should it generate? |
In the first example we get only 1 number from 1 to 100, while in the second example we get 3 numbers from 1 to 100 as the argument number is specified 3. Function will always return numeric class.
RANDBETWEEN(1,100, number = 1) RANDBETWEEN(1,100, number = 3)
RANDBETWEEN(1,100, number = 1) RANDBETWEEN(1,100, number = 3)
It acts similiarly to Excel's REPT function. Repeat the text as many times as you want.
REPT(text, number_times, AsOne = TRUE)
REPT(text, number_times, AsOne = TRUE)
text |
Which text should it repeat n time? |
number_times |
How many times should the function repeat the given text. |
AsOne |
Should function concatenate the text or should it return seperately as a vector(Vector is same as array in Excel) |
In the first example we repeat "Oi" 2 times and it is coerced together as one string. In the second example we don't coerce it together but it still repeats the "Oi" two times. Function will always return character class.
REPT("Oi",2,AsOne = TRUE) REPT("Oi",2,AsOne = FALSE)
REPT("Oi",2,AsOne = TRUE) REPT("Oi",2,AsOne = FALSE)
It acts similiarly to Excel's RIGHT function. It takes the string and takes the amount of characters you want to extract from it.
RIGHT(text, num_chars)
RIGHT(text, num_chars)
text |
from where should it get the characters |
num_chars |
how many characters should it get? |
In this example we take "Kayakata" and extract 4 characters from the right handside of the string. Functions will always return character class.
RIGHT("Kayakata",4)
RIGHT("Kayakata",4)
A dataset containing randomly generated Sales data.
Sales
Sales
A data frame of 24 rows and 4 columns
Names of salesman
Countries of the salesman
Cost of each salesman
Amount of sales each salesman generates
Randomly generated data
It acts similiarly to Excel's STDEV function. It calculates the standard deviation from the numbers you give it.
STDEV( number1, number2 = NA, number3 = NA, number4 = NA, number5 = NA, number6 = NA, number7 = NA, number8 = NA, number9 = NA, number10 = NA, number11 = NA, number12 = NA, number13 = NA, number14 = NA, number15 = NA, number16 = NA, number17 = NA, number18 = NA, number19 = NA, number20 = NA, number21 = NA, number22 = NA, number23 = NA, number24 = NA )
STDEV( number1, number2 = NA, number3 = NA, number4 = NA, number5 = NA, number6 = NA, number7 = NA, number8 = NA, number9 = NA, number10 = NA, number11 = NA, number12 = NA, number13 = NA, number14 = NA, number15 = NA, number16 = NA, number17 = NA, number18 = NA, number19 = NA, number20 = NA, number21 = NA, number22 = NA, number23 = NA, number24 = NA )
number1 , number2 , number3 , number4 , number5 , number6 , number7 , number8 , number9 , number10 , number11 , number12 , number13 , number14 , number15 , number16 , number17 , number18 , number19 , number20 , number21 , number22 , number23 , number24
|
From which numbers should the function calculate the standard deviation. Sames goes for other number arguments as well. If you want to specify several numbers simply go: STDEV(2,2,1,2). No need to put them into a vector. |
In this example we simply calculate standard deviation of the given numbers. Function will always return numeric class.
STDEV(2,1,3,1)
STDEV(2,1,3,1)
A dataset containing randomly generated Streets data.
Streets
Streets
A data frame of 4 rows and 2 columns
Names of salesman
Street the salesman lives on
Randomly generated data
It acts similiarly to Excel's SUBSTITUTE function. If you want to substitute the characters by certain characters you should use this function.
SUBSTITUTE(text, old_text, new_text)
SUBSTITUTE(text, old_text, new_text)
text |
Where should it substitute the characters |
old_text |
Which text should it substitute |
new_text |
What should it substitute with. |
In this example we take text "CRAN", we take the old text "RAN" and replace it with "out" which in return gives us "Cout". Function will always return character class.
SUBSTITUTE("CRAN","RAN","out")
SUBSTITUTE("CRAN","RAN","out")
It acts similiarly to Excel's SUMIF function. It sums the values where certain criterias are met.
SUMIF(range, criteria, sum_range)
SUMIF(range, criteria, sum_range)
range |
Which range should it check the criteria against. |
criteria |
what criteria should it check in range |
sum_range |
Which range should it sum |
In this case we are summing Sepal length of species which are virginica. Function will always return numeric class.
SUMIF(iris$Species,"virginica",iris$Sepal.Length)
SUMIF(iris$Species,"virginica",iris$Sepal.Length)
It acts similiarly to Excel's SUMIFS function. It sums the values where several criterias are met(it mimics and expression for criterias).
SUMIFS( sum_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
SUMIFS( sum_range, criteria_range1, criteria1, criteria_range2 = TRUE, criteria2 = TRUE, criteria_range3 = TRUE, criteria3 = TRUE, criteria_range4 = TRUE, criteria4 = TRUE, criteria_range5 = TRUE, criteria5 = TRUE, criteria_range6 = TRUE, criteria6 = TRUE, criteria_range7 = TRUE, criteria7 = TRUE, criteria_range8 = TRUE, criteria8 = TRUE, criteria_range9 = TRUE, criteria9 = TRUE, criteria_range10 = TRUE, criteria10 = TRUE )
sum_range |
Which range should it sum |
criteria_range1 , criteria_range2 , criteria_range3 , criteria_range4 , criteria_range5 , criteria_range6 , criteria_range7 , criteria_range8 , criteria_range9 , criteria_range10
|
Which range should it check the criteria against. Only criteria_range1 is mandatory, others are optional. |
criteria1 , criteria2 , criteria3 , criteria4 , criteria5 , criteria6 , criteria7 , criteria8 , criteria9 , criteria10
|
what criteria should it check in range. Only criteria1 is mandatory, others are optional. |
In this example we sum the petal length of all setosa species which have petal width of 0.2. Function will always return numeric class.
SUMIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
SUMIFS(iris$Petal.Length,iris$Species,"setosa",iris$Petal.Width,0.2)
It acts similiarly to Excel's TODAY function.No need to give the arguments. Function returns the system date.
TODAY()
TODAY()
Example returns the system date as the function does, nothing specific. Function will always return Date class.
TODAY()
TODAY()
It acts similiarly to Excel's UPPER function. It takes the string and coverts all of it's characters to uppercase.
UPPER(text)
UPPER(text)
text |
Give this function the text to capitalize all the letters.Give this function words with a vector if you want to perform it on several texts. |
In this case we have specified "is this sparta?" and it has returned all the characters in uppercase as expected. Function will always return character class.
UPPER("is this sparta?")
UPPER("is this sparta?")
It acts similiarly to Excel's VLOOKUP function with some extra arguments. It takes the value that you want to take from another table and returns the corresponding value from another table. Basically it's an SQL Left Join.
VLOOKUP( lookup_from_table, lookup_column_value = "Name of the column to lookup", lookup_where_table, lookup_where_table_column = "Name of the column to compare", return_which_column = "Name of the column to return" )
VLOOKUP( lookup_from_table, lookup_column_value = "Name of the column to lookup", lookup_where_table, lookup_where_table_column = "Name of the column to compare", return_which_column = "Name of the column to return" )
lookup_from_table |
The table it should lookup values from |
lookup_column_value |
which column should be looked up |
lookup_where_table |
which table should it look for the values in |
lookup_where_table_column |
Which column should it look for the values in. |
return_which_column |
Which column should it return |
In this case we have built-in database Sales and Street. We try to merge these 2 tables to see on which street are the salesman based on their countries. Function can return numeric,character,logical or any other class, it depends on what is in the table you are looking up the value in.
VLOOKUP(Sales,"Country",Streets,"Country","Street")
VLOOKUP(Sales,"Country",Streets,"Country","Street")
It acts similiarly to Excel's WEEKDAY function. It tells you the weekday of the date's day either in number format or character format.
WEEKDAY(date, return = "number")
WEEKDAY(date, return = "number")
date |
What date should it take to get the weekday from. For example: "23-06-2020" |
return |
Should it return number or should it return the day in the characters format. Specify in quotes number if you want it to return number, specify character if you want to get the character, like Monday |
In the first case we get the number formatted 1st February of 2020 which is 6. We plug in the same date in the 2nd example and we specify the return argument "character", therefore it gives us the "Saturday" in character format. Function returns either character or numeric class.
WEEKDAY(DATE(2020,2,1),return = "number") WEEKDAY(DATE(2020,2,1),return = "character")
WEEKDAY(DATE(2020,2,1),return = "number") WEEKDAY(DATE(2020,2,1),return = "character")
It acts similiarly to Excel's YEAR function. Function will extract year component of your date.
YEAR(date)
YEAR(date)
date |
Give the date argument so it can extract year from the date. Preferable to give the date via DATE function of this package. |
In this example function returns 2020 as it is the year part of the date specified. Function will always return numeric class..
YEAR(DATE(2020,1,1))
YEAR(DATE(2020,1,1))