title: Subset ERA-interim serie with a shapefile in R
body: <p>I am learning to use ERA-interim in my work. I need to analyze a two-year series for a meteorological station that is a point in shapefile format and also visualize the data for a basin.
  So far I have read the netcdf file and declared variables</p>
  
  <pre><code>rm(list=ls())
  graphics.off()
  library(raster)
  library(ncdf4)
  library(maps)
  library(maptools)
  library(rgdal)
  library(tidyverse)
  library(reticulate)
  library(ggthemes)
  library(viridis)
  
  setwd("C:/Users/TPPC/Desktop")
  rutas &lt;- list.files(path=getwd())
  ncin&lt;-nc_open("interim_2t_20152016.nc")
  
  lat=ncvar_get(ncin,'latitude')
  lon=ncvar_get(ncin,'longitude')
  t&lt;- ncvar_get(ncin, "time")
  
  tunits&lt;-ncatt_get(ncin,'time')
  tunits$units
  tustr&lt;- strsplit(tunits$units, " ")
  timestamp = as.POSIXct(t*3600,tz='GMT',origin=tustr[[1]][3])
  
  data&lt;-data_frame(name=attributes(ncin$var)$names) %&gt;%
    bind_cols(map_df(.$name,ncatt_get,nc=ncin)) %&gt;%
    mutate(values=map(name,ncvar_get,nc=ncin))
  nc_close(ncin)
  data
  
  df&lt;-expand.grid(lon=lon-360,lat=lat,timestamp=timestamp,name=data$name) %&gt;%
    mutate(coord=factor(paste(lon,lat,'/')))
  </code></pre>
  
  <p>*But in this last line I get the next error 
  Error: cannot allocate vector of size 645.2 Mb</p>