Coder Social home page Coder Social logo

cgpfunctions's People

Contributors

ibecav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cgpfunctions's Issues

CGPfunctions

Thank you for making CPGfunctions available.

I found it very useful.
I have 2 questions:

  1. How can I increase the axis font size in Plot2wayANOVA?
    2.Can the error bar be changed to standard deviation or standard error (presently the error bar uses the lower and upper confidence level)?

Complete cases in chaid_table

Hi, chaid_table.R has been really helpful, but when creating node_table, only filtering complete cases may result in 0 frequencies for the outcome levels (if each case has at least one missing value across the independent variables). Those 0 frequencies will later cause the chisq.test to raise an error because x must be positive.
I've removed both filter(complete.cases(.)) %>% and it works just fine to me.
Also noticed that you did tidyr::pivot_wider in row 76 but not in row 87.

Chang linetype based on a grouping factor

If I print the interaction plot in back and white, I am unable to differentiate the groups because the lines are solid for the entire group. That also applies for the points. I want to be able to vary the linetype to match one of the factors. For example, If I have a factor with two levels, I want to use solid line for level 1 and broken lines for level 2.

The method to evaluate if dataframe exists only checks if it exists in Global Environment.

In newggslopegraph.R :

If the dataframe is sent to newggslopegraph() in a local function, then the evaluation Ndataframe <- deparse(substitute(dataframe)) doesn't return the name of the dataframe as intended, but the structure of the dataframe.

Then, when testing with exists(Ndataframe), it always fails and returns FALSE, giving you the error "The first object in your list does not exist. It should be a dataframe"

A (dirty) workaround : creating a dataframe with the same name from the global environment.

Delete lines between data.lable and y.text?

Hi all,

Thank you for developing such an interesting package.

My question is I would like to know if it is possible to delete those lines between data labels and Y text. I also had some problems setting up LineColor.

Here is my data:
Screenshot 2022-04-05 at 21 16 25

My script:

newggslopegraph(dataframe = df,
                Times = Group,
                Measurement = Value,
                Grouping = GeneID,
                Title = "Artesunate",
                Caption = NULL,
                SubTitle = NULL,
                DataTextSize = 0,
                Data.label = NULL,
                YTextSize = 0,
                DataLabelPadding = 0,
                DataLabelLineSize = 0,
                DataLabelFillColor = "white",
                WiderLabels = F,
                ThemeChoice = "wsj",
                LineColor = col
)

My error:

Error: Continuous value supplied to discrete scale

My problem:
Screenshot 2022-04-05 at 21 04 47

Any advice will be highly appreciated! Thanks!

Kind regards,
Birong

cran install fails on R 4.0.5

Hello,

R tells me CGPFunctions is not available for my version of R. I am running it in Ubuntu 20.04. The development version installs, but only after I install the pwr package first manually.

Is there a way to reverse the y-axis?

If you use this for rank order than the first rank will be at the bottom. Given the functions requirements you can not use a categorical y axis factored variable to change the text label/order of the slopes.

Code breaking with upcoming ggplot2 3.3.1 release

Hello,

