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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:19:29+00:00 2026-06-07T04:19:29+00:00

This question is in the context where I have a lot Model types, each

  • 0

This question is in the context where I have a lot Model types, each of the same class, but the amount of data for each Model is small and I want to spline to get a fuller dataset. I’m hoping to find a way to do this without having to individually spline every Model once at a time.

So I have the following df:

mydf<- data.frame(c("a","a","b","b","c","c"),c("e","e","e","e","e","e")
                 ,as.numeric(c(1,2,3,10,20,30)),
                 as.numeric(c(5,10,20,20,15,10)))

Give some names:

colnames(mydf)<-c("Model", "Class","Seconds", "Speed")

Which creates:

> mydf
  Model Class Seconds Speed
1     a     e       1     5
2     a     e       2    10
3     b     e       3    20
4     b     e      10    20
5     c     e      20    15
6     c     e      30    10

So I want a spline on the Seconds and Speed columns for each Model. So for example if I used spline on Model “a”, it you only spline those elements on “a” as the model.

Like:

spline(x=mydf[1:2,3], y=mydf[1:2,4])
$x
[1] 1.0 1.2 1.4 1.6 1.8 2.0

$y
[1]  5  6  7  8  9 10

This works but when you have a hundreds of models…

I want to spline “a” only using “a” and then it moves to “b” and splines only “b” etc. Ideally it would output as a new dataframe but at this point I’d just like to not get an error.

I tried ddply in plyr but getting errors. I’m hoping to avoid using loops or functions with loops but if that’s the only option then…

Thanks and please let me know if I can improve the question.

  • 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-07T04:19:30+00:00Added an answer on June 7, 2026 at 4:19 am

    What about this:

    ddply(mydf, .(Model), summarise, Spline = spline(x = Seconds, y = Speed), 
          Var = c("Seconds", "Speed"))
      Model                        Spline     Var
    1     a  1.0, 1.2, 1.4, 1.6, 1.8, 2.0 Seconds
    2     a             5, 6, 7, 8, 9, 10   Speed
    3     b 3.0, 4.4, 5.8, 7.2, 8.6, 10.0 Seconds
    4     b        20, 20, 20, 20, 20, 20   Speed
    5     c        20, 22, 24, 26, 28, 30 Seconds
    6     c        15, 14, 13, 12, 11, 10   Speed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has been asked in a C++ context but I'm curious about Java.
This is probably a very simple question, but at this time I have myself
This question may sprout from the fact that I'm still confused about context and
Context I apologize for this question being soft / philosophical; it's a set of
Being spotted in context of this question this seemingly inconsistent behavior can be reproduced
First of all, the context of this question is: Cannot install psycopg2 on OSX
This is a design question, I noticed that by time by LINQ-to-SQL Context gets
I have read some topic regarding with my question but there code doesn't work
There are a lot of questions concerning this issue, but I don't believe any
This is more of a Python general question however in a context of django.

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.