技术标签: r语言8c多字节字符串有错
BirdFluCases.txt1 饼图
1.1 载入数据
setwd("E:/R/R-beginer-guide/data/RBook")
BFCases
names(BFCases)
str(BFCases) 第一次报错:
> setwd("E:/R/R-beginer-guide/data/RBook")
> BFCases
错误于make.names(col.names, unique = TRUE) : 多字节字符串8有错
> names(BFCases)
错误: 找不到对象'BFCases'
> str(BFCases)
错误于str(BFCases) : 找不到对象'BFCases'
>
打开BirdFluCases.txt文件,发现有个’?‘ 删除即可
再次运行载入脚本
> setwd("E:/R/R-beginer-guide/data/RBook")
> BFCases
> names(BFCases)
[1] "Year" "Azerbaijan" "Bangladesh" "Cambodia" "China"
[6] "Djibouti" "Egypt" "Indonesia" "Iraq" "LaoPDR"
[11] "Myanmar" "Nigeria" "Pakistan" "Thailand" "Turkey"
[16] "VietNam"
> str(BFCases)
'data.frame': 6 obs. of 16 variables:
$ Year : int 2003 2004 2005 2006 2007 2008
$ Azerbaijan: int 0 0 0 8 0 0
$ Bangladesh: int 0 0 0 0 0 1
$ Cambodia : int 0 0 4 2 1 0
$ China : int 1 0 8 13 5 3
$ Djibouti : int 0 0 0 1 0 0
$ Egypt : int 0 0 0 18 25 7
$ Indonesia : int 0 0 20 55 42 18
$ Iraq : int 0 0 0 3 0 0
$ LaoPDR : int 0 0 0 0 2 0
$ Myanmar : int 0 0 0 0 1 0
$ Nigeria : int 0 0 0 0 1 0
$ Pakistan : int 0 0 0 0 3 0
$ Thailand : int 0 17 5 3 0 0
$ Turkey : int 0 0 0 12 0 0
$ VietNam : int 3 29 61 0 8 5
> 准备数据源
Cases
names(Cases)
Cases 生成饼图的代码
par(mfrow=c(2,2),mar=c(3,2,2,1))
pie(Cases,main="Ordinary pie chart")
pie(Cases,col=gray(seq(0.4,1.0,length=6)),clockwise=TRUE,main="Gray colours")
pie(Cases,col=rainbow(6),clockwise=TRUE,main="Rainbow colours")
library(plotrix)
pie3D(Cases,labels=names(Cases),explode=0.1,main="3D pie chart",labelcex=0.6)
效果图:
par函数:mfrowc(2,2)表示生成四个面板 mar用来调整四侧边缘线的数目
clockwise=TRUE 表示按照瞬时间排时间
2 条形图
载入数据
BFDeaths
Deaths
names(Deaths)
Deaths 生成条形图的代码:
par(mfrow = c(2,2),mar = c(3,3,2,1))
barplot(Cases,main="Bird Flu cases")
Counts
barplot(Counts)
barplot(t(Counts),col = gray(c(0.5,1)))
barplot(t(Counts),beside = TRUE) 效果图
3 显示均值和标准差的条形图
载入数据
Benthic
Bent.M
Bent.sd
MSD
MSD
图形显示代码
barplot(Bent.M)
barplot(Bent.M,xlab="Beach",ylim=c(0,20),ylab="Richness",col=rainbow(9))
bp
arrows(bp,Bent.M,bp,Bent.M+Bent.sd,lwd=1.5,angle=90,length=0.1)
box() 带形图
Benth.le
Benth.se
stripchart(Benthic$Richness ~ Benthic$Beach,vert = TRUE,pch=1,method="jitter",
jit=0.05,xlab="Beach",ylab="Richness")
points(1:9,Bent.M,pch=16,cex=1.5)
arrows(1:9,Bent.M,1:9,Bent.M+Benth.se,lwd = 1.5,angle = 90,length = 0.1)
arrows(1:9,Bent.M,1:9,Bent.M-Benth.se,lwd = 1.5,angle = 90,length = 0.1)
盒形图
载入数据
Owls
boxplot(Owls$NegPerChick,main="Negotiation per chick")
描绘图形
par(mfrow = c(2,2),mar = c(3,3,2,1))
boxplot(NegPerChick ~ SexParent,data = Owls)
boxplot(NegPerChick ~ FoodTreatment,data = Owls)
boxplot(NegPerChick ~ SexParent * FoodTreatment,data = Owls)
boxplot(NegPerChick ~ SexParent * FoodTreatment,names = c("F/Dep","M/Dep","F/Sat","M/Sat"),data = Owls)
另外一个盒形图
代码
par(mar = c(2,2,3,3))
boxplot(NegPerChick ~ Nest,data = Owls,axes = FALSE,ylim =c (-3,8.5))
axis(2,at = c(0,2,4,6,8))
text(x=1:27,y = -2,labels=levels(Owls$Nest),cex=0.75,srt = 65) 克里夫兰点图
Deer
dotchart(Deer$LCT,xlab="Length (cm)",ylab=" Observation number")
Isna
dotchart(Deer$LCT[!Isna],groups=factor(Deer$Sex[!Isna]),xlab="Length(cm)",
ylab="Observation number grouped by sex)
另外一个添加均值的例子
Benthic
Benthic$fBeach
par(mfrow = c(1,2))
dotchart(Benthic$Richness,groups = Benthic$fBeach,xlab = "Richness",ylab="Beach")
Bent.M
dotchart(Benthic$Richness,groups = Benthic$fBeach,gdata=Bent.M,
gpch=19,xlab="Richness", ylab="Beach")
legend("bottomright",c("values","mean"),pch=c(1,19),bg="white") 效果图
plot实战1
plot(y = Benthic$Richness,x = Benthic$NAP,xlab="Mean high tide (m)",
ylab="Species richness",main="Benthic data")
M0
abline(M0) plot 实战2
plot(y = Benthic$Richness,x = Benthic$NAP,
xlab="Mean high tide (m)",ylab="Species richness",
main="Benthic data",xlim=c(-3,3),ylim=c(0,20)) plot实战3
plot(y = Benthic$Richness,x = Benthic$NAP, type="n",axes=FALSE ,
xlab="Mean high tide (m)",ylab="Species richness")
points(y = Benthic$Richness,x = Benthic$NAP) plot实战4
plot(y = Benthic$Richness,x = Benthic$NAP, type="n",axes=FALSE ,
xlab="Mean high tide (m)",ylab="Species richness",
xlim = c(-1.75,2),ylim = c(0,20))
points(y = Benthic$Richness,x = Benthic$NAP)
axis(2,at = c(0,10,20),tcl = 1)
axis(1,at = c(-1.75,0,2),labels=c("Sea","Water line","Dunes")) plot实战5
Birds
Birds$LOGAREA
plot(x=Birds$LOGAREA,y=Birds$ABUND,xlab="Log transformed area",
ylab="Bird adbundance")
M0
summary(M0)
LAR
ABUND1
ABUND2
ABUND3
ABUND4
ABUND5
lines(LAR,ABUND1,lty = 1,lwd=1,col=1)
lines(LAR,ABUND2,lty = 2,lwd=2,col=2)
lines(LAR,ABUND3,lty = 3,lwd=3,col=3)
lines(LAR,ABUND4,lty = 4,lwd=4,col=4)
lines(LAR,ABUND5,lty = 5,lwd=5,col=5)
legend.txt
legend("topleft",legend=legend.txt,
col=c(1,2,3,4,5),
lty=c(1,2,3,4,5),
lwd=c(1,2,3,4,5),
bty="o",cex=0.8) plot实战6
Whales
header=TRUE)
N.Moby
Age.Moby
plot(x=Age.Moby,y=N.Moby,xlab="Age",ylab=expression(paste(delta^{15},"N")))
python-matplotlib库绘制饼形图专题(从一般饼状图到内嵌环形图)1.plt.pie()2. 饼图基本 3. 饼状图进阶 4. 环形图 5. 内嵌环形图
用go语言来实现socks5代理服务器,后面会加入ssh远程代理,用户验证,均衡负载一些吧 首先监听8080端口,循环接收tcp连接 server, err := net.Listen("tcp", ":8080") if err != nil { log.Panic(err)...
问题描述通过Cloudera添加Hue服务完成后,HueServer启动异常,导致8888端口无法浏览器访问。 1. cloudera管理平台报错信息如下 2. 浏览器报错如下 问题排查1. 查看错误日志(1) /var/log/hue/syncdb.log && /var/log/hue/migrate.log [02/May/2018...
文章目录摘要结论论文概要BaseLine训练过程tricks结构Efficient Training 高效训练Large-batch training 大批量训练Linear scaling learning rate 等比例增大学习率Learning rate warmup 学习率预热Zero γ 零γ初始化No bias decay 无偏置衰减题外话Low-precision train...
1,`timescale (time unit)/(time precision),该语言是用于仿真文件中指定时间单位和时间精度的,时间单位、精度的可以是1、10、100这三种整数,后面的单位可以是s、ms、us、ns、ps、fs,时间精度必须小于等于时间单位。仿真最终的时间计算是nx时间单位,然后按精度四舍五入得到的。需要注意的是同一个仿真工程里,有多个文件使用timescale,精度会按照最小...
比较简单的一道区间DP了。f[i][j][0/1]f[i][j][0/1]f[i][j][0/1]表示当前已经合法选择了区间[i,j][i,j][i,j]的数,其中最后一个添加的数在左边000或者右边111。转移比较简单,唯一需要注意的地方是初始化中f[i][i][0]f[i][i][0]f[i][i][0]与f[i][i][1]f[i][i][1]f[i][i][1]只需要初始化一个。#i...
获取图像像素指针CV_Assert(myimage.depth() == CV_8U)Mat.ptr(int i = 0) 获取像素矩阵的指针,索引i表示第几行,从0开始计数获得当前行指针const uchar* current = myimage.ptr(row);获取当前像素点P(row,col)的像素值p(row,col) = currenr[col]像素范围处理saturate_castsaturate_cast(-100),返回0saturate_cast(28
PHP如何实现文件上传1.表单部分 允许用户上传文件,在HTML表单的声明中要加上一个上传的属性: enctype = 'multipart/form-data' 表单的method必须是POST 表单选项MAX_FILE_SIZE隐藏域用于限制上传文件大小,它必须放在文件表单元素前面,单位为字节。 如: 复制代码代码如下: 2.处
public class News { private String id; private String title; private String content; private String time; private String htmlPath; set/get... } public List<News> queryNewsByC...
极力推荐文章:欢迎收藏Android 干货分享阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android1.四大组件是什么?1.Activity: 用户可操作的可视化界面,为用户提供一个完成操作指令的窗口。一个Activity通常是一个单独的屏幕,Activity通过Intent来进行通信。Android中会维持一个Activity Stack,当一个新Activ...
创建文件提示[emailprotected]:/test>mkdir kkmkdir: 无法创建目录"kk": 只读文件系统[emailprotected]:/test>mount.....mqueue on /dev/mqueue type mqueue (rw,relatime)debugfs on /sys/kernel/debug type debugfs (rw,rela...
奋斗的小蜗牛时间限制:1000 ms | 内存限制:65535 KB难度:1描述 传说中能站在金字塔顶的只有两种动物,一种是鹰,一种是蜗牛。一只小蜗牛听了这个传说后,大受鼓舞,立志要爬上金字塔。为了实现自己的梦想,蜗牛找到了老鹰,老鹰告诉它金字塔高H米,小蜗牛知道一个白天自己能向上爬10米,但由于晚上要休息,自己会下滑5米。它想知道自己在第几天能站在金字塔