Skip to content

Commit

Permalink
Merge pull request #7 from ThinkR-open/6-release-CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFay authored Apr 19, 2023
2 parents 73fafbf + 8b8aae5 commit 36cba80
Show file tree
Hide file tree
Showing 32 changed files with 637 additions and 594 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
^img$
^\.github$
^README\.html$
^cran-comments\.md$
^CRAN-SUBMISSION$
139 changes: 120 additions & 19 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,126 @@
# Contributor Code of Conduct
# Contributor Covenant Code of Conduct

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.
## Our Pledge

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.
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

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.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

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.
## Our Standards

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
opening an issue or contacting one or more of the project maintainers.
Examples of behavior that contributes to a positive environment for our
community include:

This Code of Conduct is adapted from the Contributor Covenant
(http://contributor-covenant.org), version 1.0.0, available at
http://contributor-covenant.org/version/1/0/0/
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders 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, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at contact@colinfay.me.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion].

For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.

[homepage]: https://www.contributor-covenant.org
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.0.0
Date: 2023-04-06 07:39:08 UTC
SHA: beb6fc3312058fd2bd7ee14c969afd2319ceb032
12 changes: 8 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Package: fakir
Title: Create Fake Data in R for tutorials
Title: Generate Fake Datasets for Prototyping and Teaching
Version: 1.0.0
Authors@R:
c(person(given = "Colin",
family = "Fay",
role = c("aut", "cre"),
email = "colin@thinkr.fr",
email = "contact@colinfay.me",
comment = c(ORCID = "0000-0001-7343-1846")),
person(given = "Sebastien",
family = "Rochette",
Expand All @@ -14,7 +14,11 @@ Authors@R:
comment = c(ORCID = "0000-0002-1565-9313")),
person(given = "ThinkR",
role = "cph"))
Description: Create fake datasets that can be used to teach R.
Description: Create fake datasets that can be used for prototyping and teaching.
This package provides a set of functions to generate fake data
for a variety of data types, such as dates, addresses,
and names. It can be used for prototyping (notably in 'shiny') or as a tool
to teach data manipulation and data visualization.
License: MIT + file LICENSE
URL: https://github.com/Thinkr-open/fakir
BugReports: https://github.com/Thinkr-open/fakir/issues
Expand Down Expand Up @@ -44,4 +48,4 @@ VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
RoxygenNote: 7.2.3
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export(fake_base_clients)
export(fake_products)
export(fake_sondage_answers)
export(fake_sondage_people)
export(fake_survey_answers)
export(fake_survey_people)
export(fake_ticket_client)
export(fake_user_feedback)
export(fake_visits)
Expand Down
38 changes: 30 additions & 8 deletions R/fake_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
#' fake_base_clients(n = 10)
#' fake_base_clients(n = 10, local = "fr_FR")
#'
#' @return A dataframe of fake clients.
#' @export

