R Studio 4.0.2
Packages:
ggplot2 3.3.2  , purrr   0.3.4
tibble  3.0.4   dplyr   1.0.2
tidyr   1.1.2   stringr 1.4.0
readr   1.4.0   forcats 0.5.0
I am trying to combine two CSV files and getting A tibble 0 x 0 output. One of these files has 2070 rows and 21 cols, other file has 2014 rows and 33 cols. When I used the code below, regardless of the function, I have this output: A tibble: 0 x 0 output
Schools_safety1517 supposed to be the combination of the two CSV files(ss1516 & ss1517). These data have Infos about the maintenance of crime data for incidents that occur in New York City public schools. ss1516 & ss1617 have Infos like school address, school name, and school id in the systems. I am trying to combine these two CSV data and create new CSV data by using the code below. as an expected output, I am expecting a new CSV file that has values in these two CSV files(There is 43.491 value in ss1516 CSV file and 66.462 value in ss1617 CSV file. But when I implement this code, I have this output: A tibble: 0 x 0 output and 0 value.
How could I solve this and combine these two CSV files?
> school_safety1517 <- list.files(pattern = "ss1_.*csv")
> df_list <- lapply(school_safety1517,read_csv)
> df <- bind_rows(df_list)
> head(df)
# A tibble: 0 x 0
> df <- bind_cols(df_list)
> df
# A tibble: 0 x 0
> ss_1516 <- ss1516
> ss_1617 <- ss1617
> files <- list.files(pattern = "file_.csv")
> files <- list.files(pattern = "ss_1.*csv")
> df_list <- lapply(files,read_csv)
> df <- bind_rows(df_list)
> head(df)
# A tibble: 0 x 0
> df
# A tibble: 0 x 0
Edit : Here is the summary Infos about the data I'm working on: First 6 rows of ss1516:
# A tibble: 6 x 24
     ID `Building Code` DBN   `Location Name` `Location Code` Address Borough
  <dbl> <chr>           <chr> <chr>           <chr>           <chr>   <chr>  
1     1 K001            15K0~ P.S. 001 The B~ K001            309 47~ K      
2     2 K002            17K0~ Parkside Prepa~ K002            655 PA~ K      
3     3 K002            84K7~ EXPLORE CHARTE~ K704            655 PA~ K      
4     4 K002            75K1~ P.S. K141       K141            655 PA~ K      
5     5 K002            NA    655 PARKSIDE A~ NA              655 PA~ K      
6     6 K003            13K0~ P.S. 003 The B~ K003            50 JEF~ K      
# ... with 17 more variables: `Geographical District Code` <dbl>,
#   Register <chr>, `Building Name` <chr>, `# Schools` <dbl>, `Schools in
#   Building` <chr>, `Major N` <chr>, `Oth N` <chr>, `NoCrim N` <chr>, `Prop
#   N` <chr>, `Vio N` <chr>, ENGroupA <chr>, RangeA <chr>, `AvgOfMajor
#   N` <chr>, `AvgOfOth N` <chr>, `AvgOfNoCrim N` <chr>, `AvgOfProp N` <chr>,
#   `AvgOfVio N` <chr>
First 6 rows of ss1617:
> head(ss1617)
  School.Year                                      Location.Name Location.Code Borough
1   2016 - 17                    PASSAGES ACADEMY AT BELMONT(BN)          X695       K
2   2016 - 17                                          P.S. Q086          Q086       Q
3   2016 - 17                                P.S. 001 The Bergen          K001       K
4   2016 - 17                           P.S. 001 Alfred E. Smith          M001       M
5   2016 - 17                                           P.S. 035          M035       M
6   2016 - 17 The Urban Assembly School for Collaborative Health          K764       K
  Geographical.District.Code Register                            Building.Name X..Schools
1                          7      618                                                   1
2                         28      646                                                   1
3                         15     1334                                                   1
4                          2      533                                                   1
5                          2      833                                                   1
6                         19      215 999 JAMAICA AVENUE CONSOLIDATED LOCATION          5
  NYPD.Site.Code      NYPD.Site.Name
1            211             PS 077K
2            746             MS 074Q
3            198             PS 001K
4           1398      Sunset Park HS
5            663            JHS 056M
6            315 SAMUEL J. TILDEN HS
                                                                                                                                                                                                          Schools.in.Building
1                                                                                                                                                                                                    Brooklyn College Academy
2                                                                                                                                                                                                            P.S. 082 Hammond
3                                                                                                                                                                                                         P.S. 001 The Bergen
4                                                                                                                                                                                                                   P.S. Q256
5                                                                                                                                                                                                        James Weldon Johnson
6 Multicultural High School |Academy of Innovative Technology |Brooklyn Lab School |Cypress Hills Collegiate Preparatory School |The Urban Assembly School for Collaborative Health |999 JAMAICA AVENUE CONSOLIDATED LOCATION
  Major.N Oth.N NoCrim.N Prop.N Vio.N ENGroupA    RangeA AvgOfMajor.N AvgOfOth.N AvgOfNoCrim.N
1       0     0        1      0     0       4C   501-750         0.28       1.11          1.74
2       0     1        0      1     0       4C   501-750         0.28       1.11          1.74
3       0     0        1      0     0       7C 1251-1500         0.64       3.02          5.77
4       0     1        0      0     1       4C   501-750         0.28       1.11          1.74
5       0     1        3      0     1       5C  751-1000         0.38       1.71          2.38
6     N/A   N/A      N/A    N/A   N/A       2C     1-250          N/A        N/A           N/A
  AvgOfProp.N AvgOfVio.N                                         Geocode Postcode Latitude
1        0.75       0.53       560 BROOK AVENUE\n(40.815701, -73.914526)       NA       NA
2        0.75       0.53 87 41 PARSONS BOULEVARD\n(41.12133, -72.339742)    11432 40.70890
3        1.72       1.54          309 47 STREET\n(41.574857, -93.767342)       NA       NA
4        0.75       0.53         8 HENRY STREET\n(41.398617, -73.465855)       NA       NA
5        0.98       0.82   317 WEST 52ND STREET\n(41.799996, -87.633867)    10019 40.76387
6         N/A        N/A     999 JAMAICA AVENUE\n(27.783609, -80.501816)    11208 40.69115
  Longitude Community.Board Council.District Census.Tract     BIN        BBL
1        NA              NA               NA           NA      NA         NA
2 -73.80394               8               24          448 4438678 4097740001
3        NA              NA               NA           NA      NA         NA
4        NA              NA               NA           NA      NA         NA
5 -73.98594               4                3          133 1025241 1010430022
6 -73.86833               5               37         1180 3090738 3040940001
                                                                          NTA
1                                                                            
2 Briarwood-Jamaica Hills                                                    
3                                                                            
4                                                                            
5 Clinton                                                                    
6 park-cemetery-etc-Brooklyn 
Summary of ss1516:
> summary(ss1516)
       ID       Building Code          DBN            Location Name     
 Min.   :   1   Length:2070        Length:2070        Length:2070       
 1st Qu.: 518   Class :character   Class :character   Class :character  
 Median :1035   Mode  :character   Mode  :character   Mode  :character  
 Mean   :1035                                                           
 3rd Qu.:1552                                                           
 Max.   :2069                                                           
 NA's   :1                                                              
 Location Code        Address            Borough         
 Length:2070        Length:2070        Length:2070       
 Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character  
                                                         
                                                         
                                                         
                                                         
 Geographical District Code   Register         Building Name     
 Min.   : 0.00              Length:2070        Length:2070       
 1st Qu.: 8.00              Class :character   Class :character  
 Median :14.00              Mode  :character   Mode  :character  
 Mean   :15.37                                                   
 3rd Qu.:23.00                                                   
 Max.   :32.00                                                   
 NA's   :4                                                       
   # Schools     Schools in Building   Major N             Oth N          
 Min.   :1.000   Length:2070         Length:2070        Length:2070       
 1st Qu.:1.000   Class :character    Class :character   Class :character  
 Median :2.000   Mode  :character    Mode  :character   Mode  :character  
 Mean   :2.211                                                            
 3rd Qu.:3.000                                                            
 Max.   :8.000                                                            
 NA's   :1                                                                
   NoCrim N            Prop N             Vio N             ENGroupA        
 Length:2070        Length:2070        Length:2070        Length:2070       
 Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                            
                                                                            
                                                                            
                                                                            
    RangeA          AvgOfMajor N        AvgOfOth N        AvgOfNoCrim N     
 Length:2070        Length:2070        Length:2070        Length:2070       
 Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                            
                                                                            
                                                                            
                                                                            
 AvgOfProp N         AvgOfVio N       
 Length:2070        Length:2070       
 Class :character   Class :character  
 Mode  :character   Mode  :character 
Summary of ss1617:
> summary(ss1617)
 School.Year        Location.Name      Location.Code        Borough         
 Length:2046        Length:2046        Length:2046        Length:2046       
 Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                            
                                                                            
                                                                            
                                                                            
 Geographical.District.Code   Register         Building.Name        X..Schools   NYPD.Site.Code    
 Min.   : 0.00              Length:2046        Length:2046        Min.   :1.00   Length:2046       
 1st Qu.: 8.00              Class :character   Class :character   1st Qu.:1.00   Class :character  
 Median :14.00              Mode  :character   Mode  :character   Median :2.00   Mode  :character  
 Mean   :15.46                                                    Mean   :2.13                     
 3rd Qu.:24.00                                                    3rd Qu.:3.00                     
 Max.   :32.00                                                    Max.   :8.00                     
                                                                                                   
 NYPD.Site.Name     Schools.in.Building   Major.N             Oth.N             NoCrim.N        
 Length:2046        Length:2046         Length:2046        Length:2046        Length:2046       
 Class :character   Class :character    Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character    Mode  :character   Mode  :character   Mode  :character  
                                                                                                
                                                                                                
                                                                                                
                                                                                                
    Prop.N             Vio.N             ENGroupA            RangeA          AvgOfMajor.N      
 Length:2046        Length:2046        Length:2046        Length:2046        Length:2046       
 Class :character   Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                                               
                                                                                               
                                                                                               
                                                                                               
  AvgOfOth.N        AvgOfNoCrim.N      AvgOfProp.N         AvgOfVio.N          Geocode         
 Length:2046        Length:2046        Length:2046        Length:2046        Length:2046       
 Class :character   Class :character   Class :character   Class :character   Class :character  
 Mode  :character   Mode  :character   Mode  :character   Mode  :character   Mode  :character  
                                                                                               
                                                                                               
                                                                                               
                                                                                               
    Postcode        Latitude       Longitude      Community.Board  Council.District
 Min.   :10001   Min.   :40.51   Min.   :-74.24   Min.   : 1.000   Min.   : 1.00   
 1st Qu.:10451   1st Qu.:40.67   1st Qu.:-73.96   1st Qu.: 3.000   1st Qu.:12.00   
 Median :11102   Median :40.73   Median :-73.92   Median : 7.000   Median :23.00   
 Mean   :10788   Mean   :40.74   Mean   :-73.92   Mean   : 7.306   Mean   :24.31   
 3rd Qu.:11226   3rd Qu.:40.82   3rd Qu.:-73.88   3rd Qu.:11.000   3rd Qu.:37.00   
 Max.   :11694   Max.   :40.90   Max.   :-73.71   Max.   :18.000   Max.   :51.00   
 NA's   :26      NA's   :26      NA's   :26       NA's   :26       NA's   :26      
  Census.Tract           BIN               BBL                NTA           
 Min.   :     1.0   Min.   :1000003   Min.   :1.000e+09   Length:2046       
 1st Qu.:   155.0   1st Qu.:2005348   1st Qu.:2.027e+09   Class :character  
 Median :   312.5   Median :3042210   Median :3.014e+09   Mode  :character  
 Mean   :  7065.4   Mean   :2743071   Mean   :2.674e+09                     
 3rd Qu.:   896.0   3rd Qu.:3394175   3rd Qu.:3.082e+09                     
 Max.   :157903.0   Max.   :5158758   Max.   :5.079e+09                     
 NA's   :26         NA's   :30        NA's   :30 
Links for import the datasets: ss1516: https://data.cityofnewyork.us/api/views/44t3-dj6x/rows.csv?accessType=DOWNLOAD ss1617: https://data.cityofnewyork.us/api/views/rear-wh5i/rows.csv?accessType=DOWNLOAD
