Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message and incorrect plot for plotTemporalSymmetry when timescale = days is set in summariseTemporalSymmetry #261

Open
daniellenewby opened this issue Aug 14, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@daniellenewby
Copy link
Collaborator

I want to create a plot of the temporal sequence of my intersection of my index and markers.
I can create the correct plot using the following code:

temporal_symmetry <- summariseTemporalSymmetry(cohort = cdm$ache_inhibitors_memantine,
                                               timescale = "month")

plotTemporalSymmetry(result = temporal_symmetry,
                     xlim = c(-6, 6))

This creates the following plot:
image

This is what i would expect. However if i put the following code to have this in days:

temporal_symmetry <- summariseTemporalSymmetry(cohort = cdm$ache_inhibitors_memantine,
                                               timescale = "day")


plotTemporalSymmetry(result = temporal_symmetry,
                     labs = c("Time (days)", "Individuals (N)"),
                     xlim = c(-182, 182))

I get the following plot which is incorrect as its missing information on the LHS.

image

In the R studio console i get the following warning message:
"Warning messages:
1: position_stack() requires non-overlapping x intervals.
2: Removed 144 rows containing missing values or values outside the scale range (geom_col()).
3: Removed 144 rows containing missing values or values outside the scale range (geom_point())."

Ive checked the outputs from temporal_symmetry and these seem correct (i.e i have values from -182 to 182. Therefore i think this is a bug with the plotting function.

@daniellenewby daniellenewby added the bug Something isn't working label Aug 14, 2024
@daniellenewby
Copy link
Collaborator Author

This is using the CRAN version of the package

@daniellenewby
Copy link
Collaborator Author

@KimLopezGuell think this is your expertise :)

@KimLopezGuell
Copy link
Contributor

Hi Danielle! I do not know what data you used so I cannot reproduce your specific example. Before I dive more into this, after taking a look in my local, I wonder whether the issue might be minCellCount in summariseTemporalSymmetry()? Have you tried setting it to 0? Maybe you get many counts <5 which are then turned into NA and that is why you do not see anything in the plot.

@daniellenewby
Copy link
Collaborator Author

yep that works! Thank you :) @xihang-chen can we mention this in the vignette stating that min cell count in the function can impact the plot? or not have the min cell count in the function and users can suppress the counts afterwards running this function?

@KimLopezGuell
Copy link
Contributor

I think the idea would be to deprecate minCellCount and do all the suppressing when exporting the results (i.e in omopgenerics). Not sure about the plot function though. @catalamarti ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants