Closed WillemSleegers closed 6 years ago
It seems to gather descriptives one time too often?
library(devtools)
# install_github("WillemSleegers/tidystats")
library(tidystats)
library(tidyverse)
iris.descriptives <- list()
descriptives(iris, Sepal.Length, Species) ->
Species.descriptives
Species.descriptives %>%
tidy_descriptives() %>%
add_descriptives(list = iris.descriptives,
identifier = "Species") ->
iris.descriptives
iris.descriptives %>%
.$Species %>%
filter(var == "Sepal.Length") %>%
filter(group == "versicolor")
Yup, because you don't need to do tidy_descriptives()
. add_descriptives()
calls that function, so it's more of an 'under the hood' function.
Closing this issue because I have completely redesigned the way creating and adding descriptives works.
Lekker bezig!
Op 21 sep. 2017 01:43 schreef "WillemSleegers" notifications@github.com:
Closing this issue because I have completely redesigned the way creating and adding descriptives works.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WillemSleegers/tidystats/issues/42#issuecomment-331010963, or mute the thread https://github.com/notifications/unsubscribe-auth/AXRtR-V5LJvPvbvlTvHemyU9e_69rlrsks5skaMBgaJpZM4O8nRG .
Check out the new README: https://github.com/WillemSleegers/tidystats https://github.com/WillemSleegers/tidystats
On 21 Sep 2017, at 19:09, Paul van der Laken notifications@github.com wrote:
Lekker bezig!
Op 21 sep. 2017 01:43 schreef "WillemSleegers" notifications@github.com:
Closing this issue because I have completely redesigned the way creating and adding descriptives works.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WillemSleegers/tidystats/issues/42#issuecomment-331010963, or mute the thread https://github.com/notifications/unsubscribe-auth/AXRtR-V5LJvPvbvlTvHemyU9e_69rlrsks5skaMBgaJpZM4O8nRG .
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/WillemSleegers/tidystats/issues/42#issuecomment-331221167, or mute the thread https://github.com/notifications/unsubscribe-auth/AEMb2p-qF-FQUGpLTJPpD3rBEk3W00Oaks5skphggaJpZM4O8nRG.
I have added several functions to deal with descriptives, rather than statistical models.
You can now use the function
descriptives()
for continuous data, andfrequencies()
for count data. You may turn the output of these functions into a tidy data frame usingtidy_descriptives()
, which is done for you when you add the output to a list usingadd_descriptives()
.Note that I have switched the arguments in
add_descriptives()
, it first expects the output, then the data frame to add it to.It would be nice if some people could help me test these functions out and let me know what you think of it.
UPDATE:
I changed a few things. First,
descriptives()
has been renamed todescribe()
. This masks the same function for thepsych
package, but meh, describe is a better name.Second, I got rid of
frequencies()
by combining it with thedescribe()
function.describe()
now checks what kind of variable is being supplied and depending on that it either provides statistics suitable for numeric variables (e.g., mean, sd, etc.) or frequency statistics (e.g., n, percentages).Now, there are some issues though. I'll provide some examples below using the
mpg
data set.1 numeric variable, no groups:
Code:
describe(mpg, cyl
:Output:
1 numeric variable, 1 group:
Code:
describe(mpg, cty, year)
Output:
1 numeric variable, 2 groups:
Code:
describe(mpg, cty, year, cyl)
Output:
Some questions I have:
by
column andgroup
column. This makes tidying it easier, but I should probably write this function without having the tidying in mind and simply make it a good describe function, irrespective of how we can tidy it later. Because the function is part of the tidystats package, we will always be able to tidy it (since we know how it is structured). What do you think?