Square Root in R (2 Examples)

This page shows how to compute the square root with the sqrt() function in the R programming language.

Example 1: Basic Application of sqrt Function

sqrt(5)                           # Apply sqrt function in R
# 2.236068

Example 2: Compute Square Root of All Vector Elements

vec <- c(5, 3, 1, 9, 4)           # Create example vector
sqrt(vec)                         # Apply sqrt to vector
# 2.236068 1.732051 1.000000 3.000000 2.000000

Further Examples for the sqrt Function in a Video

YouTube

By loading the video, you agree to YouTube’s privacy policy.
Learn more

Load video

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top