Help with creating RScript range factor for baseball players

im working on a personal project here and need some help. Using the people table from the Lahman database to find the playerID for Derek Jeter, Ozzie Smith, and Javier Baez
Create a function to calculate their MLB ages for every year (remember it is the age you are on June 30)

Create Range Factor and Fielding Percentage for Every Year
Plot Range Factor by Age
Plot Fiedling % by Age

What have you tried so far? What is not working?

As posted, your question looks rather like homework problem and you are much more likely to get help if you show an effort in actually doing some of the legwork.

1 Like

RScript is far from my specialty. I started working with it for the first time last week. I would appreciate some help as I do not know where to start.

Where to start to get effective help:

  1. build a toy dataset that conveys just enough information to demonstrate your problem. Usually 5-10 rows and just the critical variables. Copy your data and then Datapasta::tribble can help create a small dataset and assign it to a variable like df. For example,
    df <- datapasta::tribble()
    Details on how to datapasta can be found at

  1. Once you have your toy dataset, you need to build a reprex, or reproducible example. This will include the libraries you need (likely tidyverse), your data,
    and a few steps in attempting the problem. You also need to define the variables that you want to calculate - like range factor and fielding %, unless these are already calculated in your raw data. The guide below can help you reprex.
1 Like