Introduction to Computational Social Science

Additional Information and Problem Solving



Further Material

As promised we will collect some further material for those of you who want to deepen their knowledge of R.


R online course “Data Science for Social Scientists”

Created by a psychologist who included his own lecture videos which are very helpful. Geared mostly towards statistical analysis but has a very good section on data cleaning and data manipulation, some web scraping and machine learning, NLP (Natural Language Processing) and API usage. This course is super usefull when you are starting your own project in R.


Free test month at Data Camp

Here you can find an introduction to R course, and several courses that build on that. This is very usefully if you want to get more fluent at “speaking” R and want to practice with exercises.

YouTube will help you on the question what to do after your initial test month expired.




Problems when downloading libraries


Sometimes, installing packages with the install.packages function does not seem to work. In those cases you can try to:

1. Check your code

The first thing to check is whether you spelled the function correctly. It’s a common mistake to forget the s at the end of packages or the quotation marks around the package “name”. install.packages(“name”), it’s a common mistake to forget the s or the quotation marks “”).

install.packages(“name”)


2. Specify the repository

If this was not the problem, it could be that R struggles to find the specific “mirror” from which it is supposed to download the package. In that case, try specifiying the repository:

install.packages(“ggplot2”, repos=‘http://cran.r-project.org’)
#telling R to search the CRAN master site at TU Wien, Austria


3. Trust issues

Next, try changing the configuration in R Studio: Go To Tools -> Global option -> Packages. Then un-check the option “Use secure download method for HTTP”


4. Google your error message

Obvious one, but chances are high that someone out there encountered the same problem.


5. Update your R

See next section.



Updating R



How to update R in R Studio using installr package


Paste the following code into the console and run the commands. The updateR() command performs the following: finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation. More info can be found here!

# Updating R within R Studio
install.packages(“installr”)
library(installr)
updateR()
## Watch for small pop up windows. There will be many questions and they don’t always pop to the front.