An open API service indexing awesome lists of open source software.

https://github.com/gdmcdonald/bmiplot

A simple tool to make a BMI plot of height vs. weight in ggplot2 in R
https://github.com/gdmcdonald/bmiplot

bmi data-visualization ggplot2 r

Last synced: 6 months ago
JSON representation

A simple tool to make a BMI plot of height vs. weight in ggplot2 in R

Awesome Lists containing this project

README

          

# BMIplot
A simple tool to make a BMI plot of height vs. weight in ggplot2 in R

## Examples

### Set up demo data set
```
demo_data=read.csv("http://people.ucsc.edu/~cdobkin/NHIS%202007%20data.csv")%>%
mutate(Weight=weight/2.20462, #convert pounds to kg
Height=height*2.54, #convert inches to cm
Gender=recode(SEX,`1`="Male",`2`="Female"))%>%
filter(Height<200,Weight<200) #remove ridiculous entries
```


### Specify lots
```
makeBMIplot(sample_n(demo_data,100),
weight="Weight",
height="Height",
colFactor="Gender",
aspect_ratio = 3)
```

![Example 1](BMIex1.jpeg)

### Specify colour factor
```
makeBMIplot(sample_n(demo_data,100),
colFactor="Gender")
```

![Example 2](BMIex2.jpeg)

### Don't specify colour factor
```
makeBMIplot(sample_n(demo_data,100),
alpha=0.3)
```

![Example 3](BMIex3.jpeg)

### Add jitter and alpha to counteract overplotting
```
makeBMIplot(demo_data,
weight="Weight",
height="Height",
colFactor="Gender",
aspect_ratio = 3,
jitter=TRUE,
alpha=0.4)
```

![Example 4](BMIex4.jpeg)