Custom Function in R CT6 MIS476
In this assignment, we will build custom functions in R. As an example, the following function called addPercent converts a value into a percentage with one decimal place.
addPercent <- function(x){
percent <- round(x*100, digits = 1)
result <- paste(percent, “%”, sep = “”) return(result) } Below are a few output results from this function. > addPercent(.1)
[1] “10%”
> add Percent(10)
[1] “1000%”
> add Percent(10.1)
[1] “1010%”
> add Percent(0.1443)
[1] “14.4%”
Write a custom R function that inputs a temperature in Fahrenheit Fo and converts to Celsius Co. The relationship is Co = 5(Fo – 32)/9.
Write a custom R function that computes the sum of squares of two numbers.
Write a custom R function that takes any univariate dataset and calculates the mean, minimum, maximum, and standard deviation.
In statistics, a dataset needs to be transformed in order to meet certain assumptions. Write a custom R function that takes any univariate dataset and creates a histogram of the raw dataset and a histogram of the log-transformed dataset.
Write a custom R function of your own. Describe what your function does and produce the output.
Using a Word document, include your all your functions along with least four different output results from each of the functions 1 through 5. You may either copy and paste the codes and output results on a Word document or take the screen shots. If you take the screen shots, make sure to show the current date.
Last Completed Projects
topic title | academic level | Writer | delivered |
---|