R version 4.4.0 (2024-04-24 ucrt) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> CV_LatLon_21Jan_12Mar <- read.csv("C:/Users/katoj/Downloads/CV_LatLon_21Jan_12Mar.csv/CV_LatLon_21Jan_12Mar.csv")
>   View(CV_LatLon_21Jan_12Mar)
> View(CV_LatLon_21Jan_12Mar)
> View(CV_LatLon_21Jan_12Mar)
> install.packages("dplyr")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/katoj/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/dplyr_1.1.4.zip'
Content type 'application/zip' length 1582586 bytes (1.5 MB)
downloaded 1.5 MB

package ‘dplyr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\katoj\AppData\Local\Temp\RtmpcRfKni\downloaded_packages
> install.packages("lubridate")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/katoj/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/lubridate_1.9.3.zip'
Content type 'application/zip' length 986572 bytes (963 KB)
downloaded 963 KB

package ‘lubridate’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\katoj\AppData\Local\Temp\RtmpcRfKni\downloaded_packages
> install.packages("tidyr")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/katoj/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/tidyr_1.3.1.zip'
Content type 'application/zip' length 1266763 bytes (1.2 MB)
downloaded 1.2 MB

package ‘tidyr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\katoj\AppData\Local\Temp\RtmpcRfKni\downloaded_packages
> # Load necessary libraries
> library(dplyr)  # For data manipulation

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> library(lubridate)  # For date operations

Attaching package: ‘lubridate’

The following objects are masked from ‘package:base’:

    date, intersect, setdiff, union

> library(tidyr)  # For data cleaning
> 
> # Assuming your dataframe is named ‘data’, if not use read.csv or appropriate function to load it
> # data <- read.csv(“path_to_your_data.csv”)
> 
> # 1. Convert the date column to Date type
> datadate <- mdy(data
+                 date)
Error: unexpected symbol in:
"datadate <- mdy(data
                date"
> data <- read.csv(CV_LatLon_21Jan_12Mar)
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  'file' must be a character string or connection
> data <- CV_LatLon_21Jan_12Mar
> # Load necessary libraries
> library(dplyr)  # For data manipulation
> library(lubridate)  # For date operations
> library(tidyr)  # For data cleaning
> 
> # Assuming your dataframe is named ‘data’, if not use read.csv or appropriate function to load it
> # data <- read.csv(“path_to_your_data.csv”)
> 
> # 1. Convert the date column to Date type
> datadate <- mdy(data
+                 date)
Error: unexpected symbol in:
"datadate <- mdy(data
                date"
> # Load necessary libraries
> library(dplyr)
> library(sf)
Error in library(sf) : there is no package called ‘sf’
> install.packages("sf")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/katoj/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘wk’, ‘classInt’, ‘DBI’, ‘s2’, ‘units’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/wk_0.9.1.zip'
Content type 'application/zip' length 2043783 bytes (1.9 MB)
downloaded 1.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/classInt_0.4-10.zip'
Content type 'application/zip' length 505013 bytes (493 KB)
downloaded 493 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/DBI_1.2.2.zip'
Content type 'application/zip' length 934594 bytes (912 KB)
downloaded 912 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/s2_1.1.6.zip'
Content type 'application/zip' length 3494832 bytes (3.3 MB)
downloaded 3.3 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/units_0.8-5.zip'
Content type 'application/zip' length 784371 bytes (765 KB)
downloaded 765 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/sf_1.0-16.zip'
Content type 'application/zip' length 39897615 bytes (38.0 MB)
downloaded 38.0 MB

