R in Jupyter

install conda environment via the src/install.bash script in this repo


In [1]:
library(dplyr)


Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


In [2]:
library(ggplot2)

In [3]:
head(economics)


Out[3]:
datepcepoppsavertuempmedunemploy
11967-06-30507.81987129.84.52944
21967-07-31510.91989119.84.72945
31967-08-31516.719911394.62958
41967-09-30513.31993119.84.93143
51967-10-31518.51994989.74.73066
61967-11-30526.21996579.44.83018

In [4]:
a <- ggplot(data = economics, aes(x = date, y = unemploy))
a <- a + geom_line()
a



In [5]:
a <- ggplot(data = economics, aes(x = date, y = unemploy))
a <- a + geom_line()
a <- a + geom_smooth(method = "loess")
a



In [6]:
df <- data.frame(birth_state=c("Illinois", "Arizona", NA),
                 data_scientist=c("Kevin", "Matt", "Jonathan"))

In [7]:
df


Out[7]:
birth_statedata_scientist
1IllinoisKevin
2ArizonaMatt
3NAJonathan

In [8]:
df$birth_state == "Arizona"


Out[8]:
  1. FALSE
  2. TRUE
  3. NA

In [9]:
just_Arizona <- df[df$birth_state=="Arizona",]

In [10]:
just_Arizona


Out[10]:
birth_statedata_scientist
2ArizonaMatt
NANANA

In [11]:
really_just_Arizona <- df[which(df$birth_state=="Arizona"),]

In [12]:
really_just_Arizona


Out[12]:
birth_statedata_scientist
2ArizonaMatt

In [13]:
a <- -5

In [14]:
a


Out[14]:
-5

In [15]:
a<-5

In [16]:
a


Out[16]:
5

In [ ]: