Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit10e38df

Browse files
0.99.60
1 parentedd0f33 commit10e38df

23 files changed

+654
-65
lines changed

‎DESCRIPTION‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: DescTools
22
Type: Package
33
Title: Tools for Descriptive Statistics
4-
Version: 0.99.59.7
5-
Date: 2025-03-16
4+
Version: 0.99.60
5+
Date: 2025-03-28
66
Authors@R: c(
77
person(given="Andri", family="Signorell",
88
email = "andri@signorell.net",
@@ -133,7 +133,7 @@ Suggests:
133133
R.rsp,
134134
testthat (>= 3.0.0)
135135
Depends: base, stats, R (>= 4.2.0)
136-
Imports: graphics, grDevices, methods, MASS, utils, boot, mvtnorm, expm, Rcpp (>= 0.12.10), rstudioapi, Exact, gld, data.table, readxl, haven, httr, withr, cli, fs
136+
Imports: graphics, grDevices, methods, MASS, utils, boot, mvtnorm, expm, Rcpp (>= 0.12.10), rstudioapi, Exact, gld, data.table, readxl,readr,haven, httr, withr, cli, fs
137137
LinkingTo: Rcpp
138138
License: GPL (>= 2)
139139
LazyLoad: yes

‎NAMESPACE‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ export(
8383
"CmykToCmy", "CmyToCmyk", "RgbToCmy", "CmykToRgb", "RevCode", "MADCI","QuantileCI", "BinomCIn",
8484
"GetCalls", "BhapkarTest", "StrExtractBetween", "GenRandGroups", "Rank", "rSum21",
8585
"dTri","pTri","qTri","rTri",
86-
"BrierScoreCI","CstatCI","RSqCI", "ReadSPSS", "Downloads"
86+
"BrierScoreCI","CstatCI","RSqCI", "ReadSPSS", "Downloads",
87+
"mbinom","mpois","mgeom","mnbinom","mhyper","mnorm","mexp",
88+
"mgamma","mlnorm","mbeta","mchisq","mt","mf"
8789
)
8890

8991

92+
9093
importFrom("stats", ".nknots.smspl", "IQR", "acf", "addmargins", "anova", "aov", "approx", "as.dist", "as.formula", "binom.test", "chisq.test", "complete.cases", "contr.helmert", "contr.poly", "contr.sum", "contr.treatment", "contrasts", "convolve", "cor", "cov", "cycle", "dbinom", "density", "drop1", "end", "filter", "fisher.test", "formula", "frequency", "friedman.test", "ftable", "integrate", "is.ts", "kruskal.test", "lm", "lm.fit", "loess", "mad", "mantelhaen.test", "mcnemar.test", "model.extract", "model.frame", "model.matrix", "model.response", "model.tables", "na.omit", "na.pass", "optim", "optimise", "optimize", "p.adjust", "pbeta", "pbinom", "pchisq", "pf", "plot.ts", "pnorm", "poisson.test", "ppoints", "ppois", "prcomp", "predict", "pt", "ptukey", "qbeta", "qbinom", "qchisq", "qf", "qnorm", "qt", "qtukey", "quantile", "rnorm", "runif", "sd", "setNames", "smooth", "splinefun", "start", "symnum", "t.test", "terms", "time", "ts",
9194
"uniroot", "var", "weighted.mean", "weights", "wilcox.test", "xtabs", "as.dendrogram", "dist", "hclust", "order.dendrogram", "smooth.spline","var.test",
9295
"median", "reorder","AIC", "BIC", "confint", "deviance", "df", "logLik","lm.wfit","profile",
@@ -116,6 +119,7 @@ importFrom("Exact","exact.test")
116119
importFrom("withr", "with_seed")
117120

118121
importFrom("readxl","read_excel")
122+
importFrom("readr", "read_table")
119123
importFrom("haven", "read_spss")
120124
importFrom("httr","GET","write_disk", "http_status")
121125
importFrom("cli", "col_red","col_silver","style_bold","col_blue","col_cyan","cli_alert_info")

‎NEWS‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11

22

33

4-
DescTools 0.99.60 (2025-03-30)
4+
DescTools 0.99.60 (2025-03-28)
55
------------------------------
66

77
NEW FUNCTIONS ADDED:
8-
* Downloads() helperfunction to fast acces downloaded XL- or data files.
8+
* Downloads() helperfunction for a fast access to downloaded
9+
XL- or data files.
10+
* Moment functions for the most common distributions.
911

1012
UPDATED FUNCTIONS:
1113
* FisherZ() and FisherZInv() use atanh(), resp. tanh() now.
@@ -17,9 +19,6 @@ UPDATED FUNCTIONS:
1719
* Small improvement in Outlier() for method "hampel"
1820
(Credits to Luis Gustavo Schuck).
1921

20-
BUGFIXES:
21-
* ...
22-
2322

2423

2524

‎R/DescTools.r‎

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15743,7 +15743,7 @@ CourseData <- function(name, url=NULL, header=TRUE, sep=";", ...){
1574315743
if(FileExistURL(gettextf("%s/%s",url,name))){
1574415744
# do nothing, url and name are both correct
1574515745
}else {
15746-
stop(gettextf("File %s does not exist!"))
15746+
stop(gettextf("File %s/%s does not exist!",url,name))
1574715747
}
1574815748
}
1574915749
}else {
@@ -15753,7 +15753,7 @@ CourseData <- function(name, url=NULL, header=TRUE, sep=";", ...){
1575315753

1575415754

1575515755
if(grepl("xls",tools::file_ext(name))) {
15756-
res<- OpenDataObject(name=name,url=url,...)
15756+
res<- OpenDataObject(name=name,url=url,doc=NA,...)
1575715757

1575815758
}else {
1575915759
res<- read.table(file= gettextf("%s/%s",url,name),
@@ -15803,20 +15803,24 @@ OpenDataObject <- function(name, url=NULL, doc=NULL, ...){
1580315803

1580415804
# Define factors
1580515805
id<- which(code[[col_scale]]%in% c("nominal","ordinal"))
15806-
codes<- lapply(strsplit(code[[col_code]][id],"\\r\\n"),strsplit,split="=")
15807-
names(codes)<-code[[col_var]][id]
1580815806

15809-
for(xincode[[col_var]][id]){
15810-
z[,x]<-factor(z[,x],
15811-
ordered= (code[[col_scale]][code[[col_var]]==x])=="ordinal")
15807+
if(length(id)>0){
15808+
codes<-lapply(strsplit(code[[col_code]][id],"\\r\\n"),strsplit,split="=")
15809+
names(codes)<-code[[col_var]][id]
1581215810

15813-
# could also not be defined, e.g. patient id (nominal, but no codes)
15814-
if(!identical(codes[[x]],NA)){
15815-
levels(z[,x])<- StrTrim(sapply(codes[[x]],"[",2))[
15816-
match(levels(z[,x]), StrTrim(sapply(codes[[x]],"[",1)))]
15811+
for(xincode[[col_var]][id]){
15812+
z[,x]<-factor(z[,x],
15813+
ordered= (code[[col_scale]][code[[col_var]]==x])=="ordinal")
15814+
15815+
# could also not be defined, e.g. patient id (nominal, but no codes)
15816+
# codes is character after the strsplit procedure... (!)
15817+
if(!identical(unlist(codes[[x]]),NA_character_)){
15818+
levels(z[,x])<- StrTrim(sapply(codes[[x]],"[",2))[
15819+
match(levels(z[,x]), StrTrim(sapply(codes[[x]],"[",1)))]
15820+
}
1581715821
}
1581815822
}
15819-
15823+
1582015824
# Labels:
1582115825
for(xincode[[col_var]])
1582215826
Label(z[,x])<- na.omit(code[[col_lbl]][code[[col_var]]==x])
@@ -15828,6 +15832,31 @@ OpenDataObject <- function(name, url=NULL, doc=NULL, ...){
1582815832
}
1582915833

1583015834

15835+
DataDescription<-function(fn,sheet="Description"){
15836+
15837+
# get a data description for datafiles in excel
15838+
15839+
# try to use doc if at least one more sheet exists
15840+
if("Description"%in%readxl::excel_sheets(fn)& length(readxl::excel_sheets(fn))>1) {
15841+
d.desc<- as.data.frame(read_excel(fn,sheet=sheet))
15842+
# use only currentrange("A1"), say: clip on the first completely empty row
15843+
d.desc<-d.desc[1:(min(which(apply(d.desc,1,
15844+
function(x) sum(is.na(x))== ncol(d.desc))))-1),]
15845+
15846+
codelist<-list()
15847+
for(iin nrow(tab<-d.desc[!is.na(d.desc$Codes), ])){
15848+
codelist[[tab$Variable]]<- strsplit(tab$Codes,"\\r\\n")[[1]]
15849+
}
15850+
15851+
}
15852+
15853+
return(list(desctable=d.desc,codes=codelist))
15854+
15855+
}
15856+
15857+
15858+
15859+
1583115860

1583215861

1583315862
as.statafactor<-function(x){

‎R/Downloads.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param fname the filename, if no extension specified the first file found
99
#' will be used.
1010
#' @param \dots are passed on to the open functions
11-
#' \code{\link[readxl]{readxl}}() or \code{\link[readr]{read.table}()}.
11+
#' \code{\link[readxl]{readxl}}() or \code{\link[readr]{read_table}()}.
1212
#' @return the file
1313
#' @author Andri Signorell <andri@@signorell.net>
1414
#' @examples
@@ -50,7 +50,7 @@ Downloads <- function(fname, ...){
5050
res<- as.data.frame(readxl::read_excel(paste(downloads_path,fname,sep="/"),...))
5151

5252
}else {
53-
res<-read.table(file= gettextf("%s/%s",downloads_path,fname),...)
53+
res<-readr::read_table(file= gettextf("%s/%s",downloads_path,fname),...)
5454
}
5555

5656
}else {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp