Dear R
What does NaN mean?
I recently did a correlation on a batch of data for some reason it didn't
like one column
cor(sleep,use="complete.obs")
BodyWt BrainWt SlowSleep ParaSleep TotalSleep
BodyWt 1.00000000 0.95584875 -0.3936373 -0.07488845 -0.3428373
BrainWt 0.95584875 1.00000000 -0.3867947 -0.07427740 -0.3370815
SlowSleep -0.39363729 -0.38679474 1.0000000 0.51824287 0.9676730
ParaSleep -0.07488845 -0.07427740 0.5182429 1.00000000 0.7171864
TotalSleep -0.34283732 -0.33708151 0.9676730 0.71718643 1.0000000
Lifespan 0.46982146 0.62938940 -0.3722345 -0.26834006 -0.3824462
Gestation 0.71434413 0.73353206 -0.6061048 -0.40893177 -0.6144743
PredIndex 0.09588524 -0.01538017 -0.3526558 -0.39795310 -0.4047155
ExposeIndex 0.40563880 0.32318968 -0.5802789 -0.50363338 -0.6213578
DangerIndex 0.25932512 0.15093686 -0.5346247 -0.57194862 -0.6043029
logbrw 0.47461094 0.53992522 -0.6302266 -0.36884187 -0.6223073
loglife 0.37351520 0.45819097 -0.3549184 -0.38521174 -0.4028017
loggest 0.41308558 0.45045240 -0.5754478 -0.57234786 -0.6376850
logbw 0.50905390 0.52255094 -0.6603217 -0.26930774 -0.6174775
logpara NaN NaN NaN NaN NaN
Lifespan Gestation PredIndex ExposeIndex DangerIndex
BodyWt 0.46982146 0.71434413 0.09588524 0.4056388 0.25932512
BrainWt 0.62938940 0.73353206 -0.01538017 0.3231897 0.15093686
SlowSleep -0.37223446 -0.60610477 -0.35265576 -0.5802789 -0.53462471
ParaSleep -0.26834006 -0.40893177 -0.39795310 -0.5036334 -0.57194862
TotalSleep -0.38244618 -0.61447431 -0.40471545 -0.6213578 -0.60430286
Lifespan 1.00000000 0.64638866 -0.16973575 0.3157456 0.01468596
Gestation 0.64638866 1.00000000 0.09079823 0.5734727 0.30623551
PredIndex -0.16973575 0.09079823 1.00000000 0.6256876 0.92731729
ExposeIndex 0.31574564 0.57347265 0.62568764 1.0000000 0.78980702
DangerIndex 0.01468596 0.30623551 0.92731729 0.7898070 1.00000000
logbrw 0.73584286 0.78178948 0.07112786 0.6132218 0.28600619
loglife 0.87677362 0.63260838 -0.09023386 0.5042496 0.14082719
loggest 0.56014783 0.88539870 0.09040680 0.5830778 0.30998808
logbw 0.64683285 0.75938272 0.13046983 0.6473671 0.33957121
logpara NaN NaN NaN NaN NaN
logbrw loglife loggest logbw logpara
BodyWt 0.47461094 0.37351520 0.4130856 0.5090539 NaN
BrainWt 0.53992522 0.45819097 0.4504524 0.5225509 NaN
SlowSleep -0.63022657 -0.35491836 -0.5754478 -0.6603217 NaN
ParaSleep -0.36884187 -0.38521174 -0.5723479 -0.2693077 NaN
TotalSleep -0.62230729 -0.40280169 -0.6376850 -0.6174775 NaN
Lifespan 0.73584286 0.87677362 0.5601478 0.6468328 NaN
Gestation 0.78178948 0.63260838 0.8853987 0.7593827 NaN
PredIndex 0.07112786 -0.09023386 0.0904068 0.1304698 NaN
ExposeIndex 0.61322176 0.50424965 0.5830778 0.6473671 NaN
DangerIndex 0.28600619 0.14082719 0.3099881 0.3395712 NaN
logbrw 1.00000000 0.79233406 0.7771888 0.9514144 NaN
loglife 0.79233406 1.00000000 0.6417551 0.7079108 NaN
loggest 0.77718882 0.64175514 1.0000000 0.7069276 NaN
logbw 0.95141435 0.70791078 0.7069276 1.0000000 NaN
logpara NaN NaN NaN NaN 1
for some reason log para has this NaN symbol come up
type ?NaN and the help will tell you.> -----Original Message----- > From: Brett Stansfield [mailto:brett at hbrc.govt.nz] > Sent: Monday, 21 March 2005 12:10 PM > To: R help (E-mail) > Subject: [R] NaN > > > Dear R > What does NaN mean? > I recently did a correlation on a batch of data for some > reason it didn't > like one column > cor(sleep,use="complete.obs") > BodyWt BrainWt SlowSleep ParaSleep TotalSleep > BodyWt 1.00000000 0.95584875 -0.3936373 -0.07488845 -0.3428373 > BrainWt 0.95584875 1.00000000 -0.3867947 -0.07427740 -0.3370815 > SlowSleep -0.39363729 -0.38679474 1.0000000 0.51824287 0.9676730 > ParaSleep -0.07488845 -0.07427740 0.5182429 1.00000000 0.7171864 > TotalSleep -0.34283732 -0.33708151 0.9676730 0.71718643 1.0000000 > Lifespan 0.46982146 0.62938940 -0.3722345 -0.26834006 -0.3824462 > Gestation 0.71434413 0.73353206 -0.6061048 -0.40893177 -0.6144743 > PredIndex 0.09588524 -0.01538017 -0.3526558 -0.39795310 -0.4047155 > ExposeIndex 0.40563880 0.32318968 -0.5802789 -0.50363338 -0.6213578 > DangerIndex 0.25932512 0.15093686 -0.5346247 -0.57194862 -0.6043029 > logbrw 0.47461094 0.53992522 -0.6302266 -0.36884187 -0.6223073 > loglife 0.37351520 0.45819097 -0.3549184 -0.38521174 -0.4028017 > loggest 0.41308558 0.45045240 -0.5754478 -0.57234786 -0.6376850 > logbw 0.50905390 0.52255094 -0.6603217 -0.26930774 -0.6174775 > logpara NaN NaN NaN NaN NaN > Lifespan Gestation PredIndex ExposeIndex > DangerIndex > BodyWt 0.46982146 0.71434413 0.09588524 0.4056388 > 0.25932512 > BrainWt 0.62938940 0.73353206 -0.01538017 0.3231897 > 0.15093686 > SlowSleep -0.37223446 -0.60610477 -0.35265576 -0.5802789 > -0.53462471 > ParaSleep -0.26834006 -0.40893177 -0.39795310 -0.5036334 > -0.57194862 > TotalSleep -0.38244618 -0.61447431 -0.40471545 -0.6213578 > -0.60430286 > Lifespan 1.00000000 0.64638866 -0.16973575 0.3157456 > 0.01468596 > Gestation 0.64638866 1.00000000 0.09079823 0.5734727 > 0.30623551 > PredIndex -0.16973575 0.09079823 1.00000000 0.6256876 > 0.92731729 > ExposeIndex 0.31574564 0.57347265 0.62568764 1.0000000 > 0.78980702 > DangerIndex 0.01468596 0.30623551 0.92731729 0.7898070 > 1.00000000 > logbrw 0.73584286 0.78178948 0.07112786 0.6132218 > 0.28600619 > loglife 0.87677362 0.63260838 -0.09023386 0.5042496 > 0.14082719 > loggest 0.56014783 0.88539870 0.09040680 0.5830778 > 0.30998808 > logbw 0.64683285 0.75938272 0.13046983 0.6473671 > 0.33957121 > logpara NaN NaN NaN NaN > NaN > logbrw loglife loggest logbw logpara > BodyWt 0.47461094 0.37351520 0.4130856 0.5090539 NaN > BrainWt 0.53992522 0.45819097 0.4504524 0.5225509 NaN > SlowSleep -0.63022657 -0.35491836 -0.5754478 -0.6603217 NaN > ParaSleep -0.36884187 -0.38521174 -0.5723479 -0.2693077 NaN > TotalSleep -0.62230729 -0.40280169 -0.6376850 -0.6174775 NaN > Lifespan 0.73584286 0.87677362 0.5601478 0.6468328 NaN > Gestation 0.78178948 0.63260838 0.8853987 0.7593827 NaN > PredIndex 0.07112786 -0.09023386 0.0904068 0.1304698 NaN > ExposeIndex 0.61322176 0.50424965 0.5830778 0.6473671 NaN > DangerIndex 0.28600619 0.14082719 0.3099881 0.3395712 NaN > logbrw 1.00000000 0.79233406 0.7771888 0.9514144 NaN > loglife 0.79233406 1.00000000 0.6417551 0.7079108 NaN > loggest 0.77718882 0.64175514 1.0000000 0.7069276 NaN > logbw 0.95141435 0.70791078 0.7069276 1.0000000 NaN > logpara NaN NaN NaN NaN 1 > > for some reason log para has this NaN symbol come up > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >
On Mon, 21 Mar 2005, Brett Stansfield wrote:> Dear R > What does NaN mean?Not a Number. It is the result of improper mathematical expressions such as 0/0, Inf/Inf, logarithms of negative numbers, and so on. Might you have some zeros in `para' giving -Inf logpara? -thomas> I recently did a correlation on a batch of data for some reason it didn't > like one column > cor(sleep,use="complete.obs") > BodyWt BrainWt SlowSleep ParaSleep TotalSleep > BodyWt 1.00000000 0.95584875 -0.3936373 -0.07488845 -0.3428373 > BrainWt 0.95584875 1.00000000 -0.3867947 -0.07427740 -0.3370815 > SlowSleep -0.39363729 -0.38679474 1.0000000 0.51824287 0.9676730 > ParaSleep -0.07488845 -0.07427740 0.5182429 1.00000000 0.7171864 > TotalSleep -0.34283732 -0.33708151 0.9676730 0.71718643 1.0000000 > Lifespan 0.46982146 0.62938940 -0.3722345 -0.26834006 -0.3824462 > Gestation 0.71434413 0.73353206 -0.6061048 -0.40893177 -0.6144743 > PredIndex 0.09588524 -0.01538017 -0.3526558 -0.39795310 -0.4047155 > ExposeIndex 0.40563880 0.32318968 -0.5802789 -0.50363338 -0.6213578 > DangerIndex 0.25932512 0.15093686 -0.5346247 -0.57194862 -0.6043029 > logbrw 0.47461094 0.53992522 -0.6302266 -0.36884187 -0.6223073 > loglife 0.37351520 0.45819097 -0.3549184 -0.38521174 -0.4028017 > loggest 0.41308558 0.45045240 -0.5754478 -0.57234786 -0.6376850 > logbw 0.50905390 0.52255094 -0.6603217 -0.26930774 -0.6174775 > logpara NaN NaN NaN NaN NaN > Lifespan Gestation PredIndex ExposeIndex DangerIndex > BodyWt 0.46982146 0.71434413 0.09588524 0.4056388 0.25932512 > BrainWt 0.62938940 0.73353206 -0.01538017 0.3231897 0.15093686 > SlowSleep -0.37223446 -0.60610477 -0.35265576 -0.5802789 -0.53462471 > ParaSleep -0.26834006 -0.40893177 -0.39795310 -0.5036334 -0.57194862 > TotalSleep -0.38244618 -0.61447431 -0.40471545 -0.6213578 -0.60430286 > Lifespan 1.00000000 0.64638866 -0.16973575 0.3157456 0.01468596 > Gestation 0.64638866 1.00000000 0.09079823 0.5734727 0.30623551 > PredIndex -0.16973575 0.09079823 1.00000000 0.6256876 0.92731729 > ExposeIndex 0.31574564 0.57347265 0.62568764 1.0000000 0.78980702 > DangerIndex 0.01468596 0.30623551 0.92731729 0.7898070 1.00000000 > logbrw 0.73584286 0.78178948 0.07112786 0.6132218 0.28600619 > loglife 0.87677362 0.63260838 -0.09023386 0.5042496 0.14082719 > loggest 0.56014783 0.88539870 0.09040680 0.5830778 0.30998808 > logbw 0.64683285 0.75938272 0.13046983 0.6473671 0.33957121 > logpara NaN NaN NaN NaN NaN > logbrw loglife loggest logbw logpara > BodyWt 0.47461094 0.37351520 0.4130856 0.5090539 NaN > BrainWt 0.53992522 0.45819097 0.4504524 0.5225509 NaN > SlowSleep -0.63022657 -0.35491836 -0.5754478 -0.6603217 NaN > ParaSleep -0.36884187 -0.38521174 -0.5723479 -0.2693077 NaN > TotalSleep -0.62230729 -0.40280169 -0.6376850 -0.6174775 NaN > Lifespan 0.73584286 0.87677362 0.5601478 0.6468328 NaN > Gestation 0.78178948 0.63260838 0.8853987 0.7593827 NaN > PredIndex 0.07112786 -0.09023386 0.0904068 0.1304698 NaN > ExposeIndex 0.61322176 0.50424965 0.5830778 0.6473671 NaN > DangerIndex 0.28600619 0.14082719 0.3099881 0.3395712 NaN > logbrw 1.00000000 0.79233406 0.7771888 0.9514144 NaN > loglife 0.79233406 1.00000000 0.6417551 0.7079108 NaN > loggest 0.77718882 0.64175514 1.0000000 0.7069276 NaN > logbw 0.95141435 0.70791078 0.7069276 1.0000000 NaN > logpara NaN NaN NaN NaN 1 > > for some reason log para has this NaN symbol come up > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle