Suppose I have heights of a few people and based on that I need to predict their weights. is that possible in R? Dec 12, 2018 1,719 views

## 2 answers to this question.

+1 vote

You can the concept of linear regression for this purpose. Its a statistic tool used to build relationship between to variables called predictor variable which is heights of people in your case and response variable which is weight in this case. Follow these steps:

• Gather heights and weights like atleast a few observations.
• use the lm() function to create the relationship model
• use the coefficients from the model and create a mathematical equation.
• predict the weight of new observations using the predict() function. answered Dec 12, 2018 by
• 10,800 points
+1 vote

You can try something like this:

```# The predictor vector.
a <- c(111, 123, 134, 156, 145, 176, 198, 133, 131, 181)

# The resposne vector.
b <- c(56, 61, 65, 71, 45, 54, 74, 76, 68, 58)

# Apply the lm() function.
relation <- lm(a~b)

# Find weight of a person with height 170.
z <- data.frame(x = 170)
result <-  predict(relation,z)
print(result)``` answered Dec 12, 2018 by Purva

## "Error in tagAssert: argument "body" is missing, with no default" when trying to create a dashboard using shiny R

I'm trying to create a dashboard using ...READ MORE

## Predict weight and height of a person based on his nationality in R

One of the way by which you ...READ MORE

## Steps to evaluate Linear Regression in R

These are sequential steps which need to ...READ MORE

## R programming: Linear programming problems

The documentation for the lp package provides ...READ MORE

## R programming: Linear Equation

Use expand.grid to get all possible combinations ...READ MORE

+1 vote

## How to segment documents into phrases in text mining using R?

You can do this in R using ...READ MORE