package ‘wk’ successfully unpacked and MD5 sums checked
package ‘classInt’ successfully unpacked and MD5 sums checked
package ‘DBI’ successfully unpacked and MD5 sums checked
package ‘s2’ successfully unpacked and MD5 sums checked
package ‘units’ successfully unpacked and MD5 sums checked
package ‘sf’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\katoj\AppData\Local\Temp\RtmpcRfKni\downloaded_packages
> # Load necessary libraries
> library(dplyr)
> library(sf)
Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
> library(ggplot2)
> 
> # Convert date string to Date object
> data$date <- as.Date(data$date, format = "%m/%d/%y")
> 
> # Handle missing values (if any)
> # For example, if you want to replace missing values with 0
> data[is.na(data)] <- 0
> 
> # Handle categorical variables (if any)
> # For example, if 'state' and 'country' are categorical variables
> data <- data %>%
+     mutate(state = as.factor(state),
+            country = as.factor(country))
> 
> # Remove outliers (if necessary)
> # For example, using z-score method
> # Assuming 'confirmed', 'recovered', and 'death' are numeric columns
> data <- data %>%
+     filter(abs(scale(confirmed)) < 3 & abs(scale(recovered)) < 3 & abs(scale(death)) < 3)
Warning message:
Using one column matrices in `filter()` was deprecated in dplyr 1.1.0.
ℹ Please use one dimensional logical vectors instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
generated. 
> 
> # Spatial aggregation (if necessary)
> # Aggregate data based on spatial units (e.g., country or state)
> # Assuming 'lat' and 'lon' are latitude and longitude coordinates
> # Convert data to sf object
> data_sf <- st_as_sf(data, coords = c("lon", "lat"), crs = 4326)
> 
> # Aggregate to country level
> data_agg_country <- st_aggregate(data_sf, by = "country")
Error in st_aggregate(data_sf, by = "country") : 
  could not find function "st_aggregate"
> data_agg_country <- st_aggregate(data_sf, by = "country")
Error in st_aggregate(data_sf, by = "country") : 
  could not find function "st_aggregate"
