# course-emiii-accompany **Repository Path**: kevinhhp/course-emiii-accompany ## Basic Information - **Project Name**: course-emiii-accompany - **Description**: project accompany for Phd course "Advanced Econometrics" at Northwest A&F University - **Primary Language**: HTML - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-14 - **Last Updated**: 2025-04-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Readme ## Step 1/3:Prepare Software You need install two software (Both can download from ): - `R` is an open source (FREE) programming language. - `Rstudio` (Also FREE) is an IDE (Integrated Development Environment) which will help you coding more efficiently. > [!NOTE] > > ### Posit Cloud online project > > You can also access the Posit online R project at > . > > - You need subscribe to Posit Cloud to access the online project > (recomend use your github account to subscribe). > - The online project is host by Posit Cloud. > - You can use the online project to do some programming exercises and > make class examples reproducible. > - ALL needed enviroment and packages have been pre-installed in the > online project. > [!TIP] > > ### NEW IDE > > VS code is a new IDE, which is more popular. here are some useful IDEs > based on VS code: > > - [Positron](https://positron.posit.co/). It is a new IDE developed by > Posit, the company behind RStudio. > > - [Cursor](https://www.cursor.com/). It is a new IDE that integrates > AI into the IDE. ## Step 2/3:Following Course Project I create a course project of “Econometrics III Accompany”, with which students in my ” Advanced Econometrics” class can do some programming exercises and make class examples reproducible. > [!NOTE] > > - This project is under building and will iterate regularly. > > - I create a project > repository() > and host it at publicly. > > - For those students in china, you can also access the synchronous > repository (). There are two ways to get these project files into you PC/Laptop: - (Recommended) You can download the **“.zip”** file by click “Download” button after you click the URL show before. - Use tools like `gitbash` to **clone** or **fork** the whole project. Finally, the project directory structure will be shows as bellow: D:/github/course-emiii-accompany ├── course-emiii-accompany.Rproj ├── index.qmd ├── IV-wage-card │ ├── card1995.dta │ └── code-card-hansen.R ├── IV-wage-mroz │ ├── code-mroz.R │ ├── mroz-var-label.txt │ ├── workingpaper.qmd │ └── workingpaper_files ├── menu │ ├── iv-wage-card.qmd │ ├── iv-wage-mroz.qmd │ ├── project-prepare.qmd │ └── sem-wage-mroz.qmd ├── pic │ └── logo ├── R │ ├── helper-tidy-systemfit.R │ └── load-pkg-basic.R ├── README.qmd ├── README.rmarkdown ├── renv │ ├── activate.R │ ├── library │ └── staging ├── renv.lock ├── scss │ ├── styles.css │ └── _variables.scss ├── sem-wage-mroz │ └── code-sem-mroz.R ├── _freeze │ ├── index │ ├── IV-wage-mroz │ ├── menu │ └── site_libs ├── _quarto.yml └── _site ├── index.html ├── IV-wage-mroz ├── menu ├── pic ├── README.qmd ├── scss ├── search.json └── site_libs ## Step 3/3:Install R packages R is a function-based object-oriented programming language. When executing R code commands, various R packages are often used to achieve specific programming goals. After you have downloaded the project file to your local computer (Step 2/3), you can open the project with Rstudio (Step 1/3), then open ‘R/load-pkg-basic.R’(see below) to see the relevant R packages needed for this project and install them.
**R/load-pkg-basic.R** ``` r # load necessary R packages # system library(rmarkdown) library(renv) # package management library(yaml) # quarto project library(fs) # file system management library(here) # relative path # basic pkgs library(tidyverse) # most useful library(magrittr) # pipe %>% library(knitr) # R render engine # read file library(openxlsx) # for excel file library(foreign) # for stata file # viz library(ggplot2) # graph library(DT) # DT table library(scales) # tidy numbers library(webshot2) # snapshot library(htmlwidgets) # interactivity #library(fontawesome) # github repo #renv::install("KWB-R/kwb.utils") #renv::install("huhuaping/xmerit") # developed by `Huhuaping` #library(xmerit) # export Latex equation ```
> [!TIP] > > To put it simply, R packages come from a few main sources: > > - The base package by the R core team > > - R packages developed by the R community (widely published on github > and other hosting platforms) > > - Other source of R packages How to install these R packages? Solution 1 (**Not recommend**): use `install.packages("foo")` to install all packages one by one. Solution 2 (**Strongly recommend**) : use `renv` package management tool chain! - Open the course project with `Rstudio` (double click `course-emiii-accompany.Rproj`). Then you can write and run R command in panel `Console` below the software window. - First, write and run R command `install.packages("renv")` - Then, write and run R command `library(renv)` - Finally, write and run R command `renv::active()` and `renv::restore()`