\introduction  %% \introduction[modified heading if necessary]
Many studies have emphasized the importance of examining and characterizing the release of atmospheric pollutants \citep[among others]{parrish2009clean, anenberg2017impacts}. It is essential to have knowledge about pollutant sources. This makes it possible for decision-makers to take action and introduce strategies to reduce emissions from sources that have the most impact on health and the environment \citep{Siebenhuner2002411, Siebenhuner2002421,yang2015characterization,yu2009research,davis2005part}. In order to accomplish this, decision-makers need reliable information from emissions inventories \citep{perez2015traffic}. Vehicular emissions inventories have significant importance in urban areas and developing suitable models can be a great challenge, particularly in developing countries. In these countries, it is difficult to access data related to vehicular fleet emissions \citep{nogueira2015road}. 
	

	An emissions inventory is an important tool in air quality management. Inventory results can be used for regulatory purposes, air quality simulation, health studies, cost analysis and environmental planning. However, emissions inventories are usually seen as a scapegoat when simulations do not match observation \citep{pulles2010art}. Therefore, the use of emissions inventories for any purpose must be carefully evaluated. Own estimations should be done for specific applications, with complete transparency regarding the methods and required input data.

	There are several models and tools available for the estimation of vehicular emissions inventories at street level. Some of them include COPERT Street Level \cite{csl}, Motor Vehicle Emission Simulator MOVES \cite{koupal2003design}, Emissions Factors EMFAC\cite{emfac}, MOBILE \cite{mobile}, ARTEMIS \cite{andre2004artemis}, HBEFA \citep{hausberger2009emission}, MEET \citep{hickman1999meet}, or the International Vehicle Emissions model  IVE\cite{davis2005part}.% There are also models designed for air quality modelling, such as TEMMS \citep{Namdeo2002177}. 

The choice of the model depends on the availability of data and resources for producing it. Some of these tools can be costly and data demanding. Most of them are not cross-platform and are usable only in specific systems, such as Windows or Mac. Furthermore, none of these programs are open source and users cannot  modify the code according to their specifics. The accuracy of the results is not always related to the complexity of the model. A meta-analysis of several studies on vehicular emissions \citeauthor{smit2010validation} concluded that there is no evidence that the more complex models perform better than the less complex ones, which is critical for modelling in developing countries.

Other studies use traffic simulations data as an input. A study \cite{corvalan1} showed a vehicular emissions model based on a traffic simulation for Santiago. They used vehicle categories by type, fuel and emission standard for Santiago, Chile. \citeauthor{huo} presented an instantaneous emissions model using a traffic simulation as an input for Beijing, China. Both methods covered only hot stabilized emissions.

Vehicular emissions inventories can be elaborated with either a top-down or a bottom-up approach \cite{copert}. Top-down emissions inventories are based on regional statistics of fleet and average speed. These methods are straightforward, low-cost and can be quickly performed. However, the main disadvantage is the lack of representativeness for the dynamic of traffic conditions and the misrepresentation for the hot-spot of emissions at particular regions. On the other hand, the bottom-up approach consists of recordings of traffic and speed by street. 

One of the main characteristics of VEIN is that it includes vehicle classification by type, size, weight, age of use and emissions standard, allowing a detailed characterization of the fleet following a bottom-up approach. VEIN also allows versatility to estimate emissions with different emission factors from Copert \citep{copert}; local emission factors (not dependent of speed functions); a scaled factor as a merge between Copert and local; and even the option to include the user's own emissions speed functions. The outputs are databases with emissions by hour and/or by street. VEIN includes methods to allocate the street emissions in grids of any resolution and it also includes functions to export gridded emissions into WRF-Chem \citep{grell2005fully} input files, using the emissions preprocessor or another Assimilation System 4 WRF (AAS4WRF) \citep{Angel2015}.

	This paper describes the VEIN package, an open source R package for estimating bottom-up vehicular emissions. The method follows the approach shown in literature \cite{corvalan1} to estimate vehicular emissions with newer characteristics. In this study, we expand that approach to include more vehicular categories by adding the age of use of vehicle. We also added several options of emission factors and specification of pollutants. For example, it uses an extract of a traffic simulation for the Metropolitan Region of São Paulo located at the western area of the city. Input traffic data can be sourced from traffic simulations or other network-based sources. 
    
    VEIN was developed as a package within the free open source R language \citep{R}, and for that reason it is cross-platform. This  paper describes the emission methods implemented in the model, and how these methods were implemented as R functions. We estimated the vehicular emissions of a traffic simulation of a western area of the city of São Paulo, Brazil as example case. The example case covers preparation of the network, vehicular data and activity data, emissions of estimation and generation of informative databases and maps. Each section provides examples and chunks of code to help the reader become more familiarized with the functions.