Giter Club home page Giter Club logo

Comments (18)

BillPetti avatar BillPetti commented on July 24, 2024

So, it used to be there, but looking at the url structure they changed it--basically because there are a ton more fields available. So, yes, but I'll need to update the url and subsequent formatting used in the function.

from baseballr.

jestarr avatar jestarr commented on July 24, 2024

Perfect. Is the pitcher leaderboard scrape coming soon?

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

playerid will be added in the next package update. No plans right now for the pitcher leader board, but if someone wanted to tackle it in a pull request that would be groovy.

from baseballr.

jestarr avatar jestarr commented on July 24, 2024

Did the fgid make it into this package?

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

Yes

from baseballr.

jestarr avatar jestarr commented on July 24, 2024

I didn't see it when I ran it, and also didn't see it in the code. Not sure if I did something wrong on my end.

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

It was there when I tested it. I’ll double check later.

from baseballr.

jestarr avatar jestarr commented on July 24, 2024

Any updates on this bug?

from baseballr.

stevebit avatar stevebit commented on July 24, 2024

Any updates on the bug. I just ran the function and didn't get the id.

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

Unfortunately, this is not so much a bug as an enhancement. The data needs to pull retrieved in a different way to get the playerid returned with the leaderboards. I have not worked out an approach yet.

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

So looking this over, I should be able to extract playerid from the url for each player from the html of the page. Just need to find some time to do it.

from baseballr.

stevebit avatar stevebit commented on July 24, 2024

That would be very cool. Unfortunately my programming skills aren't nearly as good as yours or I would offer to help.

from baseballr.

jestarr avatar jestarr commented on July 24, 2024

Without doing a full fork, and PR, how about something like?

    find_possible_playerids <- leaders %>% html_nodes("a") %>% as.character()
    find_playerids <- find_possible_playerids[grep("statss.aspx\\?playerid=", find_possible_playerids)]
    find_playerids_split <- strsplit(find_playerids, "\\&") %>% sapply(., "[", 1)
    fangraphs_pg_playerids <- gsub("[[:alpha:]]*[[:punct:]]*[[:space:]]*", "", find_playerids_split)

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

This should be fixed now with the latest commit. Give it a reinstall and let me know if it brakes.

from baseballr.

stevebit avatar stevebit commented on July 24, 2024

I just reinstalled and tested it but didn't get the playerid field. I reinstalled using,
devtools::install_github("BillPetti/baseballr")

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

Check and make sure your function’s content includes the new playerid code. You may need to force the install to get the updated version, install_github(“BillPetti/baseballr”, force = TRUE).

from baseballr.

stevebit avatar stevebit commented on July 24, 2024

Great, I got it working, everything looks good.

Separate question. Is there anyway to get a playid for the following function. daily_batter_bref() ? We get the names but it's difficult to match the names to an MLBID.

Cheers,

from baseballr.

BillPetti avatar BillPetti commented on July 24, 2024

Probably, but please open a separate issue for it.

from baseballr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.