(boxplot, histogram, qqplot)

``````for(i in 1:11){
v <- paste("x",i,sep="")
par(mfrow = c(1, 1))
boxplot(df6[[v]],xlab=v,main="Boxplot of bc transformed data")
hist(df6[[v]], main="Histogram",xlab=v)
qqnorm(df6[[v]],ylab="Sample Quantiles",xlab="box-cox transform(quality)")
qqline(df6[[v]])
}
``````

Interesting stats
min(df6\$x1) = 1.335
max(df6\$x1) = 2.766
min(df6\$x4) = -0.511
max(df6\$x4) = 4.187

Error messages center around illegal ylim values but what causes these errors, how do I see what code is being generated ?

Error in plot.window(...) : need finite 'ylim' values
In addition: Warning message:
In bplt(at[i], wid = width[i], stats=z\$stats[,i], out=z\$out[z\$group==:
Outlier (-Inf) in boxplot 1 is not drawn

What do you see if you run

``````for(i in 1:11){
v <- paste("x",i,sep="")
print(range(df6[[v]]))
}
``````

1] 1.335001 2.766319
[1] -2.5257286 0.4574248
[1] -Inf 0.5068176
[1] -0.5108256 4.1866198
[1] -4.7105307 -0.4926583
[1] 0.000000 5.666427
[1] 1.791759 6.086775
[1] -0.01297380 0.03823946
[1] 1.000632 1.388791
[1] -1.5141277 0.6931472
[1] 2.079442 2.701361

range of df6(x3) = (-Inf, 0.5068176)
df6\$x3[[1]] = -Inf
There are zeroes in x3 which is causing the problem.

Two questions:

(1) Does one does not plot the transformed 0's? How do we handle this situation????????????????
(2) How do I modify the for(i in 1:11) to skip 3? The following will do it.

for(i in 1:11) {
if(i==3) next # skip 3rd iteration and go to next iteration
v <- paste("x",i,sep="")
print(range(df6[[v]]))
}

[1] 1.335001 2.766319
[1] -2.5257286 0.4574248
[1] -0.5108256 4.1866198
[1] -4.7105307 -0.4926583
[1] 0.000000 5.666427
[1] 1.791759 6.086775
[1] -0.01297380 0.03823946
[1] 1.000632 1.388791
[1] -1.5141277 0.6931472
[1] 2.079442 2.701361

Sometimes I just need a little help in getting started.

Thanks for replying. MM

If you are doing a log transform the zeros will cause values of -Inf. How you handle that is up to you. You can filter the data before plotting it or you can skip that entire column of the data frame. For filtering, you can do something like this:

``````DF <- data.frame(A = c(1,3,2,5,-Inf,2))
DF
#>      A
#> 1    1
#> 2    3
#> 3    2
#> 4    5
#> 5 -Inf
#> 6    2
tmp <- DF\$A
tmp <- tmp[!is.infinite(tmp)]
tmp
#> [1] 1 3 2 5 2
``````

Created on 2023-03-17 with reprex v2.0.2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.