0

I cannot plot my qq-plots for individual genders, but I can plot them combined. It keeps saying, that: "y is empty or has only NAs", and I cannot seem to figure out how I should change my code. You can see some of my code down below:

## Read data
D<-read.table("bmi1_data.csv",header=TRUE,sep=";",as.is=TRUE)

## Divide data into two subsets according to gender
Dfemale<-subset(D,gender == 0)
Dmale<-subset(D,gender==1)

I have calculated BMI earlier in my code.

## New variable 'logbmi' with log-transformed BMI
D$logbmi <- log(D$bmi)

It can plot this:

## qq-plot of log-transformed BMI
qqnorm(D$logbmi)
qqline(D$logbmi)

But it cannot plot this:

## qq-plot of log-transformed BMI for females
qqnorm(Dfemale$logbmi)
qqline(Dfemale$logbmi)

and also this does not work:

## qq-plot of log-transformed BMI for males
qqnorm(Dmale$logbmi)
qqline(Dmale$logbmi)

I hope this makes sense, because stackoverflow wouldn't let me insert my whole code. Thank you

Cettt
  • 11,460
  • 7
  • 35
  • 58
Line
  • 1
  • 1

0 Answers0