title: Error in eval(expr, envir, enclos) : object 'X' not found
body: <p>Hello  I have the following code</p>
  
  <pre><code>train=jsonlite::fromJSON("/home/felipe/Templates/Archivo de prueba/databritanica.json")
  
  map&lt;-get_map(location="united kingdom"  ,zoom=12,source="osm")
  
  p &lt;- ggmap(map) +
    geom_point(data=train, aes(x=X, y=Y, color=factor(LSOA_name)), alpha=0.05) +
    guides(colour = guide_legend(override.aes = list(alpha=1.0, size=6.0),
                                 title="Type of Crime")) +
    scale_colour_brewer(type="qual",palette="Paired") + 
    ggtitle("Top Crimes in Britain") +
    theme_light(base_size=20) +
    theme(axis.line=element_blank(),
          axis.text.x=element_blank(),
          axis.text.y=element_blank(),
          axis.ticks=element_blank(),
          axis.title.x=element_blank(),
          axis.title.y=element_blank())
  ggsave("united kingdom_top_crimes_map.png", p, width=14, height=10, units="in")
  </code></pre>
  
  <p>The main goal of the script is to take the data from the JSON file and mapping over the map I obtain with get_map.</p>
  
  <p>Executing this code give me this error:</p>
  
  <blockquote>
    <p>Error in eval(expr, envir, enclos) : object 'X' not found</p>
  </blockquote>
  
  <p>The data contain in the JSON file have the following format:</p>
  
  <pre><code>[
      {"Month":"2014-05",
       "Longitude":-2.747770,
       "Latitude":53.389499,
       "Location":"On or near Cronton Road",
       "LSOA_name":"Halton 001B",
       "Crime_type":"Other theft"},
  
      {"Month":"2014-05",
       "Longitude":-2.799099,
       "Latitude":53.354676,
       "Location":"On or near Old Higher Road",
       "LSOA_name":"Halton 008B",
       "Crime_type":"Anti-social behaviour"},
  
      Thousands of lines more
  
  ]
  </code></pre>
  
  <p>What I am missing here?  what can be the problem?</p>
  
  <p>UPDATE</p>
  
  <p>this is the output after applying str(train) like the user pascal said:</p>
  
  <pre><code>str(train)
  'data.frame':   10632 obs. of  6 variables:
   $ Month     : chr  "2014-05" "2014-05" "2014-05" "2014-05" ...
   $ Longitude : num  -2.75 -2.8 -2.8 -2.87 -2.87 ...
   $ Latitude  : num  53.4 53.4 53.4 53.5 53.5 ...
   $ Location  : chr  "On or near Cronton Road" "On or near Old Higher Road" "On or near Higher Road" "On or near Sanderling Road" ...
   $ LSOA_name : chr  "Halton 001B" "Halton 008B" "Halton 008B" "Knowsley 001A" ...
   $ Crime_type: chr  "Other theft" "Anti-social behaviour" "Anti-social behaviour" "Anti-social behaviour" ...
  </code></pre>
  
  <p>Now, this is another output  after applying dput(head(train)) like the user 42 said</p>
  
  <pre><code>&gt; dput(head(train))
  structure(
     list(
      Month = c("2014-05", "2014-05", "2014-05", "2014-05", 
                "2014-05", "2014-05"),
      Longitude = c(-2.74777, -2.799099, -2.804451, 
                   -2.873557, -2.871609, -2.871841),
      Latitude = c(53.389499, 53.354676, 
                   53.352456, 53.485957, 53.489432, 53.489745),
      Location = c("On or near Cronton Road", 
                   "On or near Old Higher Road", "On or near Higher Road",               "On or near Sanderling Road", 
                   "On or near Watts Close", "On or near Gilescroft Avenue"), 
      LSOA_name = c("Halton 001B", 
                    "Halton 008B", "Halton 008B", "Knowsley 001A",                "Knowsley 001A", 
                     "Knowsley 001A"), 
     Crime_type = c("Other theft", "Anti-social behaviour", 
                    "Anti-social behaviour", "Anti-social behaviour",
                    "Anti-social behaviour", 
                    "Anti-social behaviour")), 
     .Names = c("Month", "Longitude", "Latitude", 
                "Location", "LSOA_name", "Crime_type"),
      row.names = c(NA, 6L), class = "data.frame")
  </code></pre>
  
  <p>Here the outputs of of the variable "train"</p>