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
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?
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
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.
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.
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.
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!
Simple and easy to understand. Nice explanation
thank you very much. easy way to learn R packages
Thanks, quick and easy to follow. Best,
How do you document the dataset if you are reading in a csv file?
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
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?
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
@@StatistikinDD Thank you very much!
Nice. This was really handy!
Very helpful. thank you!
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?
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.
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.
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?
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.
@@StatistikinDD aha! thanks for the ultra-fast answer. gonna test it tonight...
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.
Thanks for your comment, Robert. I'll try to stick more to the point next time.
@@StatistikinDD Clearly explained and straight to point. Saved me a lot of time just by watching this video. Thank you!
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!