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

# How to find proportions of a vector in R?

This recipe helps you find proportions of a vector in R

While carrying out a statistical analysis on a set of observations collected, finding proportions of these observations that meets a particular condition is most common.

To carry out this task, we will follow the following steps:

- Applying a condition on the vector which is also knwon as boolean test to get a vector of boolean values.
- Now passing these boolean values to the mean() function to get the proportion of all the TRUE values

In this recipe, we will discuss how to find proprtions of a vector in R discussing the above steps in details.

We will use a sales example in this case by creating a vector of no of sales of a certain product that took place in a period of 12 months.
```
sales_data = c(5500, 2400, 2500, 2100, 2300, 2600, 2700, 2800, 2300, 3500, 6000, 7500)
```

Finding the sales which are greater than 5000.
```
```

```
bool_test_results = sales_data > 5000
bool_test_results
```

```
TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE
```

```
```## Step 3: Finding the proportion of the vector

Find the proportion of the sales that are greater than 5000

```
mean(bool_test_results)
```

0.25

This means that 25% of the sales were higher than 5000 in a period of 12 months.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

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

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.

In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

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.

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.

Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

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 machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.