I am trying to plot a qqnline plot with the following code and receive an error message. I appreciate any help you can provide.
logdata <- c(1.7917595,1.0986123,1.9459101,3.8066625,
0.6931472,3.4965076,1.3862944,3.465735)
Code:
lb1<- log(logdata)
lb1<- as.data.frame(lb1)
qqnorm(lb1, main = "Log Transformed Time")
qqline(lb1, col=2)
Error Message:
Error in xtfrm.data.frame(x) : cannot xtfrm data frames
qqnorm
and qqline
expect a vector and you are giving a data.frame as input, just use lb1$lb1
instead of lb1
:
qqnorm(lb1$lb1, main = "Log Transformed Time")
qqline(lb1$lb1, col=2)
The plot generated is:
Using your original code you just need to remove one line to make it work:
lb1<- log(logdata)
#lb1<- as.data.frame(lb1) # remove THIS line.
qqnorm(lb1, main = "Log Transformed Time")
qqline(lb1, col=2)