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 deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.

In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

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.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.