Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:45:50+00:00 2026-06-04T03:45:50+00:00

I’m trying to use the R caret module for model generation and I want

  • 0

I’m trying to use the R caret module for model generation and I want to use some cross-validation function. I found out that the only cross validation function which works together with rpart is LOOCV (leave one out cross validation).

The following code throws the error:

library(cart)
data(trees)
formula=Volume~Girth+Height
train(formula, data=trees,  method='rpart')

Warning message: In nominalTrainWorkflow(dat = trainData, info =
trainInfo, method = method, : There were missing values in
resampled performance measures.

What does this error mean and how do I make it go away? I searched on the internet, not a single hit for this error-message. I traced the error down to the rpart model generation. It somehow outputs this error message, all other mode-generation-methods work fine!

Everything works fine if I use LOOCV.

I traced the warning down to the workflows.R file, but I do not understand why this warning gets thrown.

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] earth_3.2-3           plotrix_3.4           plotmo_1.3-1         
 [4] leaps_2.9             doMC_1.2.5            multicore_0.1-7      
 [7] iterators_1.0.6       forecast_3.20         RcppArmadillo_0.3.0.2
[10] Rcpp_0.9.10           fracdiff_1.4-1        tseries_0.10-28      
[13] zoo_1.7-7             quadprog_1.5-4        caret_5.15-023       
[16] foreach_1.4.0         cluster_1.14.2        reshape_0.8.4        
[19] plyr_1.7.1            lattice_0.20-6        mda_0.4-2            
[22] class_7.3-3           rpart_3.1-52          data.table_1.8.0     

loaded via a namespace (and not attached):
[1] codetools_0.2-8 compiler_2.15.0 grid_2.15.0    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:45:51+00:00Added an answer on June 4, 2026 at 3:45 am

    Using the R Mailinglist and the help of the caret author I found out the following solution:

    If for some reason the model which is generated is constant the error occurs. Constant means in this case that for all input values the model always yields the same value. In this case, the calculation of R^2 fails. R^2 is calculated per default by caret. As caret does not use the R^2 value for model selection, you can skip this error.

    Two questions remain:

    • It is not clear to me why the R^2 calculation fails if the model is constant. The code in caret explicitely fails if there are not at least two different values in the model prediction. I replaced the R^2 calculation with a selfwritten one which does not have these limits.
    • The question why rpart sometimes generates a constant model is still open. Especially why it only generates constant models for other cross validations than LOOCV.

    In short: You can ignore the warning and if you need, write your own R^2 to fix the warning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.