FIND DATA: By Journal | Sites   ANALYZE DATA: Help with R | SPSS | Stata | Excel   WHAT'S NEW? US Politics | IR | Law & Courts🎵
   FIND DATA: By Journal | Sites   WHAT'S NEW? US Politics | IR | Law & Courts🎵
WHAT'S NEW? US Politics | IR | Law & Courts🎵

Run R Code Example Online

# Explore contents of dataset and variable in dataset
#############################################################
library("poliscidata")
# You need to load the poliscidata package each time at the start of each session/script.
# You should also always set a working directory, but this demo script is running on a remote server.
#############################################################

# Commands to explore an object, such as the NES dataset
cat("Number of rows in NES dataset:\n")
nrow(nes)

cat("\n\nNumber of columns in NES dataset:\n")
ncol(nes)

cat("\n\nDimensions of the NES dataset:\n")
dim(nes)

# Look at info recorded in the first row of the NES dataset.
# These responses come from one of the people who participated in the NES survey.
# To make it easier to read, we can transpose the row into a column with the t() function.

cat("\n\nValues recorded in NES dataset, row 1:\n")
t(nes[1,])