fake_base_clients <- function(n, local = c("en_US", "fr_FR"), seed = 2811) {
fake_base_clients <- function(
n,
local = c("en_US", "fr_FR"),
seed = 2811
) {
stop_if_not(n, is.numeric, "Please provide a numeric value for `n`")
priority_levels <- c("Bronze", "Silver", "Gold", "Platinium")
local <- match.arg(local)
Expand Down Expand Up @@ -68,7 +73,9 @@ fake_base_clients <- function(n, local = c("en_US", "fr_FR"), seed = 2811) {
num_client = as.character(1:n),
fidelity_points = round(
# rlnorm(n, log(as.numeric(Sys.Date() - as.Date(entry_date))), sdlog = 0.5)
abs(rnorm(n, as.numeric(Sys.Date() - as.Date(entry_date)),
abs(rnorm(
n,
as.numeric(Sys.Date() - as.Date(entry_date)),
sd = 0.5 * max(as.numeric(Sys.Date() - as.Date(.$entry_date)))
))
)
Expand All @@ -84,9 +91,16 @@ fake_base_clients <- function(n, local = c("en_US", "fr_FR"), seed = 2811) {
# priorite = sample(c("Gold","Silver","Bronze", "Platinium"), vol, replace = TRUE),
# priorite_encoded = recode(priorite, Bronze = 1L, Silver = 2L, Gold = 3L, Platinium = 4L),
# priorite depending on fidelite
priority_encoded = pmax(pmin(as.numeric(cut(.$fidelity_points, breaks = 4)) +
round(rnorm(n, 0, 0.5)), 4), 1),
priority = factor(priority_levels[priority_encoded],
priority_encoded = pmax(
pmin(
as.numeric(cut(.$fidelity_points, breaks = 4)) +
round(rnorm(n, 0, 0.5)),
4
),
1
),
priority = factor(
priority_levels[priority_encoded],
levels = priority_levels
)
) %>%
Expand Down Expand Up @@ -146,8 +160,15 @@ fake_base_clients <- function(n, local = c("en_US", "fr_FR"), seed = 2811) {
#' barplot(table(x$tickets$state))
#'
#' @export

fake_ticket_client <- function(vol, x, n = 200, split = FALSE, seed = 2811, local = c("en_US", "fr_FR")) {
#' @return A dataframe of fake tickets.
fake_ticket_client <- function(
vol,
x,
n = 200,
split = FALSE,
seed = 2811,
local = c("en_US", "fr_FR")
) {
local <- match.arg(local)

state_level <- c("En cours", "Attente confirmation client", "Attente validation", "Intervention technicien", "Termine")
Expand Down Expand Up @@ -182,7 +203,8 @@ fake_ticket_client <- function(vol, x, n = 200, split = FALSE, seed = 2811, loca
supported_encoded = recode(supported, Oui = 1L, Non = 0L),
type = with_random_na(sample(c("Installation", "Box", "Ligne"), vol, prob = runif(3, 0.25, 1), replace = TRUE)),
type_encoded = recode(type, Installation = 1L, Box = 2L, Ligne = 3L),
state = factor(sample(state_level, vol, prob = runif(5, 0.25, 1), replace = TRUE),
state = factor(
sample(state_level, vol, prob = runif(5, 0.25, 1), replace = TRUE),
levels = state_level
),
source_call = factor(
Expand Down
62 changes: 45 additions & 17 deletions R/fake_products.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,53 @@ fake_name <- function() {
ifelse(runif(1) < 0.05, "Smart ", ""),
sample(
c(
"Activity Tracker", "Watch", "Sleep/Heart Rate Monitor",
"Activity Monitor", "Digital Video Wear", "Wearable",
"Multi-Sport Cardio", "Running Tracker", "Swimming Tracker",
"Biking Tracker", "Fitness Tracker", "Pedometer",
"Step and Distance Pedometer", "Microcontroller",
"Action Video Camera", "Multifunction Tracker",
"Footpod", "Wearable Transmitter", "Exercise Tracker",
"Training System", "Loop Activity Tracker", "Action Camera",
"Strapless Heart Rate Monitor", "Health ring"
"Activity Tracker",
"Watch",
"Sleep/Heart Rate Monitor",
"Activity Monitor",
"Digital Video Wear",
"Wearable",
"Multi-Sport Cardio",
"Running Tracker",
"Swimming Tracker",
"Biking Tracker",
"Fitness Tracker",
"Pedometer",
"Step and Distance Pedometer",
"Microcontroller",
"Action Video Camera",
"Multifunction Tracker",
"Footpod",
"Wearable Transmitter",
"Exercise Tracker",
"Training System",
"Loop Activity Tracker",
"Action Camera",
"Strapless Heart Rate Monitor",
"Health ring"
),
1
),
" ",
fake_symbol(),
" ",
ifelse(runif(1) < 0.5, "Pro ", ""),
ifelse(runif(1) < 0.5,
ifelse(
runif(1) < 0.5,
sprintf(
"with %s",
sample(
c(
"Bluetooth", "GPS", "WiFi", "heart rate sensor",
"Calorie Counter", "MP3 Player",
"Automatic Lap Counter", "Health Management Software",
"Wearable Magneat", "Wi-Fi and GPS",
"Bluetooth",
"GPS",
"WiFi",
"heart rate sensor",
"Calorie Counter",
"MP3 Player",
"Automatic Lap Counter",
"Health Management Software",
"Wearable Magneat",
"Wi-Fi and GPS",
"Activity/Sleep Tracking"
)
)
Expand All @@ -60,6 +82,8 @@ fake_name <- function() {
#' @importFrom charlatan ch_company ch_color_name
#' @importFrom tibble tibble
#'
#' @return A dataframe of fake products.
#'
#' @examples
#' fake_products(10)
fake_products <- function(n, seed = 2811) {
Expand All @@ -72,15 +96,19 @@ fake_products <- function(n, seed = 2811) {
color = ch_color_name(n),
price = sample(1:n, n, TRUE),
body_location = sample(
c("Wrist", "Arms", "Head", "Waist", "Chest", "Hands", "Neck", "Feet", "Torso", "Brain"), n, TRUE
c("Wrist", "Arms", "Head", "Waist", "Chest", "Hands", "Neck", "Feet", "Torso", "Brain"),
n,
TRUE
),
category = sample(
c("Fitness", "Medical", "Lifestyle", "Entertainment", "Industrial", "Pets and Animals", "Gaming", "Awesome"),
n, TRUE
n,
TRUE
),
sent_from = sample(
c("United States", "Japan", "Taiwan", "Canada", "Finland", "South Korea", "Netherlands", "France", "China", "Italy", "Austria"),
n, TRUE
n,
TRUE
),
id = 1:n
)
Expand Down
Loading

0 comments on commit 36cba80

Please sign in to comment.