In R, you can calculate the square root of a number using the sqrt()
function. Here’s how you can use it:
# Example: Calculate the square root of a number
number <- 16
result <- sqrt(number)
# Print the result
print(result)
This will output:
[1] 4
You can replace 16
with any other positive number you want to find the square root of.