this is a heads up that your code is breaking with the upcoming ggplot2 3.3.1 release (tidyverse/ggplot2#3871 (comment)). This is due to changes in stat_function() that now make it more sensitive to certain bad programming patterns, such as feeding in data via the aes() function.

The code at issue is code such as the following:

CGPfunctions/R/seedist.R

Lines 262 to 271 in 62efdb6

p <- ggplot() +
aes(x) +
geom_density(fill = data.fill.color, ) +
stat_function(fun = dnorm,
color = zcurve.color,
linetype = zcurve.type,
size = zcurve.size,
args = list(mean = x_mean,
sd = x_sd)
) +

You can generally fix the issue by feeding in the data via the data argument rather than via aes():

library(ggplot2)
x <- rnorm(100)

# bad
ggplot() +
  aes(x) +
  geom_density(color = "blue") +
  stat_function(fun = dnorm)
#> Error: Aesthetics must be either length 1 or the same as the data (1): x

# good
ggplot(data.frame(x)) +
  aes(x) +
  geom_density(color = "blue") +
  stat_function(fun = dnorm)

Created on 2020-05-25 by the reprex package (v0.3.0)

If you encounter any problems fixing these issues, I'm happy to help.

formatting numbers in newggslopegraph

First, thanks for creating newggslope graph, it looks great.

How do I control the number format of the Measurement?
For example, what if I want the graph to display "X %", or if I want integers displayed with a thousands separator?

R package CGP functions library load error

library(CGPfunctions)
Error: package or namespace load failed for ‘CGPfunctions’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘MatrixModels’

Need this package to access a few functions. What is the solution to this

Grouping error: double observation on y-axis

Hello,

my data is as such:
image

I am trying to plot the change of ranking overtime from 2000s to 2010s.
image

However, the genre observations overlap on both y-axis. Take for example, Fantasy genre which was ranked 5th on 2000s, is now ranked 3th in 2010s. However, Fantasy genre showed respectively on rank 3th and 5th in 2000s.
image

How do I resolve this? Thank you.

Is there a way to change the Label Color?

I can change the newggslopegraph data point color using DataTextColor, but there doesn't seem to be a corresponding way to change the label color. Am I missing something?

newggslopegraph: line color based on change over time/slope?

Is there a way to color the lines (LineColor) based on the slope or change over time? For example, positive increase the line=green and for negative change the line=red? It would be the equivalent to your cancer dataset example where you used: LineColor = c("red", rep("gray",4), "red", rep("gray",3)). Thanks very much.

Save plot2WayANOVA as an object

Is there a way to save the plot output from the function Plot2WayANOVA as a ggplot object (not a png or pdf) so that further modifications can be made using ggplot tools and the panels for multiple different plots could be compiled into a multipanel figure?

Collision of numerical labels on slope graphs

First I'd like to thank-you for such a fantastic implementation of slope graphs.

This is less a bug and more a refinement.

On the example attached we're getting numerical labels colliding on each axis. Given the distribution of our data this happens on most plots.

You've obviously been able to avoid the category labels colliding. Is there something that can be done on these numerical labels?

slopegraphGroup.pdf

Deprecation of sjstats::anova_stats()

Hi,
I'm maintaining the sjstats package, of which you're using the anova_stats() function in your package. I'm writing you because in the long run, this functions is going to be deprecated first, and then removed at some point in the future.

The reason is that we have started a new project, easystats, where we build new packages from scratch that are focused on particular tasks. In the course of this development, we also refactored some existing packages and re-implemented functions in the easystats ecosystem. The information retrieved by anova_stats() is now available in packages like effectsize or parameters, and these functions are more robust, reliable and consistent.

Thus, could you please update your package and replace anova_stats()? It looks like parameters::model_parameters() gives you all the information you need, including effect sizes for anova tables. It's just that parameters::model_parameters() returns different column names than anova_stats(), so you would have to fix that.

library(CGPfunctions)
library(parameters)
library(sjstats)

mtcars$cyl <- factor(mtcars$cyl)
mtcars$am <- factor(mtcars$am)
mod <- aov(hp ~ cyl * am, data = mtcars)
a <- aovtype2(mod)

anova_stats(a)
#> term      |     sumsq |    meansq | df | statistic | p.value | etasq | partial.etasq | omegasq | partial.omegasq | epsilonsq | cohens.f | power
#> -----------------------------------------------------------------------------------------------------------------------------------------------
#> cyl       | 1.027e+05 | 51364.469 |  2 |    60.164 |  < .001 | 0.711 |         0.822 |   0.695 |           0.787 |     0.699 |    2.151 | 1.000
#> am        |  7317.893 |  7317.893 |  1 |     8.572 |   0.007 | 0.051 |         0.248 |   0.044 |           0.191 |     0.045 |    0.574 | 0.833
#> cyl:am    | 12181.313 |  6090.656 |  2 |     7.134 |   0.003 | 0.084 |         0.354 |   0.072 |           0.277 |     0.073 |    0.741 | 0.930
#> Residuals | 22197.125 |   853.736 | 26 |           |         |       |               |         |                 |           |          |

model_parameters(a, eta_squared = "partial", ci = .9)
#> Parameter | Sum_Squares | df | Mean_Square |     F |      p | Eta2 (partial) |  Eta2 90% CI
#> -------------------------------------------------------------------------------------------
#> cyl       |    1.03e+05 |  2 |    51364.47 | 60.16 | < .001 |           0.82 | [0.70, 0.88]
#> am        |     7317.89 |  1 |     7317.89 |  8.57 | 0.007  |           0.25 | [0.05, 0.46]
#> cyl:am    |    12181.31 |  2 |     6090.66 |  7.13 | 0.003  |           0.35 | [0.10, 0.54]
#> Residuals |    22197.13 | 26 |      853.74 |       |        |                |

model_parameters(a, eta_squared = "raw", ci = .9)
#> Parameter | Sum_Squares | df | Mean_Square |     F |      p | Eta2 |  Eta2 90% CI
#> ---------------------------------------------------------------------------------
#> cyl       |    1.03e+05 |  2 |    51364.47 | 60.16 | < .001 | 0.71 | [0.53, 0.80]
#> am        |     7317.89 |  1 |     7317.89 |  8.57 | 0.007  | 0.05 | [0.00, 0.24]
#> cyl:am    |    12181.31 |  2 |     6090.66 |  7.13 | 0.003  | 0.08 | [0.00, 0.25]
#> Residuals |    22197.13 | 26 |      853.74 |       |        |      |

Created on 2021-01-08 by the reprex package (v0.3.0)

There is no pressure at the moment, as the way to deprecating and removing anova_stats() will take several weeks from now on, I just wanted to point out to this change timely.

Daniel

Compatibility with Pipes (%>%)

I'm sorry if this has been asked before, but I couldn't find a clear answer.
When I pipe my data frame to the Plot2WayANOVA function, it returns the following error: That dataframe does not exist
I've been using the same pipe sequence to feed data to ggplot and the lm functions, so there don't seem to be any errors
Is this by design or am I missing something here?

Min reproducible example:

iris %>% 
    Plot2WayANOVA(formula = Sepal.Length ~ Sepal.Width * Species, 
                  dataframe = .,
                  plottype = "line")

Also results in:

Error in Plot2WayANOVA(formula = Sepal.Length ~ Sepal.Width * Species,  : 
  That dataframe does not exist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.