> # Load necessary libraries
> library(dplyr)
> library(sf)
> library(ggplot2)
> 
> # Assuming you have preprocessed data_agg_country from the previous steps
> 
> # Visualize the spatial distribution of confirmed cases
> ggplot() +
+     geom_sf(data = data_agg_country, aes(fill = confirmed)) +
+     scale_fill_gradient(name = "Confirmed Cases", low = "lightyellow", high = "darkred") +
+     labs(title = "Spatial Distribution of Confirmed COVID-19 Cases by Country") +
+     theme_minimal()
Error: object 'data_agg_country' not found
> # Load necessary libraries
> library(dplyr)
> library(sf)
> library(ggplot2)
> 
> # Convert date string to Date object
> data$date <- as.Date(data$date, format = "%m/%d/%y")
> 
> # Handle missing values (if any)
> # For example, if you want to replace missing values with 0
> data[is.na(data)] <- 0
> 
> # Handle categorical variables (if any)
> # For example, if 'state' and 'country' are categorical variables
> data <- data %>%
+     mutate(state = as.factor(state),
+            country = as.factor(country))
> 
> # Remove outliers (if necessary)
> # For example, using z-score method
> # Assuming 'confirmed', 'recovered', and 'death' are numeric columns
> data <- data %>%
+     filter(abs(scale(confirmed)) < 3 & abs(scale(recovered)) < 3 & abs(scale(death)) < 3)
> 
> # Spatial aggregation (if necessary)
> # Aggregate data based on spatial units (e.g., country or state)
> # Assuming 'lat' and 'lon' are latitude and longitude coordinates
> # Convert data to sf object
> data_sf <- st_as_sf(data, coords = c("lon", "lat"), crs = 4326)
> 
> # Aggregate to country level
> data_sf <- st_as_sf(data_agg_country, coords = c("lon", "lat"), crs = 4326)
Error: object 'data_agg_country' not found
> # Load necessary libraries
> library(dplyr)
> library(sf)
> library(ggplot2)
> 
> # Convert date string to Date object
> data$date <- as.Date(data$date, format = "%m/%d/%y")
> 
> # Handle missing values (if any)
> # For example, if you want to replace missing values with 0
> data[is.na(data)] <- 0
> 
> # Handle categorical variables (if any)
> # For example, if 'state' and 'country' are categorical variables
> data <- data %>%
+     mutate(state = as.factor(state),
+            country = as.factor(country))
> 
> # Remove outliers (if necessary)
> # For example, using z-score method
> # Assuming 'confirmed', 'recovered', and 'death' are numeric columns
> data <- data %>%
+     filter(abs(scale(confirmed)) < 3 & abs(scale(recovered)) < 3 & abs(scale(death)) < 3)
> 
> # Spatial aggregation (if necessary)
> # Aggregate data based on spatial units (e.g., country or state)
> # Assuming 'lat' and 'lon' are latitude and longitude coordinates
> # Convert data to sf object
> data_sf <- st_as_sf(data, coords = c("lon", "lat"), crs = 4326)
> 
> # Aggregate to country level
> data_agg_country <- data_sf %>%
+     st_set_geometry(NULL) %>%
+     group_by(country) %>%
+     summarise_all(sum)
Error in `summarise()`:
ℹ In argument: `state = .Primitive("sum")(state)`.
ℹ In group 1: `country = "Afghanistan"`.
Caused by error in `Summary.factor()`:
! ‘sum’ not meaningful for factors
Run `rlang::last_trace()` to see where the error occurred.
> 
> 
> 
> 
> 
> # Load the libraries
> library(dplyr)
> library(lubridate)
> 
> # Assuming ‘data’ is already loaded in your environment
> 
> # Check initial structure of the data
> str(data)
'data.frame':	19554 obs. of  9 variables:
 $ X        : int  0 1 2 3 4 5 6 7 8 9 ...
 $ state    : Factor w/ 298 levels "0","Adams, IN",..: 1 1 1 1 1 21 180 276 217 1 ...
 $ country  : Factor w/ 116 levels "Afghanistan",..: 108 59 99 77 68 23 7 7 7 21 ...
 $ lat      : num  15 36 1.28 28.17 2.5 ...
 $ lon      : num  101 138 103.8 84.2 112.5 ...
 $ date     : Date, format: "2020-01-22" "2020-01-22" ...
 $ confirmed: int  2 2 0 0 0 0 0 0 0 0 ...
 $ recovered: int  0 0 0 0 0 0 0 0 0 0 ...
 $ death    : int  0 0 0 0 0 0 0 0 0 0 ...
> 
> # Convert ‘date’ column to Date type
> data <- data %>%
+     mutate(date = mdy(date))
Warning message:
There was 1 warning in `mutate()`.
ℹ In argument: `date = mdy(date)`.
Caused by warning:
! All formats failed to parse. No formats found. 
> 
> # Handling missing values (if there are any NA values)
> # For demonstration, we’ll just print the rows with NA. Depending on analysis, you may choose to remove or impute them.
> na_rows <- data %>% filter(is.na(state) | is.na(country) | is.na(lat) | is.na(lon) | is.na(date) | is.na(confirmed) | is.na(recovered) | is.na(death))
> print(na_rows)
      X                 state                country      lat       lon date
