我一直在尝试使用knitr加载一些数据(Rdata):
load(url("https://github.com/gualis91/teacherperception/blob/master/tp.Rdata?raw=true",method="curl"))
当我编织HTML时,会显示下一个输出:
Error un parse(text = x, srcfile = src) : <text>:3:0: unexpected end of input 1: load(url("https://github.com/gualis91/teacherperception/blob/master/tp.Rdata?raw=true",method="curl") 2: Calls: <Anonymous> ... evaluate -> parse_all -> pase_all.character -> parse Execution halted
我试图消除&#34;方法&#34;,更改&#34; https&#34;去&#34; http&#34;,消除&#34;?raw = True&#34;访问存档,似乎没有任何工作。但是当我在控制台中将其作为代码运行时,它似乎工作正常!
答案 0 :(得分:2)
当我在常规的R
会话中运行您的代码时,我得到了
网址错误(&#34; https://github.com/gualis91/teacherperception/blob/master/tp.Rdata?raw=true&#34;,: 未使用的参数(方法=&#34; curl&#34;)
现在,如果我删除method='curl'
,它就可以了。
在knitr
knitr::knit(text ='```{r}
load(url("https://github.com/gualis91/teacherperception/blob/master/tp.Rdata?raw=true"))
head(tp)
```')
|.................................................................| 100%
label: unnamed-chunk-1
[1] "\n```r\nload(url(\"https://github.com/gualis91/teacherperception/blob/master/tp.Rdata?raw=true\"))\nhead(tp)\n```\n\n```\n## Gender Age YearsWorkinginthisSchool YearsWorkingasTeacher Education\n## 1 Male 37 1 5 Masters\n## 2 Male 29 3 4 Masters\n## 3 Male 32 1 3 Undergraduate\n## 4 Female 32 10 10 Undergraduate\n## 5 Male 61 34 36 Masters\n## 6 Male 36 7 15 Undergraduate\n## SuperiorsLeadership CommunicationProcessess JobSatisfaction\n## 1 4 2 5\n## 2 4 4 5\n## 3 5 5 5\n## 4 2 2 5\n## 5 5 3 5\n## 6 5 4 5\n## InfrastructureResources FaithFormation AcademicLevel PromotionofCulture\n## 1 3 5 5 4\n## 2 4 5 4 3\n## 3 3 5 4 4\n## 4 3 5 3 2\n## 5 5 5 3 2\n## 6 4 5 4 4\n## PromotionofArts PromotionofScience PromotionofHumanities\n## 1 3 3 4\n## 2 4 4 4\n## 3 4 4 5\n## 4 2 2 2\n## 5 2 3 2\n## 6 3 4 5\n## FeedbackRecieved OverallTeacherPerfomance WorkEnvironment Discipline\n## 1 3 4 4 -5\n## 2 4 5 4 4\n## 3 5 4 5 4\n## 4 3 5 3 2\n## 5 4 5 5 4\n## 6 4 5 4 1\n## TrainingOpportunities\n## 1 4\n## 2 4\n## 3 4\n## 4 3\n## 5 4\n## 6 3\n```"