RとRStudio入門


図の1

RStudioレイアウト

図の2

.R ファイルが開いてある状態のRStudio

Project Management With RStudio


図の1

Screenshot of file manager demonstrating bad project organisation

Seeking Help


Data Structures


Exploring Data Frames


Subsetting Data


図の1

Inequality testing

図の2

Inequality testing: results of recycling

Control Flow


Creating Publication-Quality Graphics with ggplot2


図の1

Blank plot, before adding any mapping aesthetics to ggplot().

図の2

Plotting area with axes for a scatter plot of life expectancy vs GDP, with no data points visible.

図の3

Scatter plot of life expectancy vs GDP per capita, now showing the data points.

図の4

Binned scatterplot of life expectancy versus year showing how life expectancy has increased over time
Binned scatterplot of life expectancy versus year showing how life expectancy has increased over time

図の5

Binned scatterplot of life expectancy vs year with color-coded continents showing value of 'aes' function
Binned scatterplot of life expectancy vs year with color-coded continents showing value of ‘aes’ function

図の6


図の7


図の8


図の9


図の10

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The plot illustrates the possibilities for styling visualisations in ggplot2 with data points enlarged, coloured orange, and displayed without transparency.

図の11


図の12

Scatterplot of GDP vs life expectancy showing logarithmic x-axis data spread
Scatterplot of GDP vs life expectancy showing logarithmic x-axis data spread

図の13

Scatter plot of life expectancy vs GDP per capita with a blue trend line summarising the relationship between variables, and gray shaded area indicating 95% confidence intervals for that trend line.

図の14

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The blue trend line is slightly thicker than in the previous figure.

図の15

Scatter plot of life expectancy vs GDP per capita with a trend line summarising the relationship between variables. The plot illustrates the possibilities for styling visualisations in ggplot2 with data points enlarged, coloured orange, and displayed without transparency.

図の16


図の17


図の18


図の19


ベクトル化


図の1

Scatter plot showing populations in the millions against the year for China, India, and Indonesia, countries are not labeled.

図の2

Scatter plot showing populations in the millions against the year for China, India, and Indonesia, countries are not labeled.

Functions Explained


データの出力


Data Frame Manipulation with dplyr


図の1

Diagram illustrating use of select function to select two columns of a data frame If we want to remove one column only from the gapminder data, for example, removing the continent column.


図の2

Diagram illustrating how the group by function oraganizes a data frame into groups

図の3

Diagram illustrating the use of group by and summarize together to create a new variable

図の4


図の5


図の6


Data Frame Manipulation with tidyr


図の1

Diagram illustrating the difference between a wide versus long layout of a data frame

図の2

Diagram illustrating the wide format of the gapminder data frame

図の3

Diagram illustrating how pivot longer reorganizes a data frame from a wide to long format

図の4

Diagram illustrating the long format of the gapminder data

Producing Reports With knitr


図の1

Screenshot of the New R Markdown file dialogue box in RStudio

図の2


図の3

RStudio versions 1.4 and later include visual markdown editing mode. In visual editing mode, markdown expressions (like **bold words**) are transformed to the formatted appearance (bold words) as you type. This mode also includes a toolbar at the top with basic formatting buttons, similar to what you might see in common word processing software programs. You can turn visual editing on and off by pressing the Icon for turning on and off the visual editing mode in RStudio, which looks like a pair of compasses button in the top right corner of your R Markdown document.


Writing Good Software