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

  • SEARCH
  • Home
  • 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 8985931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:26:00+00:00 2026-06-15T21:26:00+00:00

I like to run method=loess on my data set and if errors, I like

  • 0

I like to run method=”loess” on my data set and if errors, I like to try the lm method. Below is my code to do this, but it is still failing, any ideas?

df

Date  Duration  Athlete
1/1/2012  60    A
1/2/2012  30    A
1/3/2012  10    B
1/1/2012  5     C
1/2/2012  5     C
1/4/2012  4     C

ggplot(df, aes(Date, Duration, group=Athlete)) + geom_point(position="jitter", size=0.5) +theme_solarized(light = FALSE) +  geom_smooth(method=ifelse(class(try(loess(Duration~Date, df)))=="try-error", "lm","loess"), se=T)

I get this error:

Error in simpleLoess(y, x, w, span, degree, parametric, drop.square, normalize,  :
  NA/NaN/Inf in foreign function call (arg 2)
In addition: Warning message:
In simpleLoess(y, x, w, span, degree, parametric, drop.square, normalize,  :
  NAs introduced by coercion
Error in function (el, elname)  :
  • 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-15T21:26:02+00:00Added an answer on June 15, 2026 at 9:26 pm

    I think it is better to know which smoothing method you pass to the ggplot2 stat engine.

    For example:

    mym <- "loess"
    tryCatch(loess(Duration~Date, dat), 
             error = function(e) mym <<- "lm")
    

    Then

    ggplot(dat, aes(Date, Duration, group=Athlete)) + 
      geom_point(position="jitter", size=0.5) + 
      geom_smooth(method=mym, se=T)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a action result method i would like to run. How can i
I like to run some code when a user closes my ms 2000 app.
I would like to run this script (embed drive list in a site) that
I would like to run a script in production. This script generates a record
Is there any way to automatically run finalization / destructor code as soon as
In a classes are some methods that are run synchronously. I would like them
I have many lines in my script that look like: ./run -f abc.txt ./run
I have a little script to run a search daemon, like: run.sh : cd
I've got some heavyweight process, which does some video processing. I would like run
I would like to run a jar file extracted from my java project to

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.