Hi Rui I have tried the same but this is not working.
when I do head(us_counties), I clearly see this is a date,in R studio console head(us_counties) date deaths Todays_deaths county state fips 1: 2020-03-19 0 0 Abbeville South Carolina 45001 2: 2020-03-20 0 0 Abbeville South Carolina 45001 3: 2020-03-21 0 0 Abbeville South Carolina 45001 4: 2020-03-22 0 0 Abbeville South Carolina 45001 5: 2020-03-23 0 0 Abbeville South Carolina 45001 6: 2020-03-24 0 0 Abbeville South Carolina 45001 cases Todays_cases But the moment this appears in shiny UI, this displays like date deaths Todays_deaths county state fips cases Todays_cases 18340.00 0.00 0.00 Abbeville South Carolina 45001 1.00 0.00 18341.00 0.00 0.00 Abbeville South Carolina 45001 1.00 0.00 Regards Gayathri On Wed, 3 Mar 2021 at 08:25, Rui Barradas <ruipbarra...@sapo.pt> wrote: > Hello, > > Your col_types argument is wrong, you only have col_date. > > > library(tidyverse) > > urlfile <- > " > https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv > " > #GN added 3/3 > cols_spec <- cols( > date = col_date(format = ""), > county = col_character(), > state = col_character(), > fips = col_character(), > cases = col_double(), > deaths = col_double() > ) > > us_counties <- read_csv(url(urlfile), col_types = cols_spec) > > > Hope this helps, > > Rui Barradas > > Às 15:24 de 03/03/21, Gayathri Nagarajan escreveu: > > Hi Team > > > > I have a tibble like the below : > > > > class(us_counties) > > [1] "tbl_df" "tbl" "data.frame" > > > > head(us_counties) > > # A tibble: 6 x 8 > > date deaths Todays_deaths county state fips > > <date> <dbl> <dbl> <chr> <chr> <chr> > > 1 2020-03-19 0 0 Abbev~ Sout~ 45001 > > 2 2020-03-20 0 0 Abbev~ Sout~ 45001 > > 3 2020-03-21 0 0 Abbev~ Sout~ 45001 > > 4 2020-03-22 0 0 Abbev~ Sout~ 45001 > > 5 2020-03-23 0 0 Abbev~ Sout~ 45001 > > 6 2020-03-24 0 0 Abbev~ Sout~ 45001 > > > > str(us_counties) > > tibble [1,082,715 x 8] (S3: tbl_df/tbl/data.frame) > > $ date : Date[1:1082715], format: "2020-03-19" ... > > $ deaths : num [1:1082715] 0 0 0 0 0 0 0 0 0 0 ... > > $ Todays_deaths: num [1:1082715] 0 0 0 0 0 0 0 0 0 0 ... > > $ county : chr [1:1082715] "Abbeville" "Abbeville" "Abbeville" > > "Abbeville" ... > > $ state : chr [1:1082715] "South Carolina" "South Carolina" > "South > > Carolina" "South Carolina" ... > > $ fips : chr [1:1082715] "45001" "45001" "45001" "45001" ... > > $ cases : num [1:1082715] 1 1 1 1 1 1 3 4 4 4 ... > > $ Todays_cases : num [1:1082715] 0 0 0 0 0 0 0 0 0 0 ... > > - attr(*, "spec")= > > .. cols( > > .. date = col_date(format = ""), > > .. county = col_character(), > > .. state = col_character(), > > .. fips = col_character(), > > .. cases = col_double(), > > .. deaths = col_double() > > .. ) > > - attr(*, ".internal.selfref")=<externalptr> > >> > > > > > > > > Now when I display this in shiny UI using a simple command: > > > > > > # Generate an HTML table view of the data ---- > > output$ttable <- renderTable({ > > head(us_counties > > , n = input$obs) > > }) > > > > > > I get a display like the below > > > > datedeathsTodays_deathscountystatefipscasesTodays_cases > > 18679.00 34.00 0.00 Abbeville South Carolina 45001 2184.00 0.00 > > 18680.00 34.00 0.00 Abbeville South Carolina 45001 2191.00 0.00 > > 18681.00 34.00 0.00 Abbeville South Carolina 45001 2192.00 0.00 > > > > This is the change I made > > > > old code > > ======== > > #x <- getURL(" > > > https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv > > ") > > #us_counties <- read.csv(text = x) > > # 855612 Rows , 6 columns class(us_counties) > > > > > > this stopped working, so I changed to below > > > > > > urlfile=" > > > https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv > > " > > #GN added 3/3 > > us_counties<-read_csv(url(urlfile),col_types = list(date = > col_date())) > > > > Please let me know how to correct this > > > > Regards > > Gayathri > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.