1     0                     0               Thailand  15.0000  101.0000 <NA>
2     1                     0                  Japan  36.0000  138.0000 <NA>
3     2                     0              Singapore   1.2833  103.8333 <NA>
4     3                     0                  Nepal  28.1667   84.2500 <NA>
5     4                     0               Malaysia   2.5000  112.5000 <NA>
6     5      British Columbia                 Canada  49.2827 -123.1207 <NA>
7     6       New South Wales              Australia -33.8688  151.2093 <NA>
8     7              Victoria              Australia -37.8136  144.9631 <NA>
9     8            Queensland              Australia -28.0167  153.4000 <NA>
10    9                     0               Cambodia  11.5500  104.9167 <NA>
11   10                     0              Sri Lanka   7.0000   81.0000 <NA>
12   11                     0                Germany  51.0000    9.0000 <NA>
13   12                     0                Finland  64.0000   26.0000 <NA>
14   13                     0   United Arab Emirates  24.0000   54.0000 <NA>
15   14                     0            Philippines  13.0000  122.0000 <NA>
16   15                     0                  India  21.0000   78.0000 <NA>
17   16                     0                  Italy  43.0000   12.0000 <NA>
18   17                     0                 Sweden  63.0000   16.0000 <NA>
19   18                     0                  Spain  40.0000   -4.0000 <NA>
20   19       South Australia              Australia -34.9285  138.6007 <NA>
21   20                     0                Belgium  50.8333    4.0000 <NA>
22   21                     0                  Egypt  26.0000   30.0000 <NA>
23   22 From Diamond Princess              Australia  35.4437  139.6380 <NA>
24   23                     0                Lebanon  33.8547   35.8623 <NA>
25   24                     0                   Iraq  33.0000   44.0000 <NA>
26   25                     0                   Oman  21.0000   57.0000 <NA>
27   26                     0            Afghanistan  33.0000   65.0000 <NA>
28   27                     0                Bahrain  26.0275   50.5500 <NA>
29   28                     0                 Kuwait  29.5000   47.7500 <NA>
30   29                     0                Algeria  28.0339    1.6596 <NA>
31   30                     0                Croatia  45.1000   15.2000 <NA>
32   31                     0            Switzerland  46.8182    8.2275 <NA>
33   32                     0                Austria  47.5162   14.5501 <NA>
34   33                     0                 Israel  31.0000   35.0000 <NA>
35   34                     0               Pakistan  30.3753   69.3451 <NA>
36   35                     0                 Brazil -14.2350  -51.9253 <NA>
37   36                     0                Georgia  42.3154   43.3569 <NA>
38   37                     0                 Greece  39.0742   21.8243 <NA>
39   38                     0        North Macedonia  41.6086   21.7453 <NA>
40   39                     0                 Norway  60.4720    8.4689 <NA>
41   40                     0                Romania  45.9432   24.9668 <NA>
42   41                     0                Estonia  58.5953   25.0136 <NA>
43   42                     0            Netherlands  52.1326    5.2913 <NA>
44   43                     0             San Marino  43.9424   12.4578 <NA>
45   44                     0                Belarus  53.7098   27.9534 <NA>
46   45                     0                Iceland  64.9631  -19.0208 <NA>
47   46                     0              Lithuania  55.1694   23.8813 <NA>
48   47                     0                 Mexico  23.6345 -102.5528 <NA>
49   48                     0            New Zealand -40.9006  174.8860 <NA>
50   49                     0                Nigeria   9.0820    8.6753 <NA>
51   50     Western Australia              Australia -31.9505  115.8605 <NA>
52   51                     0                Ireland  53.1424   -7.6921 <NA>
53   52                     0             Luxembourg  49.8153    6.1296 <NA>
54   53                     0                 Monaco  43.7333    7.4167 <NA>
55   54                     0                  Qatar  25.3548   51.1839 <NA>
56   55                     0                Ecuador  -1.8312  -78.1834 <NA>
57   56                     0             Azerbaijan  40.1431   47.5769 <NA>
58   57                     0                Armenia  40.0691   45.0382 <NA>
59   58                     0     Dominican Republic  18.7357  -70.1627 <NA>
60   59                     0              Indonesia  -0.7893  113.9213 <NA>
61   60                     0               Portugal  39.3999   -8.2245 <NA>
62   61                     0                Andorra  42.5063    1.5218 <NA>
63   62              Tasmania              Australia -41.4545  145.9707 <NA>
64   63                     0                 Latvia  56.8796   24.6032 <NA>
65   64                     0                Morocco  31.7917   -7.0926 <NA>
66   65                     0           Saudi Arabia  24.0000   45.0000 <NA>
67   66                     0                Senegal  14.4974  -14.4524 <NA>
68   67                     0              Argentina -38.4161  -63.6167 <NA>
69   68                     0                  Chile -35.6751  -71.5430 <NA>
70   69                     0                 Jordan  31.2400   36.5100 <NA>
71   70                     0                Ukraine  48.3794   31.1656 <NA>
72   71                     0                Hungary  47.1625   19.5033 <NA>
73   72    Northern Territory              Australia -12.4634  130.8456 <NA>
74   73                     0          Liechtenstein  47.1400    9.5500 <NA>
75   74                     0                 Poland  51.9194   19.1451 <NA>
76   75                     0                Tunisia  34.0000    9.0000 <NA>
77   76                     0 Bosnia and Herzegovina  43.9159   17.6791 <NA>
78   77                     0               Slovenia  46.1512   14.9955 <NA>
79   78                     0           South Africa -30.5595   22.9375 <NA>
80   79                     0                 Bhutan  27.5142   90.4336 <NA>
81   80                     0               Cameroon   3.8480   11.5021 <NA>
82   81                     0               Colombia   4.5709  -74.2973 <NA>
83   82                     0             Costa Rica   9.7489  -83.7534 <NA>
84   83                     0                   Peru  -9.1900  -75.0152 <NA>
85   84                     0                 Serbia  44.0165   21.0059 <NA>
86   85                     0               Slovakia  48.6690   19.6990 <NA>
87   86                     0                   Togo   8.6195    0.8248 <NA>
88   87                     0          French Guiana   3.9339  -53.1258 <NA>
89   88                     0                  Malta  35.9375   14.3754 <NA>
90   89                     0             Martinique  14.6415  -61.0242 <NA>
91   90                     0               Bulgaria  42.7339   25.4858 <NA>
92   91                     0               Maldives   3.2028   73.2207 <NA>
93   92                     0             Bangladesh  23.6850   90.3563 <NA>
94   93                     0               Paraguay -23.4425  -58.4438 <NA>
95   94               Ontario                 Canada  51.2538  -85.3232 <NA>
96   95               Alberta                 Canada  53.9333 -116.5765 <NA>
97   96                Quebec                 Canada  52.9399  -73.5491 <NA>
98   97                     0                Albania  41.1533   20.1683 <NA>
99   98                     0                 Cyprus  35.1264   33.4299 <NA>
100  99                     0                 Brunei   4.5353  114.7277 <NA>
101 100            Washington                     US  47.4009 -121.4905 <NA>
102 101              New York                     US  42.1657  -74.9481 <NA>
103 102            California                     US  36.1162 -119.6816 <NA>
104 103         Massachusetts                     US  42.2302  -71.5301 <NA>
105 104      Diamond Princess                     US  35.4437  139.6380 <NA>
106 105        Grand Princess                     US  37.6489 -122.6655 <NA>
107 106               Georgia                     US  33.0406  -83.6431 <NA>
108 107              Colorado                     US  39.0598 -105.3111 <NA>
109 108               Florida                     US  27.7663  -81.6868 <NA>
110 109            New Jersey                     US  40.2989  -74.5210 <NA>
111 110                Oregon                     US  44.5720 -122.0709 <NA>
    confirmed recovered death
