'MASS::predict.lda' is not an exported object from 'namespace:MASS'

janonime

This R code:

Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
                   Sp = rep(c("s","c","v"), rep(50,3)))
train <- sample(1:150, 75)
z <- MASS::lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
MASS::predict.lda(z)

gives the following error message:

Error: 'predict.lda' is not an exported object from 'namespace:MASS'

The predict.lda function of MASS is documented but, apparently, not part of the package's namespace. Why not?

This problem is important because I need to use predict.lda in a package of my own and this error is making it fail the CRAN checks.

akrun

We can load the package and then use predict

library(MASS)
predict(z)

Or specify the :::. According to ?":::"

Accessing exported and internal variables, i.e. R objects (including lazy loaded data sets) in a namespace.

MASS:::predict.lda(z)
#$class
# [1] v s s s s c s v s v v v v c v v c v c s s s s c c v c v v c s s v c s s c v s c v v s c s c s c c s v c s s c s s c c c s c s v
#[65] v v v s c s c v v s s
#Levels: c s v

#$posterior
#               c            s            v
#107 3.513603e-03 1.352029e-37 9.964864e-01
#37  2.749629e-26 1.000000e+00 5.088976e-50
# ...

Or another option is to get the function from name space

predictlda <- getFromNamespace("predict.lda", "MASS")
predictlda(z)
#$class
# [1] v s s s s c s v s v v v v c v v c v c s s s s c c v c v v c s s v c s s c v s c v v s c s c s c c s v c s s c s s c c c s c s v
#[65] v v v s c s c v v s s
#Levels: c s v

#$posterior
#               c            s            v
#107 3.513603e-03 1.352029e-37 9.964864e-01
#37  2.749629e-26 1.000000e+00 5.088976e-50
# ..

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to suspend Mass Transit processing messages from the queue

From Dev

how to search day from mass data which equal today

From Dev

Pull mass name list from database or in script?

From Dev

Bullet physics mass center and weird object reaction

From Dev

Mass-add an object if it is an instance of a class

From Dev

Ruby object mass assignment

From Dev

Accessing mass information from a belongs_to association

From Dev

Notepad ++ How to multiply numbers from mass replace?

From Dev

How do fractions vectors (from MASS) have error checking?

From Dev

From ODE Hill kinetics to stochastic mass action

From Dev

How to share a folder as an USB mass storage device (from a raspberry pi)

From Dev

How to suspend Mass Transit processing messages from the queue

From Dev

how to search day from mass data which equal today

From Dev

Nodejs mongoose Mass/Batch update from file

From Dev

Optimizing the performance of mass inserts from file SQLite Android

From Dev

Mass Uninstalling

From Dev

Mass recoloring of PNGs from command line

From Dev

Mass URL parameter cleanup from txt file

From Dev

Matlab - Center of mass of object having only its edge

From Dev

rails mass update column by inserting value calculated from other columns

From Dev

Mass renaming directories to move the year from end to beginning

From Dev

Mass-add an object if it is an instance of a class

From Dev

Mass file renaming from from text file

From Dev

Bagging with random forest, object not found even with MASS:Boston data set

From Dev

How do I mass install apt packages conditionally from a file?

From Dev

apt-get mass install packages from a file?

From Dev

Package mass change for exported SAP development objects

From Dev

Mass removal of content and properties from divs

From Dev

Symfony mass hydration from one repository to another

Related Related

  1. 1

    How to suspend Mass Transit processing messages from the queue

  2. 2

    how to search day from mass data which equal today

  3. 3

    Pull mass name list from database or in script?

  4. 4

    Bullet physics mass center and weird object reaction

  5. 5

    Mass-add an object if it is an instance of a class

  6. 6

    Ruby object mass assignment

  7. 7

    Accessing mass information from a belongs_to association

  8. 8

    Notepad ++ How to multiply numbers from mass replace?

  9. 9

    How do fractions vectors (from MASS) have error checking?

  10. 10

    From ODE Hill kinetics to stochastic mass action

  11. 11

    How to share a folder as an USB mass storage device (from a raspberry pi)

  12. 12

    How to suspend Mass Transit processing messages from the queue

  13. 13

    how to search day from mass data which equal today

  14. 14

    Nodejs mongoose Mass/Batch update from file

  15. 15

    Optimizing the performance of mass inserts from file SQLite Android

  16. 16

    Mass Uninstalling

  17. 17

    Mass recoloring of PNGs from command line

  18. 18

    Mass URL parameter cleanup from txt file

  19. 19

    Matlab - Center of mass of object having only its edge

  20. 20

    rails mass update column by inserting value calculated from other columns

  21. 21

    Mass renaming directories to move the year from end to beginning

  22. 22

    Mass-add an object if it is an instance of a class

  23. 23

    Mass file renaming from from text file

  24. 24

    Bagging with random forest, object not found even with MASS:Boston data set

  25. 25

    How do I mass install apt packages conditionally from a file?

  26. 26

    apt-get mass install packages from a file?

  27. 27

    Package mass change for exported SAP development objects

  28. 28

    Mass removal of content and properties from divs

  29. 29

    Symfony mass hydration from one repository to another

HotTag

Archive