• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版b2bd2262d7b340292a1d2380b949f2ddcb67b59a (tree)
时间2025-01-07 03:48:34
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

A script showcasing the pointblank package.

更改概述

差异

diff -r 755b11e0bd67 -r b2bd2262d7b3 R-codes/test_agent_pointblank.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/R-codes/test_agent_pointblank.R Mon Jan 06 19:48:34 2025 +0100
@@ -0,0 +1,54 @@
1+rm(list=ls())
2+
3+library(tidyverse)
4+library(pointblank)
5+# Example data
6+
7+data <- data.frame(
8+ id = 1:5,
9+ name = c("Alice", "Bob", NA, "Diana", "Eve"),
10+ score = c(85, 90, 78, NA, 92),
11+ date = as.Date(c("2023-01-01", "2023-02-01", "2023-03-01", "2023-04-01", "2023-05-01"))
12+)
13+
14+# Combine multiple validations
15+agent <-
16+ create_agent(tbl = data) %>%
17+ col_vals_not_null(columns = vars(id, name, date)) %>%
18+ col_vals_between(columns = vars(score), left = 0, right = 100) %>%
19+ col_is_character(columns = vars(name)) %>%
20+ col_is_numeric(columns = vars(score)) %>%
21+ col_is_date(columns = vars(date)) %>%
22+ interrogate()
23+
24+# Generate a validation report
25+agent
26+
27+
28+
29+# Create an informant and annotate the dataset
30+
31+
32+informant <-
33+ create_informant(tbl = data, tbl_name = "example_dataset") %>%
34+ info_columns(
35+ info = list(
36+ id = "Unique identifier for each row.",
37+ name = "Name of the individual.",
38+ score = "Score achieved by the individual (0-100).",
39+ date = "Date of the recorded observation."
40+ )
41+ ) %>%
42+ info_section(
43+ section_name = "Overview",
44+ info = "This dataset contains information about individuals, their scores, and the associated dates."
45+ ) %>%
46+ incorporate()
47+
48+# Generate and view the report
49+informant
50+
51+
52+
53+
54+print("So far so good")