1           2         0     0
2           2         0     0
3           0         0     0
4           0         0     0
5           0         0     0
6           0         0     0
7           0         0     0
8           0         0     0
9           0         0     0
10          0         0     0
11          0         0     0
12          0         0     0
13          0         0     0
14          0         0     0
15          0         0     0
16          0         0     0
17          0         0     0
18          0         0     0
19          0         0     0
20          0         0     0
21          0         0     0
22          0         0     0
23          0         0     0
24          0         0     0
25          0         0     0
26          0         0     0
27          0         0     0
28          0         0     0
29          0         0     0
30          0         0     0
31          0         0     0
32          0         0     0
33          0         0     0
34          0         0     0
35          0         0     0
36          0         0     0
37          0         0     0
38          0         0     0
39          0         0     0
40          0         0     0
41          0         0     0
42          0         0     0
43          0         0     0
44          0         0     0
45          0         0     0
46          0         0     0
47          0         0     0
48          0         0     0
49          0         0     0
50          0         0     0
51          0         0     0
52          0         0     0
53          0         0     0
54          0         0     0
55          0         0     0
56          0         0     0
57          0         0     0
58          0         0     0
59          0         0     0
60          0         0     0
61          0         0     0
62          0         0     0
63          0         0     0
64          0         0     0
65          0         0     0
66          0         0     0
67          0         0     0
68          0         0     0
69          0         0     0
70          0         0     0
71          0         0     0
72          0         0     0
73          0         0     0
74          0         0     0
75          0         0     0
76          0         0     0
77          0         0     0
78          0         0     0
79          0         0     0
80          0         0     0
81          0         0     0
82          0         0     0
83          0         0     0
84          0         0     0
85          0         0     0
86          0         0     0
87          0         0     0
88          0         0     0
89          0         0     0
90          0         0     0
91          0         0     0
92          0         0     0
93          0         0     0
94          0         0     0
95          0         0     0
96          0         0     0
97          0         0     0
98          0         0     0
99          0         0     0
100         0         0     0
101         0         0     0
102         0         0     0
103         0         0     0
104         0         0     0
105         0         0     0
106         0         0     0
107         0         0     0
108         0         0     0
109         0         0     0
110         0         0     0
111         0         0     0
 [ reached 'max' / getOption("max.print") -- omitted 19443 rows ]
