Git Product home page Git Product logo

beautiful-visualization-with-r's People

Contributors

easychart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beautiful-visualization-with-r's Issues

部分.shp文件无法打开

dataProjected <- readOGR("China_adm_shp/bou2_4m/bou2_4p.shp")
错误代码如下:
Error in ogrListLayers(dsn = dsn) : Cannot open data source

关于图5-2-3代码中的报错

我在学习过程中遇到以下问题,希望能够得到帮助,谢谢。
当运行下面代码时

# Johnson分布的偏斜度2.2和峰度13
s <- rJohnson(100, findParams(3, 1, 2., 13.1))
# Johnson分布的偏斜度0和峰度20)
k <- rJohnson(100, findParams(3, 1, 2.2, 20))

出现了如下的报错

Error in .C("JohnsonMomentFitR", as.double(mu), as.double(sigma), as.double(skew),  : 
  程序包"SuppDists"里"JohnsonMomentFitR"不适用于.C()

3.6玫瑰图绘制的R代码会报错,请问怎么解决呢

mydata <- data.frame( a=c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"),
b=c(50, 60, 70, 20,90,110,30))
myAngle <-seq(-20,-340,length.out =7)
ggplot(mydata) +
geom_bar(aes(x=a, y=b),width = 1,stat="identity",
colour = "black",fill="#F8766D") +
geom_text(aes(x=a,y = b-8,label = b),color="white") +
coord_polar(theta = "x",start=0) +
ylim(c(0,120))+
theme_light()+
theme( panel.background = element_blank(),
panel.grid.major = element_line(colour = "grey80",size=.25),
axis.text.y = element_text(size = 12,colour="black"),
axis.line.y = element_line(size=0.25),
axis.text.x=element_text(size = 13,colour="black",angle = myAngle))

Error in if (0 <= angle & angle < 90) { : the condition has length > 1
In addition: The warning message:
Vectorized input to element_text() is not officially supported.
ℹ Results may be unexpected or may change in future versions of ggplot2.

图3-9-3 单篇文章的词云图.R有问题

commonality.cloud
P9@9YTOK3$8GXZ` H%C8T70
library(tm)
library(wordcloud)

Paper1<-paste(scan("Paper1.txt", what = character(0),sep =""),collapse = " ") #读入 TXT 文档 1
Paper2<-paste(scan("Paper2.txt", what = character(0),sep =""),collapse = " ") #读入 TXT 文档 2
tmpText<- data.frame(c(Paper1,Paper2),row.names=c("Text1","Text2"))
df_title <- data.frame(doc_id=row.names(tmpText),text=tmpText$c.Paper1..Paper2.)
ds <- DataframeSource(df_title)
#创建一个数据框格式的数据源,首列是文档 id(doc_id),第二列是文档内容
corp = VCorpus(ds)
#加载文档集中的文本并生成语料库文件
corp = tm_map(corp,removePunctuation) #清除语料库内的标点符号
corp = tm_map(corp,PlainTextDocument) #转换为纯文本
corp = tm_map(corp,removeNumbers) #清除数字符号
corp = tm_map(corp,function(x){removeWords(x,stopwords())}) #过滤停止词库
term.matrix <- TermDocumentMatrix(corp)
#利用 TermDocumentMatrix()函数将处理后的语料库进行断字处理,生成词频权重矩阵
term.matrix <- as.matrix(term.matrix) #频率
colnames(term.matrix) <- c("Paper1","paper2")
#comparison.cloud(term.matrix,max.words=300,random.order=FALSE,colors=c("#00B2FF", "red"))
#图 3-9-4(a)
commonality.cloud(term.matrix,max.words=100,random.order=FALSE,color="#E7298A")
#图 3-9-4(b)
df<-data.frame(term.matrix)
#wordcloud(row.names(df) , df$Paper1 ,min.freq=10,col=brewer.pal(8,"Dark2"),rot.per=0.3 )
#图 3-9-3(a)
#wordcloud(row.names(df) , df$Paper2 , min.freq=10,col=brewer.pal(8,"Dark2"),rot.per=0.3 )
#图 3-9-3(b

错误是:> commonality.cloud(term.matrix,max.words=100,random.order=FALSE,color="#E7298A")
Error in is_overlap(x1, y1, sw1, sh1, boxes) :
程序包'Rcpp_precious_remove'不提供'Rcpp'这样的函数

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.