YEAR: 2018 94 | COPYRIGHT HOLDER: Evan Odell 95 |96 | 97 |
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
156 |We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
157 |Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
158 |Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
159 |Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
160 |This Code of Conduct is adapted from the Contributor Covenant (https:contributor-covenant.org), version 1.0.0, available at https://contributor-covenant.org/version/1/0/0/
161 |Copyright (c) 2018 Evan Odell
96 |Permission is hereby granted, free of charge, to any person obtaining 97 | a copy of this software and associated documentation files (the 98 | “Software”), to deal in the Software without restriction, including 99 | without limitation the rights to use, copy, modify, merge, publish, 100 | distribute, sublicense, and/or sell copies of the Software, and to 101 | permit persons to whom the Software is furnished to do so, subject to 102 | the following conditions:
103 |The above copyright notice and this permission notice shall be 104 | included in all copies or substantial portions of the Software.
105 |THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 106 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 107 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 108 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 109 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 110 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 111 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
112 |R/nomisr-package.R
95 | nomisr.RdAccess UK official statistics from the Nomis database. Nomis 100 | includes data from the Census, the Labour Force Survey, DWP benefit 101 | statistics and other economic and demographic data from the Office for 102 | National Statistics.
103 |The package provides functions to find what data is available, metadata, 109 | including the variables and query options for different datasets and 110 | a function for downloading data.
111 |The full API documentation and optional registration for an API key is 112 | available at https://www.nomisweb.co.uk/api/v01/help.
113 |As contributors and maintainers of this project, we pledge to respect 96 | all people who contribute through reporting issues, posting feature 97 | requests, updating documentation, submitting pull requests or patches, 98 | and other activities.
99 |We are committed to making participation in this project a 100 | harassment-free experience for everyone, regardless of level of 101 | experience, gender, gender identity and expression, sexual orientation, 102 | disability, personal appearance, body size, race, ethnicity, age, or 103 | religion.
104 |Examples of unacceptable behavior by participants include the use of 105 | sexual language or imagery, derogatory comments or personal attacks, 106 | trolling, public or private harassment, insults, or other unprofessional 107 | conduct.
108 |Project maintainers have the right and responsibility to remove, 109 | edit, or reject comments, commits, code, wiki edits, issues, and other 110 | contributions that are not aligned to this Code of Conduct. Project 111 | maintainers who do not follow the Code of Conduct may be removed from 112 | the project team.
113 |Instances of abusive, harassing, or otherwise unacceptable behavior 114 | may be reported by opening an issue or contacting one or more of the 115 | project maintainers.
116 |This Code of Conduct is adapted from the Contributor Covenant (https:contributor-covenant.org), version 1.0.0, 117 | available at https://contributor-covenant.org/version/1/0/0/
118 |Assign or reassign API key for Nomis.
97 |nomis_api_key(check_env = FALSE)If TRUE, will check the environment variable
107 | NOMIS_API_KEY first before asking for user input.
The Nomis API has an optional key. Using the key means that 100,000 112 | rows can be returned per call, which can speed up larger data requests and 113 | reduce the chances of being rate limited or having requests timing out.
114 |By default, nomisr will look for the environment variable
115 | NOMIS_API_KEY when the package is loaded. If found, the API key will
116 | be stored in the session option nomisr.API.key. If you would like to
117 | reload the API key or would like to manually enter one in, this function
118 | may be used.
You can sign up for an API key 120 | here.
121 |
94 | All functions95 | 96 | |
97 | |
|---|---|
| 98 | 99 | | 100 |Nomis API Key |
101 |
| 102 | 103 | | 104 |Nomis codelists |
105 |
| 106 | 107 | | 108 |Nomis dataset content types |
109 |
| 110 | 111 | | 112 |Nomis data structures |
113 |
| 114 | 115 | | 116 |Retrieve Nomis datasets |
117 |
| 118 | 119 | | 120 |Nomis metadata concepts and types |
121 |
| 122 | 123 | | 124 |Nomis dataset overview |
125 |
| 126 | 127 | | 128 |Search Nomis datasets |
129 |
| 130 | 131 | | 132 |nomisr: Access Nomis UK Labour Market Data with R |
133 |
} and \verb{gender = }
88 | as a dot parameter.}
89 |
90 | \item{measures}{The code for the statistical measure(s) to include in the
91 | data. Accepts a single string or number, or a list of strings or numbers.
92 | If \code{NULL}, returns data for all available statistical measures subject
93 | to other parameters. Defaults to \code{NULL}.}
94 |
95 | \item{additional_queries}{Any other additional queries to pass to the API.
96 | See \url{https://www.nomisweb.co.uk/api/v01/help} for instructions on
97 | query structure. Defaults to \code{NULL}. Deprecated in package versions greater
98 | than 0.2.0 and will eventually be removed in a future version.}
99 |
100 | \item{exclude_missing}{If \code{TRUE}, excludes all missing values.
101 | Defaults to \code{FALSE}.}
102 |
103 | \item{select}{A character vector of one or more variables to include in
104 | the returned data, excluding all others. \code{select} is not case sensitive.}
105 |
106 | \item{tidy}{Logical parameter. If \code{TRUE}, converts variable names to
107 | \code{snake_case}, or another style as specified by the
108 | \code{tidy_style} parameter. Defaults to \code{FALSE}. The default variable name style
109 | from the API is SCREAMING_SNAKE_CASE.}
110 |
111 | \item{tidy_style}{The style to convert variable names to, if
112 | \code{tidy = TRUE}. Accepts one of \code{"snake_case"}, \code{"camelCase"}
113 | and \code{"period.case"}, or any of the \code{case} options accepted by
114 | \code{\link[snakecase:to_any_case]{snakecase::to_any_case()}}. Defaults to \code{"snake_case"}.}
115 |
116 | \item{query_id}{Results can be labelled as belonging to a certain query
117 | made to the API. \code{query_id} accepts any value as a string, and will
118 | be included in every row of the tibble returned by \code{nomis_get_data}
119 | in a column labelled "QUERY_ID" in the default SCREAMING_SNAKE_CASE
120 | used by the API. Defaults to \code{NULL}.}
121 |
122 | \item{...}{Use to pass any other parameters to the API. Useful for passing
123 | concepts that are not available through the default parameters. Only accepts
124 | concepts identified in \code{\link[=nomis_get_metadata]{nomis_get_metadata()}} and concept values
125 | identified in \code{\link[=nomis_codelist]{nomis_codelist()}}. Parameters can be quoted or
126 | unquoted. Each parameter should have a name and a value. For example,
127 | \code{CAUSE_OF_DEATH = 10300} when querying dataset \code{"NM_161_1"}.
128 | Parameters are not case sensitive. Note that R using partial matching for
129 | function variables, and so passing a parameter with the same opening
130 | characters as one of the above-named parameters can cause an error unless
131 | the value of the named parameter is specified, including as \code{NULL}.
132 | See example below:}
133 | }
134 | \value{
135 | A tibble containing the selected dataset. By default, all tibble
136 | columns except for the \code{"OBS_VALUE"} column are parsed as characters.
137 | }
138 | \description{
139 | To find the code options for a given dataset, use
140 | \code{\link[=nomis_get_metadata]{nomis_get_metadata()}} for specific codes, and
141 | \code{\link[=nomis_codelist]{nomis_codelist()}} for code values.
142 |
143 | This can be a slow process if querying significant amounts of
144 | data. Guest users are limited to 25,000 rows per query, although
145 | \code{nomisr} identifies queries that will return more than 25,000 rows,
146 | sending individual queries and combining the results of those queries into
147 | a single tibble. In interactive sessions, \code{nomisr} will warn you if
148 | guest users are requesting more than 350,000 rows of data, and if
149 | registered users are requesting more than 1,500,000 rows.
150 |
151 | Note the difference between the \code{time} and \code{date}
152 | parameters. The \code{time} and \code{date} parameters should not be used at the same
153 | time. If they are, the function will retrieve data based on the the
154 | \code{date} parameter. If given more than one query, \code{time} will
155 | return all data available between those queries, inclusively, while
156 | \code{date} will only return data for the exact queries specified. So
157 | \code{time = c("first", "latest")} will return all data, while
158 | \code{date = c("first", "latest")} will return only the earliest and latest
159 | data published.
160 | }
161 | \examples{
162 | \donttest{
163 |
164 | # Return data on Jobseekers Allowance for each country in the UK
165 | jobseekers_country <- nomis_get_data(
166 | id = "NM_1_1", time = "latest",
167 | geography = "TYPE499",
168 | measures = c(20100, 20201), sex = 5
169 | )
170 |
171 | # Return data on Jobseekers Allowance for Wigan
172 | jobseekers_wigan <- nomis_get_data(
173 | id = "NM_1_1", time = "latest",
174 | geography = "1879048226",
175 | measures = c(20100, 20201), sex = "5"
176 | )
177 |
178 | # annual population survey - regional - employment by occupation
179 | emp_by_occupation <- nomis_get_data(
180 | id = "NM_168_1", time = "latest",
181 | geography = "2013265925", sex = "0",
182 | select = c(
183 | "geography_code",
184 | "C_OCCPUK11H_0_NAME", "obs_vAlUE"
185 | )
186 | )
187 |
188 | # Deaths in 2016 and 2015 by three specified causes,
189 | # identified with nomis_get_metadata()
190 | death <- nomis_get_data("NM_161_1",
191 | date = c("2016", "2015"),
192 | geography = "TYPE480",
193 | cause_of_death = c(10300, 102088, 270)
194 | )
195 |
196 | # All causes of death in London in 2016
197 | london_death <- nomis_get_data("NM_161_1",
198 | date = c("2016"),
199 | geography = "2013265927", sex = 1, age = 0
200 | )
201 | }
202 | \dontrun{
203 | # Results in an error because `measure` is mistaken for `measures`
204 | mort_data1 <- nomis_get_data(
205 | id = "NM_161_1", date = "2016",
206 | geography = "TYPE464", sex = 0, cause_of_death = "10381",
207 | age = 0, measure = 6
208 | )
209 |
210 | # Does not error because `measures` is specified
211 | mort_data2 <- nomis_get_data(
212 | id = "NM_161_1", date = "2016",
213 | geography = "TYPE464", sex = 0, measures = NULL,
214 | cause_of_death = "10381", age = 0, measure = 6
215 | )
216 | }
217 |
218 | }
219 | \seealso{
220 | \code{\link[=nomis_data_info]{nomis_data_info()}}
221 |
222 | \code{\link[=nomis_get_metadata]{nomis_get_metadata()}}
223 |
224 | \code{\link[=nomis_codelist]{nomis_codelist()}}
225 |
226 | \code{\link[=nomis_overview]{nomis_overview()}}
227 | }
228 |
--------------------------------------------------------------------------------
/docs/CONTRIBUTING.html:
--------------------------------------------------------------------------------
1 |
2 | Contributing to nomisr • nomisr
6 |
7 |
8 |
9 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | Contributing to nomisr
91 |
92 |
93 |
94 |
95 |
96 | Thank you for any and all contributions! Following these guidelines
97 | will help streamline the process of contributing and make sure that
98 | we’re all on the same page. While we ask that you read this guide and
99 | follow it to the best of your abilities, we welcome contributions from
100 | all, regardless of your level of experience.
101 | By participating in this project, you agree to abide by the code of
102 | conduct.
103 |
104 |
105 | Types of contributions
106 | Don’t feel that you must be a computer whiz to make meaningful
107 | contributions. Feel free to:
108 | - Identify areas for future development (open an Issue)
109 | - Identify issues/bugs (open an Issue)
110 | - Write tutorials/vignettes (open a Pull Request
111 | to contribute to the ones here, or make your own elsewhere and send us a
112 | link)
113 | - Add functionality (open a Pull
114 | Request)
115 | - Fix bugs (open a
116 | Pull Request)
117 |
118 |
119 | New to GitHub?
120 | Getting ready to make your first contribution? Here are a couple of
121 | tutorials you may wish to check out:
122 | - Tutorial for
123 | first-timers
124 | - How
125 | to contribute (in-depth lessons)
126 | - GitHub on
127 | setup
128 | -
129 | GitHub on
130 | pull requests.)
131 |
132 |
133 | How to contribute code
134 | - Fork the repository
135 | - Clone the repository from GitHub to your computer e.g,.
136 |
git clone https://github.com/ropensci/nomisr.git
137 |
138 | - Make sure to track progress upstream (i.e., on our version of
139 |
nomisr at ropensci/nomisr)
140 | git remote add upstream https://github.com/ropensci/nomisr.git
141 | - Before making changes make sure to pull changes in from upstream
142 | with
git pull upstream
143 |
144 |
145 | - Make your changes
146 |
- For changes beyond minor typos, add an item to NEWS.md describing
147 | the changes and add yourself to the DESCRIPTION file as a
148 | contributor
149 |
150 | - Push to your GitHub account
151 | - Submit a pull request to home base (likely master branch, but check
152 | to make sure) at
ropensci/nomisr
153 |
154 |
155 |
156 | Code formatting
157 | - In general follow the convention of https://r-pkgs.had.co.nz/r.html#style (snake_case
158 | functions and argument names, etc.)
159 | - Where there is conflict, default to the style of
160 |
nomisr
161 |
162 | - Use explicit package imports (i.e. package_name::package_function)
163 | and avoid @import if at all possible
164 |
165 |
166 |
167 |
168 |
169 |
172 |
173 |
174 |
175 |
176 |
177 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
--------------------------------------------------------------------------------