MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to find cuberoot of a number in R?

# How to find cuberoot of a number in R?

This recipe helps you find cuberoot of a number in R

This recipe demonstrates how to calculate a cuberoot of a numeric variable

There is no built-in function to specifically calculate the cuberoot of a number. But there are two different ways in which you can do this.

- Using the expontial arithmetic operator while defining a function;
- Using nthroot() function in pracma package with n =3

We assign a number to a variable 'a' whose cuberoot needs to be calculated

```
a = -64
```

1) Defining a function using an exponential arithmetic operator:

We use the arithmetic operator " ^ " and defining a function 'cuberoot' to carry out this task. This defined function will deal with both positive and negative numeric variables.

```
# defining a function cuberoot in R that can accept an argument 'x'
cuberoot = function(x){
if(x < 0)
{ - (-x)^(1/3)}
else
{x^(1/3)}
}
# calling the function and giving a as an arguement
cuberoot(a)
```

-4

2) Using nthroot() function with n = 3

we use the built-in function nthroot() with n=3 to calculate the cuberoot of a numeric variable. nthroot() is a function present in "pracma" package.

Syntax: nthroot(x,n)

Where:

- 'x' is a numeric vector
- n' is a positive integer specifying the exponent (1/n)

```
# installing the pracma package first
install.packages("pracma")
#calling and exceuting nthroot function on 'a'
pracma::nthroot(a, 3)
```

-4

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Dataset using Keras in Python.

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.

Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.

In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.