Skip to content
Prev 361730 / 398506 Next

Warning message in openxlsx

On 15 Jun 2016, at 11:04 , PIKAL Petr <petr.pikal at precheza.cz> wrote:

            
That doesn't usually give a warning, unless an option is set, and even then, it's not quite the same message:
[1]  41  36  12  18  NA  28  23  19   8  NA   7  16  11  14  18  14  34   6
....
Warning message:
In `$.data.frame`(airquality, O) :
  Partial match of 'O' to 'Ozone' in data frame

So it might another $-method that does check for partial matching(?). 

At any rate, this sort of thing can often be debugged using 

options(warn=2, error=recover)

E.g., (with the above option still on)
Error in `$.data.frame`(airquality, O) : 
  (converted from warning) Partial match of 'O' to 'Ozone' in data frame

Enter a frame number, or 0 to exit   

1: airquality$O
2: `$.data.frame`(airquality, O)
3: warning(gettextf("Partial match of '%s' to '%s' in data frame", name, names
4: .signalSimpleWarning("Partial match of 'O' to 'Ozone' in data frame", quote
5: withRestarts({
    .Internal(.signalCondition(simpleWarning(msg, call), msg
6: withOneRestart(expr, restarts[[1]])
7: doWithOneRestart(return(expr), restart)

Selection: 2
Called from: withRestarts({
    .Internal(.signalCondition(simpleWarning(msg, call), msg, 
        call))
    .Internal(.dfltWarn(msg, call))
}, muffleWarning = function() NULL)
Browse[1]> ls()
[1] "a"     "name"  "names" "x"    
Browse[1]> x
    Ozone Solar.R Wind Temp Month Day
1      41     190  7.4   67     5   1
2      36     118  8.0   72     5   2
....
153    20     223 11.5   68     9  30
Browse[1]> name
[1] "O"
Browse[1]> names
[1] "Ozone"   "Solar.R" "Wind"    "Temp"    "Month"   "Day"    

-pd