Questions tagged [desctools]

An R package: Tools for Descriptive Statistics.

A collection of miscellaneous basic statistic functions and convenience wrappers for efficiently describing data. The author's intention was to create a toolbox, which facilitates the (notoriously time consuming) first descriptive tasks in data analysis, consisting of calculating descriptive statistics, drawing graphical summaries and reporting the results.

Links:

  1. CRAN: DescTools

  2. Pdf

  3. RDocumentation

61 questions
28
votes
7 answers

Count leading zeros between the decimal point and first nonzero digit

Suppose if we have a number 1.000633, I want to count number of zeros after the decimal point until first nonzero digit in the fraction, the answer should be 3. For 0.002 the answer should be 2. There is no such function in R that could help. I have…
Annie
  • 681
  • 7
  • 14
15
votes
1 answer

How to create a grid of spatial points

library(reshape2) library(data.table) library(dplyr) library(magrittr) library(ggplot2) library(scales) library(gstat) library(DescTools) library(sp) #I want a colorado grid# data("colorado.grid") #making cordinates into spatial points…
Clinton Woods
  • 249
  • 1
  • 2
  • 11
5
votes
3 answers

Find the largest n unique values and their frequencies in R and Rcpp

I have a numeric vector v (with already omitted NAs) and want to get the nth largest values and their respective frequencies. I found http://gallery.rcpp.org/articles/top-elements-from-vectors-using-priority-queue/ to be quite fast. //…
Andri Signorell
  • 1,279
  • 12
  • 23
4
votes
5 answers

Mean and Confidence interval for Groups of Variable in R

I'm new to R and I'm attempting to do something that I believe should be very simple but code online has not helped. data <- structure(list(Group = c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3), Time = c(1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2), mean_PctPasses…
Patrick
  • 915
  • 2
  • 9
  • 26
3
votes
1 answer

Which winsorize is more accurate, Python or R

I am trying to implement a winsorization function but get confused by the exact definition of it. Obviously, the winsorize function in R package, DescTool, and the winsorize function in Python library, scipy.stats.mstats, yield different results. I…
Bob
  • 381
  • 4
  • 14
3
votes
2 answers

DescTools::XLGetRange() fails with sel$Cells() Error: attempt to apply non-function

I am running R version 3.5.0 I have installed the packages: install.packages("DescTools") install.packages("RDCOMClient", repos = "http://www.omegahat.net/R") I have run Excel and selected a range of values. Then I run this code in…
Herman Tan
  • 49
  • 2
3
votes
2 answers

Winsorizing across all columns in a data frame (R) using `lapply`

I am trying to apply the Winsorize() function using lapply from the library(DescTools) package. What I currently have is; data$col1 <- Winsorize(data$col1) Which essentially replaces the extreme values with a value based on quantiles, replacing the…
user113156
  • 6,761
  • 5
  • 35
  • 81
3
votes
2 answers

Label rotation in PlotCirc (DescTools package)

I am using the PlotCirc() function of the DescTools R package to visualize a contingency table: library(DescTools) tab <- matrix(c(2,5,8,3,10,12,5,7,15), nrow=3, byrow=FALSE) dimnames(tab) <- list(c("ABCDEFG","BCDEFGH","CDEFGHI"),…
user2030503
  • 3,064
  • 2
  • 36
  • 53
2
votes
5 answers

Most frequent factor across specific columns—with recency breaking ties

I need to create a column in a dataset that reports the most recent row-wise modal text value in a selection of columns (ignoring NAs). Background: I've a dataset where up to 4 coders rated participant transcripts (one participant/row). Occasionally…
Nick Byrd
  • 163
  • 1
  • 14
2
votes
2 answers

Amount of overlap of two ranges in R [DescTools?]

I need to know by how many integers two numeric ranges overlap. I tried using DescTools::Overlap, but the output is not what I expected. library(DescTools) library(tidyr) df1 <- data.frame(ID = c('a', 'b', 'c', 'd', 'e'), var1 =…
ntwkid
  • 21
  • 3
2
votes
1 answer

Building a table/dataframe/something exportable from Desc function output in R

I'm definitely a noob, though I have used R for various small tasks for several years. For the life of me, I cannot figure out how to get the results from the "Desc" function into something I can work with. When I save the x<-Desc(mydata) the…
J. Doe
  • 21
  • 4
2
votes
0 answers

Insert Hyperlink datatable column R

I want to link HTML in R, I have this main datatable, id mean 22 12 17 23 and I have HTML file with datatable with name are report_22 (report_id) and this table I have just information for id 22 When I click on id 22 in the firt…
Naï
  • 53
  • 6
2
votes
2 answers

function for counting discordant pairs is not working

I am trying to count the number of discordant pairs. For example: arg1=c("b","c","a","d") arg2 = c("b","c","d","a") There is 1 discordant pair in the above (the pair: "a" and "d") But when I…
nafrtiti
  • 176
  • 8
2
votes
1 answer

Intraclass Correlation Coefficient in R, how to deal with NAs and not much overlap between raters and subjects

I have been trying to perform an icc (Intraclass Correlation Coefficient ) test for the agreement between raters in a k x m matrix. Where k are rows (subjects of study) and m are the raters. It is a 70 x 70 matrix, but it comes from randomised…
user6542375
2
votes
1 answer

How to create new columns in data.frame based on letter AND number character objects in a column in R

I have a data frame with a column filled with data like so, on chromosome and then base position, all in one column. I filled in the remaining columns V2 through V5 with integers just to simulate a similar data.frame. > test V1 V2 V3 V4…
1
2 3 4 5