-
Notifications
You must be signed in to change notification settings - Fork 4
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
Final #27
Comments
That link does not work for me (it's local on your machine, not a public URL). What are the errors? I just tried the template, and it works for me. I suspect you need to install the packages used in the document? |
I did check to make sure all of the packages are loaded and they are. |
You might try creating a new folder in "My Documents" and name it anything ("dashboard"). Save the file there and try running. R shiny creates a virtual server on your computer to host the shiny app, so it requires a few tools to play nicely with your local operating system. I suspect it's a package issue, likely something with pandocs, htmltools, rmarkdown, knitr, or flexdashboard. Trying to diagnose now. |
I am getting the same error as @jmacost5 even after making sure file is saved and all the packages are up to date. I even tried running code one line at a time, it does not give any error then. |
Can you both tell me your session info: sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1
|
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsconnect_0.8.15 knitr_1.24 DT_0.9 shiny_1.3.2
[5] viridis_0.5.1 viridisLite_0.3.0 leaflet_2.0.2 ggmap_3.0.0
[9] forcats_0.4.0 stringr_1.4.0 purrr_0.3.2 readr_1.3.1
[13] tidyr_1.0.0 tibble_2.1.3 ggplot2_3.2.1 tidyverse_1.2.1
[17] flexdashboard_0.5.1.1 pander_0.6.3 dplyr_0.8.3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 lubridate_1.7.4 lattice_0.20-38 png_0.1-7
[5] assertthat_0.2.1 zeallot_0.1.0 digest_0.6.20 mime_0.7
[9] R6_2.4.0 cellranger_1.1.0 plyr_1.8.4 backports_1.1.4
[13] evaluate_0.14 httr_1.4.1 pillar_1.4.2 RgoogleMaps_1.4.4
[17] rlang_0.4.0 lazyeval_0.2.2 readxl_1.3.1 rstudioapi_0.10
[21] rmarkdown_1.15 htmlwidgets_1.3 munsell_0.5.0 broom_0.5.2
[25] compiler_3.6.1 httpuv_1.5.2 modelr_0.1.5 xfun_0.9
[29] pkgconfig_2.0.2 htmltools_0.3.6 tidyselect_0.2.5 gridExtra_2.3
[33] crayon_1.3.4 withr_2.1.2 later_0.8.0 bitops_1.0-6
[37] grid_3.6.1 nlme_3.1-140 jsonlite_1.6 xtable_1.8-4
[41] gtable_0.3.0 lifecycle_0.1.0 magrittr_1.5 scales_1.0.0
[45] cli_1.1.0 stringi_1.4.3 promises_1.0.1 xml2_1.2.2
[49] generics_0.0.2 vctrs_0.2.0 rjson_0.2.20 tools_3.6.1
[53] glue_1.3.1 hms_0.5.1 crosstalk_1.0.0 jpeg_0.1-8
[57] yaml_2.2.0 colorspace_1.4-1 rvest_0.3.4 haven_2.1.1 |
Ok, I think I have got it. If you are using the newest R version, 3.6.1, you need to re-install R shiny. You can try the traditional version That did not work for me. I had to install the developer package from R Studio (which will be the most up-to-date code): install.packages("devtools")
devtools::install_github("rstudio/shiny") When you begin the install R will tell you that newer versions are available for a few packages, but they require compilation. It asks for your preference. I selected 1 for ALL. It took some time to update all of the code (because it compiles the packages directly on your machine), but that seemed to do the trick. That should be the only step you need (it was the step that made a different on my machine after upgrading to R 3.6.1). I also updated knitr and rmarkdown along the way, so if the step above does not fix the issue then you can also try these: install.packages('knitr', repos = c('https://xran.yihui.name', 'https://cran.r-project.org'))
devtools::install_github('rstudio/rmarkdown') |
@sunaynagoel @jmacost5 Can you please try that step and update us on whether it fixed the issue? |
@lecy I tried both the step mentioned above. It made no difference. Here is my sessionInfo() after running the steps. sessionInfo () Matrix products: default locale: attached base packages: loaded via a namespace (and not attached): |
If you open base R (not R Studio) and select packages --> update packages then select a mirror, which packages are listed? |
Try in R Studio then under Tools --> Check for package update. If shiny will not load with |
So I need to put these packages in my base R and not my R studio. |
@jmacost5 they are all the same packages, it's just easier to install them in base R sometimes because R Studio will automatically load some packages it needs, thus making it harder to update them. Once they have installed in the basic R console they will be available in R Studio as well. |
@lecy I tried a few things
When I run the my .rmd file it does not give any errors, but it generates a file which opens up in new window (which is what it is supposed to do). Instead of showing widgets it shows only HTML type of codes in red. I am not sure what am I doing wrong? |
I do not think it worked because I am still getting the same message.R version 3.6.1 (2019-07-05) Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
@jmacost5 I am on the same boat as well. It did not work for me either. I hope we can figure it out sooner and then later so we can work on actual Lab. Good luck. The following object is masked from ‘package:shiny’:
|
@jmacost5 do you also have a Mac? It should not be a conflict with shiny and rsconnect, though you can comment out packages to see if it works then. Can you also re-install leaflet? The package conflict I had was leaflet and shiny. We might have to schedule a Zoom call tomorrow to diagnose. |
ok, I will reinstall the package. Also I do have a Mac and if office hours are still the same I can meet at that time tomorrow. I am also getting an error when I re booted R studio that I did not get before. |
Hi Professor Lecy, can you please activate the link to submit the final assignment? Only the Code Through Tutorial is showing on Canvas. Thank you. |
@lecy - I pointed out 3 problems so far, when I run the document
Attaching package: ‘pander’ The following object is masked from ‘package:shiny’:
Attaching package: ‘DT’ The following objects are masked from ‘package:shiny’:
|
@jrcook15 the link should be working now |
@sunaynagoel masking is not be a problem. That just means that two packages have a function of the same name, so one has been set as the default when they are called. The other package is called "rsconnect" not "rconnect". See if |
Hello all,
in RStudio, but it didn't make any changes. I am now trying to install in base R, but I'm getting the following error:
I am not sure how to proceed. Thanks! |
Here's my systemInfo():
|
Thanks to @sunaynagoel for helping me find this issue. I had downloaded the data dictionary from Tempe's open data site, and they managed to embed some special characters in their Excel file. Can you find it?
So that was breaking the HTML code for some people and not others. It's an easy fix, just replace the embedded data dictionary chunks with this one chunk that reads in a clean version of the data dictionary: URL.dd <- "https://raw.githubusercontent.com/DS4PS/cpp-526-fall-2019/master/labs/final-project/TempeTrafficAccidentsDataDictionary.csv"
data.dictionary <- read.csv( URL.dd, stringsAsFactors=F )
data.dictionary %>%
select( column, description ) %>%
pander( ) I've updated the template. Let me know if you are having other issues getting the template to work! |
@lecy I re-downloaded the template, but it still had the old url. I tried to just replace the data in the code, but I'm getting this error:
I tried to run the following code with dat instead of data.dictionary:
and I got this error:
|
I re-downloaded the template again and this time it worked! I'm still curious how I would've gotten the CSV file to work though, if you have any suggestions. Thanks! |
The only output I'm getting is <shiny.render.function> |
For some reason d2 is not being found when I run my program completely |
Hello all,
I've currently made a sidebar note to indicate that this simply means there's no data, but I'm curious if there is a way to stop this error. Here is my code: Input:
Output:
For example, if I select dust storm and female, my Youth and Senior categories produce the error message above. |
I am doing just the alcohol consumption. Does this make sense for out code? Drivers 2 {data-orientation=rows}Sidebar {.sidebar}Driver Characteristics
RowNumber of Crashes
Total Injuries
Total Fatalities
Rate of Harm
ColumnDriver 1
Driver 2
|
@RickyDuran Are you trying to publish through shinyapp.io or through R Studio Connect? Connect is a different service that we currently don't have configured. I would need to know more about what steps you followed to get that window to diagnose. |
@lecy, after reading through some of the thread that was hidden, I noticed you had said to redownload the template. I did so, and it seems to have fixed the issue. |
@castower It would require conditional statements (control structures in computer speak) that we have not learned yet. I can send some code if you want to try it out. if( condition is met)
{ do the thing }
if( condition is not met )
{ print something else } |
Can you be more specific? Do you want feedback on the design or on something not working? What are you trying to show with that tab? |
@lecy That would be great. If it helps, basically what I'm trying to accomplish is: If there's one more crashes then the chart displays. If not, then there's a blank chart OR maybe a message that says 'No data available' instead of the odd error message that would be hard for someone unfamiliar with R to understand. I can re-send my .rmd file if needed. Thanks! |
When trying to deploy the app, I get the message: ERROR: An error has occurred. Check your logs or contact the app author for clarification. It is showing up in the viewer, in R, but not in Shinyapps. |
I am getting an error when I put it into the shinny document. I just do not understand how to make it better Here is the code I have currently:Driver Characteristics {data-orientation=rows}Sidebar {.sidebar}Driver Characteristics
RowNumber of Crashes
Total Injuries
Total Fatalities
Rate of Harm
OutputsTraffic Accidents by Driver Characteristics
|
I am attempting to make a plot showing different degrees of injury severity over time. The sidebar with the inputs is working but the output area is blank. I think it's because the date is a character variable that can be graphed but I'm not sure. I tired converting it to numeric but it just made everything "NA". Here is my input:
and the current draft of my output:
|
Hi, I am having an issue with my dropdown widgets connecting to the map. I am able to select the different options, but the crashes are not showing up on the leaflet. Here is my code: `
|
@jmacost5 It is the same issue you were having before: #27 (comment) You name your widget driver.1.age: sliderInput("driver.1.age", label = h4("Driver 1 Age"),
min = 15, max = 100, value = c(18,36) ) But then in the renderValueBoxes section you are referencing a widget named d1age. d2 <-
dat %>%
filter( Age_Drv1 >= input$d1age[1] & Age_Drv1 <= input$d1age[2],
... You will always reference the user input at input$widget_name where widget_name is whatever name you give it. If you use different names the render function will not be able to find the user inputs. Should be: sliderInput( "driver.1.age", label = h4("Driver 1 Age"),
min = 15, max = 100, value = c(18,36) ) d2 <-
dat %>%
filter( Age_Drv1 >= input$driver.1.age[1] & Age_Drv1 <= input$driver.1.age[2],
... |
@etbartell You are missing a date separator here in the min argument: dateRangeInput( "date_range", label = h3("Date Range"),
start = "01/01/2017", end = "12/31/2017",
min = "01/012012", max = "12/31/2017",
format = "mm/dd/yyyy", startview = "month", language = "en", separator = " to ") You might double-check the variable type returned by the date widget. I suspect it is a character vector, and you might have to convert it to a date object before using in a date comparison. https://shiny.rstudio.com/gallery/widget-gallery.html It can be tricky because a date compared to text will still evaluate, it just casts both as text: widget.dates <- c("01/01/2017","12/31/2017")
widget.dates.1 <- strptime( widget.dates, format="%m/%d/%Y" )
class( widget.dates.1 )
widget.dates.2 <- format( widget.dates.1, format="%D" )
class( widget.dates.2 )
widget.dates.1
[1] "2017-01-01 MST" "2017-12-31 MST"
widget.dates.1 > "06/01/2017" # comparison to text
[1] TRUE TRUE
widget.dates.1 > strptime( "06/01/2017", format="%m/%d/%Y" )# comparison to date
[1] FALSE TRUE |
@meliapetersen I am not sure if this is the problem, but you have an extra comma in your filter statement: d2 <-
dat %>%
filter( d1.substance %in% input$d1.substance,
d2.substance %in% input$d2.substance,
) Should be: d2 <-
dat %>%
filter( d1.substance %in% input$d1.substance,
d2.substance %in% input$d2.substance ) |
@lecy I took out the comma and it still isn't running the data to the widget. |
@meliapetersen Do any of your widgets on separate tabs have identical names? |
@lecy No, I don't think so. I renamed the two widgets "Driver 1 Substance Use" and "Driver 2 Substance Use". Is that what you're referring to? |
@meliapetersen I meant the inputId: selectInput( inputId="d1.substance",
label = h4("Driver 1 Substance Use"),
choices = c("Alcohol", "Drugs",
"No Apparent Use", "Unknown"),
selected = c("No Apparent Use")) |
@lecy No, this is the first time that I've used d1.substance and d2.substance in a widget. This is the first tab that I am working on and the only place that I mention it outside of its naming in the mutate function at the top of the doc (line 61 of the template). |
I figured it had something to do with the class of the variable, but was unsure how to change it to something that could be read numerically. Here is my altered output code:
It's now giving me the error message: "no applicable method for 'filter_' applied to an object of class "c('POSIXlt', 'POSIXt')"" |
@meliapetersen I don't see something obvious. Can you send me your RMD by email? |
@etbartell You mangled your data recipe. You have an assignment operator in the middle, and you are use $ references. Try something like: d4 <-
dat %>%
mutate( MDY = strptime( DateTime, format="%m/%d/%Y" ) ) %>%
filter( Injuryseverity %in% input$injuries,
MDY >= input$date_range[1] & MDY <= input$date_range[2] ) %>%
count( MDY, Injuryseverity ) %>%
group_by( MDY ) %>%
mutate( total.injury = n) But your main problem is you are still comparing MDY (a date object) to input$date_range (a character vector). So before your data recipe try something like: date.range <- strptime( input$date_range, format="%X/%X/%X" ) # not sure the format here Then your filter comparisons would be: MDY >= date.range[1] |
@etbartell OK, looking back at how you created the dates. Note the difference between MDY and input$date_range formats: "01/01/2017" # widget dates
"01/01/17" # MDY after format( date.vec, "%D" ) And the appropriate time conversion functions for each (upper versus lower-case Y): strptime( "01/01/2017", format="%m/%d/%Y" )
strptime( "01/01/17", format="%m/%d/%y" ) |
Yeah I changed the date format and It's still telling me it's the wrong class:
"Column Then when I tried putting "as.POSIXct()" before the dates it just returned a blank page. I don't get why it's not working on mine when I'm using the same steps from the tutorials. |
@etbartell I think this might work (change Y to y in MDY reformat and take the dat$ out of the first mutate): date.range <- strptime( input$date_range, format="%m/%d/%Y")
d4 <-
dat %>%
mutate( MDY = strptime( DateTime, format="%m/%d/%y" ) )%>%
filter( Injuryseverity %in% input$injuries,
MDY >= date.range[1] & MDY <= date.range[2] ) %>%
count( MDY, Injuryseverity ) %>%
group_by( MDY ) %>%
mutate( total.injury = n) |
@etbartell One more potential issue - should your last date.range <- strptime( input$date_range, format="%m/%d/%Y")
d4 <-
dat %>%
...
mutate( total.injury = sum(n) ) d4$MDY here is not numeric. Does that work in a plot function? Should points be plot()? plot( d4$MDY, d4$total.injury,
col = "dodgerblue4", pch=19, type = "l", cex = 2,
xlab="Date",
ylab="Injury Count",
main="Tempe Accident Injury Trends" ) If you started with this variable, it might be easier to plot since it's numbers 1 to 365. Otherwise you could convert m4$MDY to this format before plotting?
|
I was running the document to see what it looks like to get an idea of the tabs and it is giving me an error.
http://127.0.0.1:5011/final-project-dashboard-template.rmd
The text was updated successfully, but these errors were encountered: