How to Include Data in Your R Package

Поділитися
Вставка
  • Опубліковано 23 січ 2025

КОМЕНТАРІ • 20

  • @kabilans9666
    @kabilans9666 2 роки тому +3

    Simple and easy to understand. Nice explanation

  • @anne-cecilelesage9139
    @anne-cecilelesage9139 Місяць тому

    thank you very much. easy way to learn R packages

  • @matthewkumar7756
    @matthewkumar7756 2 роки тому

    Thanks, quick and easy to follow. Best,

  • @briandong5293
    @briandong5293 2 роки тому +1

    How do you document the dataset if you are reading in a csv file?

    • @StatistikinDD
      @StatistikinDD  2 роки тому +1

      Good question. As far as I know, data documentation works for R objects. csv is a non-native format from R's perspective.
      Some packages contain data (as R-native objects) and additionally make the same data available in .csv or .tsv format, like palmerpenguins and gapminder.
      r-pkgs.org/data.html#sec-data-extdata

  • @johannesjoseph823
    @johannesjoseph823 4 місяці тому

    how do I add several data sets with different names in my package? I suppose each one needs its own .R file with the documentation, but how shoul they be named? just data.R?

    • @StatistikinDD
      @StatistikinDD  4 місяці тому +1

      I recommend a speaking name for each dataset and a corresponding name for each .R file. Example (from my chartmusicdata package, which you can find at github: fjodor/chartmusicdata):
      Datasets: topsongs.Rda, topalbums.Rda, albums2000.Rda, songs2000.Rda
      Documentation: topsongs.R, topalbums.R, albums2000.R, songs2000.R

    • @johannesjoseph823
      @johannesjoseph823 4 місяці тому

      @@StatistikinDD Thank you very much!

  • @pipertripp
    @pipertripp Рік тому

    Nice. This was really handy!

  • @dominicacri5395
    @dominicacri5395 5 місяців тому

    Very helpful. thank you!

  • @saimajahan8317
    @saimajahan8317 7 місяців тому

    I like that video. I have a question is it possible to add data from a package (which is not mine) to t? If possible, then how?

    • @StatistikinDD
      @StatistikinDD  7 місяців тому

      You can add any data that you can get in the Global Environment.
      If it is already in a package, you may also add that package to Suggests or Imports.

    • @StatistikinDD
      @StatistikinDD  7 місяців тому

      So how: load data into Global Environment. Then proceed as in video.
      I'm just not sure if I'd like the same data in different packages. But there may be situations where it makes sense. E. g. to avoid dependency on that other package, maybe because it contains a lot more than the data, or because it is difficult to access in your environment.

  • @georgegl3192
    @georgegl3192 2 роки тому

    Thanks alot! This has been absolutely helpful. But how do i push this now to github? Or how do i create a new package project and link it to github?

    • @StatistikinDD
      @StatistikinDD  2 роки тому +1

      If it's not a local project, make it one. In RStudio, you can use the "New Project" option in the projects menu in the top right corner.
      If it's a local project, but without a git repository, create one. You can use usethis::use_git() to that end.
      If it's a local project with a git repository that is not yet on github, you can push it there using usethis::use_github(). Check the help page to see about the options, e. g. how to make it a private repository.

    • @georgegl3192
      @georgegl3192 2 роки тому

      @@StatistikinDD aha! thanks for the ultra-fast answer. gonna test it tonight...

  • @robertzimbardo8227
    @robertzimbardo8227 Рік тому

    Why do you waste so much time on explaining what the function inhouse_calc does? No one cares it scales, no one cares it's not exactly between 0 and 100, etc. The video title says this is about including data in your R package so it would be better to focus on that and leave everything distracting aside.

    • @StatistikinDD
      @StatistikinDD  Рік тому

      Thanks for your comment, Robert. I'll try to stick more to the point next time.

    • @marwanotrok4311
      @marwanotrok4311 Рік тому

      @@StatistikinDD Clearly explained and straight to point. Saved me a lot of time just by watching this video. Thank you!

    • @sametayaz4891
      @sametayaz4891 Рік тому

      You have a very logical point but some information about other stuff comes with main topic's wind. You don't just go from point a to b. You also see where the supermarket on your way to point b. This kind of informations is crucial for some people, and showing it with a realistic and alive example is also important. You can simply skip it. Anyways. Great tutorial @StatistikinDD keep it rooling!