title: "note2023-5-8-1"
author: "Gao"
date: "2024-04-15"
output: html_document
代码语言:{r setup, include=FALSE}复制knitr::opts_chunk$set(echo = TRUE)
R Markdown
代码语言:{r}复制3 5
3-5
3*5
3/5
3^5
#开方
sqrt(9)
#绝对值
abs(-3)
#log
log2(8)
#获取目录
getwd()
#工作目录里的文件读取方式
x1 = read.csv("x.csv")
#文件不在工作目录下时,用绝对路径读取“x1 = read.csv("D:/DingDing/2023-5-8/x.csv")”
#目标文件在工作目录的上一级或下一级子文件夹里时,用相对路径读取在上一级“x1 = read.csv("../x.csv")”;
#在下一级"x1 = read.csv(""子文件名称"/x.csv")"
head(x1)
pdf("x.pdf")
plot(x1$len,col = factor(x1$dose))
title("Have a try")
dev.off()
write.table(x1,"x.txt")
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
代码语言:{r cars}复制summary(cars)
Including Plots
You can also embed plots, for example:
代码语言:{r pressure, echo=FALSE}复制plot(pressure)
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.