bsspirit / book-r1 Goto Github PK
View Code? Open in Web Editor NEWR的极客理想-工具篇
Home Page: http://fens.me/book-r1
R的极客理想-工具篇
Home Page: http://fens.me/book-r1
description 显示工篇篇,应该是工具篇?
client.r文件代码
~ vi client.r
library(websockets) #加载类库
client = websocket("ws://192.168.1.201",port=7681) #创建客户端实例
rece<-function(DATA, WS, HEADER) { D='' if(is.raw(DATA)){ cat("raw data") D = rawToChar(DATA) } cat("==>",D,"\n")} #监听receive
set_callback("receive",rece, client)
websocket_write("2222", client) #向服务器发请求
service(client) #输出服务器的返回值
websocket_close(client) #关闭连接
代码没换行,改为:
library(websockets) #加载类库
client = websocket("ws://192.168.1.201",port=7681) #创建客户端实例
rece<-function(DATA, WS, HEADER) {
D=''
if(is.raw(DATA)){
cat("raw data")
D = rawToChar(DATA)
}
cat("==>",D,"\n")
}
set_callback("receive",rece, client) #监听receive
websocket_write("2222", client) #向服务器发请求
service(client) #输出服务器的返回值
websocket_close(client) #关闭连接
}
代码最后head(y)处
> head(y)
Petal.Length Petal.Width Sepal.Length Sepal.Width Species
1 1.4 0.2 5.1 3.5 setosa
2 1.4 0.2 4.9 3.0 setosa
3 1.3 0.2 4.7 3.2 setosa
4 1.5 0.2 4.6 3.1 setosa
5 1.4 0.2 5.0 3.6 setosa
6
最后一行6去掉,改为
> head(y)
Petal.Length Petal.Width Sepal.Length Sepal.Width Species
1 1.4 0.2 5.1 3.5 setosa
2 1.4 0.2 4.9 3.0 setosa
3 1.3 0.2 4.7 3.2 setosa
4 1.5 0.2 4.6 3.1 setosa
5 1.4 0.2 5.0 3.6 setosa
R
P212 “用RHive从历史数据中提取逆回购信息”中前言部分“各种机构 分分出售股票,债券,兑换成现金借给应银行。”应该是“纷纷”
P29页,“JSON文档比XML文档要少很多”,行文不标准,不该用“少”,准确的中文应该是“小”。少形容数量多少,这里明显是说明JSON为什么更适合网络传输所以应该是文件大小的小。
由 iphyer 发现错误 [email protected]
……相信这套书可以让数据《库》开发者少走弯路,同时也是对统计工作者视界……
多了一个“库”
刘思喆
数据可视化:第一个例子,股票数据分析案例。
> file<-"fun1_rprof.out"> plot(parse_rprof(file)) # plot画图
> ggplot(parse_rprof(file)) # ggplot2画图
代码没换行,改为:
> file<-"fun1_rprof.out"
> plot(parse_rprof(file)) # plot画图
> ggplot(parse_rprof(file)) # ggplot2画图
勘误和支持
... 一个在线的图书交流网站( https://onbook.me ),方便....
https 改为 http
https://onbook.me 改为 http://onbook.me ,链接也要对应修改
运行客户端程序
> library(websockets)
> client = websocket("ws://192.168.1.201",port=7681)
> rece<-function(DATA, WS, HEADER) { + D='' + if(is.raw(DATA)){ + cat("raw data") + D = rawToChar(DATA) + } + cat("==>",D,"\n")}
> set_callback("receive",rece, client)
> websocket_write("2222", client)
[1] 1
> service(client)
raw data==> You sent 2222
> websocket_close(client)
Client socket 3 was closed.
转行问题, 改为
> library(websockets)
> client = websocket("ws://192.168.1.201",port=7681)
> rece<-function(DATA, WS, HEADER) {
+ D=''
+ if(is.raw(DATA)){
+ cat("raw data")
+ D = rawToChar(DATA)
+ }
+ cat("==>",D,"\n")
+}
> set_callback("receive",rece, client)
> websocket_write("2222", client)
[1] 1
> service(client)
raw data==> You sent 2222
> websocket_close(client)
Client socket 3 was closed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.