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 7566883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:31:30+00:00 2026-05-30T14:31:30+00:00

When a call exists of multiple lines, a potential error only includes the first

  • 0

When a call exists of multiple lines, a potential error only includes the first line of match.call() resulting in some lost information and an incomplete sentence. A simple example:

#proper error message:
runif(n=1, k=5)

#incomplete error message:
runif(n=1, k={5})

What would be a way to get R to include the full call to the error message (maybe by collapsing the multiple lines or so)? I am mostly interested in using this in a tryCatch setting.

  • 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-05-30T14:31:31+00:00Added an answer on May 30, 2026 at 2:31 pm

    I had a go at investigating the error object in a tryCatch setting via:

    tryCatch( runif(n=1,k={5}),
              error = function(e) recover() )
    

    And then selected the 4th environment (value[[3]](cond)) to examine e.

    I noticed that e$call was:

    Browse[1]> e$call
    runif(n = 1, k = {
        5
    })
    

    So it seems that the error message just uses that first line.

    You can collapse all the lines together with:

    Browse[1]> paste(deparse(e$call),collapse='')
    [1] "runif(n = 1, k = {    5})"
    

    So you could try something like:

    tryCatch( runif(n=1,k={5}),
              error = function(e) {
                cat(sprintf('Error in %s: %s\n',
                     paste(deparse(e$call),collapse=''),
                     e$message))
              } )
    

    But this doesn’t fix up the error message itself, just the call leading up to it:

    Error in runif(n = 1, k = { 5}): unused argument(s) (k = {

    So the ‘Error in xxx’ is complete, but the ‘unused argument(s) xxx’ is still not. It’s a start, but not all the way there.

    I’m not sure how to improve on this (and am also interested to know if it’s possible).

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

Sidebar

Related Questions

We have some methods that call File.Copy, File.Delete, File.Exists, etc. How can we test
Exists a way to call .net assemblies more specific .dll files in java? I
Is there any way to call a function in C# when the user exists
I got two tables in my database: user and call. User exists of 3
I am working with ASP.net. I am trying to call a method that exists
I call my JavaScript function. Why do I sometimes get the error 'myFunction is
I am getting an Error An object with the same key already exists in
What is their use if when you call the method, it might not exist?
Call me a 'n00b', but I am new to creating Script Controls. I want
I call a javascript function from a textbox by using OnKeyPress=clickSearchButton() Here is my

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.