> 
> # Drop rows with NA values (optional, based on your decision)
> data <- data %>% drop_na()
> 
> # Convert ‘confirmed’, ‘recovered’, and ‘death’ columns to integer type (if they are not already)
> data <- data %>%
+     mutate(
+         confirmed = as.integer(confirmed),
+         recovered = as.integer(recovered),
+         death = as.integer(death)
+     )
> 
> # Verify the changes
> str(data)
'data.frame':	0 obs. of  9 variables:
 $ X        : int 
 $ state    : Factor w/ 298 levels "0","Adams, IN",..: 
 $ country  : Factor w/ 116 levels "Afghanistan",..: 
 $ lat      : num 
 $ lon      : num 
 $ date     : 'Date' num(0) 
 $ confirmed: int 
 $ recovered: int 
 $ death    : int 
> summary(data)
       X                      state          country       lat     
 Min.   : NA   0                 :0   Afghanistan:0   Min.   : NA  
 1st Qu.: NA   Adams, IN         :0   Albania    :0   1st Qu.: NA  
 Median : NA   Alachua, FL       :0   Algeria    :0   Median : NA  
 Mean   :NaN   Alameda County, CA:0   Andorra    :0   Mean   :NaN  
 3rd Qu.: NA   Alaska            :0   Argentina  :0   3rd Qu.: NA  
 Max.   : NA   Alberta           :0   Armenia    :0   Max.   : NA  
               (Other)           :0   (Other)    :0                
      lon           date       confirmed     recovered       death    
 Min.   : NA   Min.   :NA    Min.   : NA   Min.   : NA   Min.   : NA  
 1st Qu.: NA   1st Qu.:NA    1st Qu.: NA   1st Qu.: NA   1st Qu.: NA  
 Median : NA   Median :NA    Median : NA   Median : NA   Median : NA  
 Mean   :NaN   Mean   :NaN   Mean   :NaN   Mean   :NaN   Mean   :NaN  
 3rd Qu.: NA   3rd Qu.:NA    3rd Qu.: NA   3rd Qu.: NA   3rd Qu.: NA  
 Max.   : NA   Max.   :NA    Max.   : NA   Max.   : NA   Max.   : NA  
                                                                      
> 
> # You might want to remove the ‘state’ for rows containing only ‘0’ to make it clearer
> data <- data %>%
+     mutate(state = ifelse(state == “0”, NA, state))
Error: unexpected invalid token in:
"data <- data %>%
    mutate(state = ifelse(state == “"