![]() Warning("Please make sure that you provide a valid airline IATA code.")ĭo not forget to add the otherwise your functions will not be there when you open your package! Stop("Please set your FlightStats AppID and API Key with the setAPIKey() and setAppId() function. For example, here is a simple function to list all airlines: listAirlines <- function(activeOnly=TRUE) Let’s make another function that we can add to the package. Read.table(file = file, header = header, sep = sep, quote = quote,ĭec = dec, fill = fill, comment.char = comment.char. For example, imagine we want to include these two functions to store the API key and an app ID: setAPIKey read.csvįunction (file, header = TRUE, sep = ",", quote = "\"", dec = ".", Prepare the functions you want to includeįirst of all, we need to have all the functions (and possibly dataframes & other objects) ready in our R environment. Also, I learned a lot using this package as an example. Two links I found very useful for getting started making my first package are this one and this one (regarding the storing of API keys). However, you can of course make a wrapper for any API you like or make a non-API related package. You can sign up for FlightStats to get a free trial API key (which unfortunately works for one month only). My first package is a wrapper for the FlightStats API. Of course, there are different approaches out there, some of them very well documented, like for example this one – but the following 3 easy steps worked for me, so maybe they will help you too getting your first R package ready, installed and online quickly. Therefore, I will explain how I made my first R package and which methods I found helpful. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |