R PROGRAMMING Assignment 22107096
R PROGRAMMING Assignment 22107096
R PROGRAMMING
Assignment - 1
#programs
#nested functions
Nested_function <- function(x, y) {
a <- x + y
return(a)
}
Nested_function(Nested_function(2,2), Nested_function(3,3))
}
return (Inner_func)
}
output <- Outer_func(3) # To call the Outer_func
output(5)
txt
my_function <- function() {
txt <<- "fantastic"
paste("R is", txt)
}
my_function()
print(txt)
#Math Functions
# Functions for basic arithmetic operations
add <- function(x, y) {
return(x + y)
}
abs(x)
sqrt(y)
log(x)
log10(x)
round(z, 2)
floor(z)
ceiling(z)
exp(x)
}
math_function()
nchar(x)
paste(x, sep="")
strsplit(x, " ")
substr(x, 3, 18)
tolower(x)
toupper(x)
trimws(x)
}
String_function()
}
assignment()