r - NaNs produced in scale transform -


i trying create ggparcoord plot y-value logged of data has positive , negative values in it:

x = data.frame(a=2*runif(100)-1,b=2*runif(100)-1,c=2*runif(100)-1,d=2*runif(100)-1,e=2*runif(100)-1) dim(x) [1] 100   5 

i try plot parallel coordinates plot:

library(ggally) ggparcoord(x, columns=1:5, alphalines=0.5) + scale_y_log10() 

and receive following error:

warning messages: 1: in scale$trans$trans(x) : nans produced 2: removed 167 rows containing missing values (geom_path). 

i thinking nans produced when take log of negative value. however, not understand why 167 rows containing missing values, when dimension of x 100 rows.

in case, try solve adding value of 2 every index in x (so values in x between +1 , +3).

x=x+2 ggparcoord(x, columns=1:5, alphalines=0.5) + scale_y_log10() warning messages:   1: in scale$trans$trans(x) : nans produced 2: removed 167 rows containing missing values (geom_path). 

however, receive same message. idea how solve this?

the ggparcoord function default has parameter scale="std", subtracts mean , divides standard deviation each variable. natural default, because you're trying plot bunch of different variables might have different scales on same y-axis. unfortunately application, means adding 2 x reversed scaling , negative values remain.

the approach solve issue remove scaling:

ggparcoord(x, columns=1:5, scale="globalminmax") + scale_y_log10(breaks=c(1, 2)) 

enter image description here


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -