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
- Host: GitHub
- URL: https://github.com/gdmcdonald/bmiplot
- Owner: gdmcdonald
- Created: 2017-09-08T07:58:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-07T13:24:15.000Z (almost 8 years ago)
- Last Synced: 2025-05-31T05:45:03.228Z (7 months ago)
- Topics: bmi, data-visualization, ggplot2, r
- Language: R
- Size: 121 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)
```

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

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

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