再現可能な化学分析のためのR
      
        
        
  
    
        
        
- Use RStudio to write and run R programs.
 
- R has the usual arithmetic operators and mathematical
functions.
 
- Use 
<- to assign values to variables. 
- Use 
ls() to list the variables in a program. 
- Use 
rm() to delete objects in a program. 
- Use 
install.packages() to install packages
(libraries). 
- Use RStudio to create and manage projects with consistent
layout.
 
- データは読み込み専用にしましょう.
 
- 生成されたアウトプットを捨てても良いようにしましょう.
 
- 関数定義と適用は別々にしましょう.
 
- Use 
help() to get online help in R. 
- Use 
read.csv to read tabular data in R. 
- The basic data types in R are double, integer, complex, logical, and
character.
 
- Data structures such as data frames or matrices are built on top of
lists and vectors, with some added attributes.
 
- Use 
cbind() to add a new column to a data frame. 
- Use 
rbind() to add a new row to a data frame. 
- Remove rows from a data frame.
 
- Use 
str(), summary(), nrow(),
ncol(), dim(), colnames(),
head(), and typeof() to understand the
structure of a data frame. 
- Read in a csv file using 
read.csv(). 
- Understand what 
length() of a data frame
represents. 
- Indexing in R starts at 1, not 0.
 
- Access individual values by location using 
[]. 
- Access slices of data using 
[low:high]. 
- Access arbitrary sets of data using 
[c(...)]. 
- Use logical operations and logical vectors to access subsets of
data.
 
- Use 
if and else to make choices. 
- Use 
for to repeat operations. 
- Use 
ggplot2 to create plots. 
- Think about graphics in layers: aesthetics, geometry, statistics,
scale transformation, and grouping.
 
- Use vectorized operations instead of loops.
 
- Use 
function to define a new function in R. 
- Use parameters to pass values into functions.
 
- Use 
stopifnot() to flexibly check function arguments in
R. 
- Load functions into programs using 
source(). 
- Save plots from RStudio using the ‘Export’ button.
 
- Use 
write.table to save tabular data. 
- Use the 
dplyr package to manipulate data frames. 
- Use 
select() to choose variables from a data
frame. 
- Use 
filter() to choose data based on values. 
- Use 
group_by() and summarize() to work
with subsets of data. 
- Use 
mutate() to create new variables. 
- Use the 
tidyr package to change the layout of data
frames. 
- Use 
pivot_longer() to go from wide to longer
layout. 
- Use 
pivot_wider() to go from long to wider layout. 
- Mix reporting written in R Markdown with software written in R.
 
- Specify chunk options to control formatting.
 
- Use 
knitr to convert these documents into PDF and other
formats. 
- Keep your project folder structured, organized and tidy.
 
- Document what and why, not how.
 
- Break programs into short single-purpose functions.
 
- Write re-runnable tests.
 
- 同じことを繰り返さないようにしましょう.
 
- Be consistent in naming, indentation, and other aspects of
style.