在git中进行高级操作时,我更像是一个新手.我使用博客框架Octopress维护我的博客.虽然Octopress自2011年以来没有任何发展,但它很好地实现了我的目的,所以到目前为止我还没想过要改变任何东西.
仅供参考,我的博客是在Github Pages上托管的.
今天,在处理新帖子时,git status显示以下消息:
On branch source
Your branch is based on 'origin/master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
Run Code Online (Sandbox Code Playgroud)
对所有后续命令重复相同的消息,例如git add .,git commit -m 'message'和git push origin source.
如果可能的话,请指向我的pdf/web文章,在那里我可以阅读并了解它以备将来使用.
更多细节:
bash-3.2$ git branch -a
* source
remotes/octopress/2.1
remotes/octopress/HEAD -> octopress/master
remotes/octopress/gh-pages
remotes/octopress/linklog
remotes/octopress/master
remotes/octopress/refactor_with_tests
remotes/octopress/rubygemcli
remotes/octopress/site
remotes/origin/source
Run Code Online (Sandbox Code Playgroud)
如果需要更多信息,请告诉我.谢谢.
我有一个本地图像,我想包含在一个.Rmd文件中,然后我将knit转换为HTML幻灯片Pandoc.根据这篇文章,这将插入本地图像:

有没有办法修改此代码以设置图像大小?
见下文:
paste("perf.a", "1", sep="")
[1] "perf.a1"
Run Code Online (Sandbox Code Playgroud)
如果我想分配值perf.a1怎么办?
我尝试了as.name,as.symbol等等,但无济于事:
as.name(paste("perf.a", "1", sep="")) = 5
Error in as.name(paste("perf.a", "1", sep = "")) = 5 :
target of assignment expands to non-language object
as.symbol(paste("perf.a", "1", sep="")) = 5
Error in as.symbol(paste("perf.a", "1", sep = "")) = 5 :
target of assignment expands to non-language object
noquote(paste("perf.a", "1", sep="")) = 5
Error in noquote(paste("perf.a", "1", sep = "")) = 5 :
target of assignment expands to non-language object
Run Code Online (Sandbox Code Playgroud) 在运行中途Conda Update --all,更新停滞不前.多个包已更新.现在,当我跑步conda update --all或者conda update conda,我得到这个回应:
(C:\Users\*****\AppData\Local\Continuum\Anaconda3) C:\Users\*****>conda update conda
Fetching package metadata ...
CondaHTTPError: HTTP None None for url <None>
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),),)
Run Code Online (Sandbox Code Playgroud)
我重复conda update conda了好几天,结果没有变化.我可以看到没有HTTP,但是conda info --a显示了频道网址.
(C:\Users\*****\AppData\Local\Continuum\Anaconda3) C:\Users\*****>conda info -a
Current conda install:
platform …Run Code Online (Sandbox Code Playgroud) 我有一个这样的数据框:
df = data.frame(a=1:3, b=2:4, c=3:5)
我正在使用类似于以下内容的方式从该数据框中选择列:
df[, c(T, F, T)]
只要至少有两列要返回,这样就可以正常工作; 但是,如果我这样做,例如:
df[, c(T, F, F)]
...我突然只得到一个向量而不是data.frame.
通常这很好(甚至是期望的),但是因为我需要在稍后的某个时候将结果作为data.frame,这完全会弄乱我的脚本.
有没有办法可以阻止R自动转换为单列选择的向量?
我想用R来刮掉这个页面:( http://www.fifa.com/worldcup/archive/germany2006/results/matches/match=97410001/report.html)和其他人,以获得目标得分手和时间.
到目前为止,这就是我所拥有的:
require(RCurl)
require(XML)
theURL <-"http://www.fifa.com/worldcup/archive/germany2006/results/matches/match=97410001/report.html"
webpage <- getURL(theURL, header=FALSE, verbose=TRUE)
webpagecont <- readLines(tc <- textConnection(webpage)); close(tc)
pagetree <- htmlTreeParse(webpagecont, error=function(...){}, useInternalNodes = TRUE)
Run Code Online (Sandbox Code Playgroud)
pagetree对象现在包含指向我解析的html的指针(我认为).我想要的部分是:
<div class="cont")<ul>
<div class="bold medium">Goals scored</div>
<li>Philipp LAHM (GER) 6', </li>
<li>Paulo WANCHOPE (CRC) 12', </li>
<li>Miroslav KLOSE (GER) 17', </li>
<li>Miroslav KLOSE (GER) 61', </li>
<li>Paulo WANCHOPE (CRC) 73', </li>
<li>Torsten FRINGS (GER) 87'</li>
</ul></div>
Run Code Online (Sandbox Code Playgroud)
但我现在已经失去了对于如何隔离它们,并坦言xpathSApply和xpathApply迷惑beejeebies我了!
那么,有没有人知道如何制定一个命令来吸出<div class="cont">标签中包含的元素?
在我的文档中,我使用了PDF
\includepdf[pages=-]{./mypdf.pdf}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是如何为此pdf添加TOC条目.
它应该是一个附录.我尝试在附录中添加一个新部分,但当然部分名称不能打印在与包含的pdf相同的页面上,因此生成的TOC行指向错误的页面.
如果我使用\addcontentsline我松开编号并且页面也是错误的,因为包含的pdf实际上是从下一页开始的...
我有点迷失在这里,所以如果有人知道怎么做,我真的很感激.
注意:我尝试包含的pdf不是从LaTex生成的.
NA用前一个值时间填充值的好方法是(1+growth)什么?
df <- data.frame(year=0:6,
price1=c(1.1, 2.1, 3.2, 4.8, NA, NA, NA),
price2=c(1.1, 2.1, 3.2, NA, NA, NA, NA))
growth <- .02
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我想缺少的值price1来填充4.8*1.02,4.8*1.02^2和4.8*1.02^3.同样,我想缺少的值price2来填充3.2*1.02,3.2*1.02^2,3.2*1.02^3,和3.2*1.02^4.
我试过这个,但我认为需要设置重复某种方式(apply?):
library(dplyr)
df %>% mutate(price1=ifelse(is.na(price1),
lag(price1)*(1+growth), price1))
Run Code Online (Sandbox Code Playgroud)
我还没有使用dplyr其他任何东西,所以基础R plyr或类似的东西将被赞赏.
我想要cbind两个数据框并删除重复的列.例如:
df1 <- data.frame(var1=c('a','b','c'), var2=c(1,2,3))
df2 <- data.frame(var1=c('a','b','c'), var3=c(2,4,6))
cbind(df1,df2) #this creates a data frame in which column var1 is duplicated
Run Code Online (Sandbox Code Playgroud)
我想创建一个包含列的数据框var1,var2并且不会重复var3哪一列var2.
这里我有温度时间序列面板数据,我打算为它运行分段回归或三次样条回归.首先,我快速研究了分段回归概念及其在R in中的基本实现,SO初步了解了如何继续我的工作流程.在我的第一次尝试中,我试图通过使用splines::nsin splinespackage 来运行样条回归,但是我没有得到正确的条形图.对我来说,使用基线回归或分段回归或样条回归可以起作用.
以下是我的面板数据规范的一般情况:在下面显示的第一行是我的因变量,以自然对数项和自变量表示:平均温度,总降水量和11个温度箱以及每个箱宽(AKA,箱窗) )是3摄氏度.(< - 6,-6~-3,-3~0,...> 21).
可重复的例子:
以下是使用实际温度时间序列面板数据模拟的可重现数据:
set.seed(1) # make following random data same for everyone
dat <- data.frame(index=rep(c("dex111", "dex112", "dex113", "dex114", "dex115"),
each=30),
year=1980:2009,
region= rep(c("Berlin", "Stuttgart", "Böblingen",
"Wartburgkreis", "Eisenach"), each=30),
ln_gdp_percapita=rep(sample.int(40, 30), 5),
ln_gva_agr_perworker=rep(sample.int(45, 30), 5),
temperature=rep(sample.int(50, 30), 5),
precipitation=rep(sample.int(60, 30), 5),
bin1=rep(sample.int(32, 30), 5),
bin2=rep(sample.int(34, 30), 5),
bin3=rep(sample.int(36, 30), 5),
bin4=rep(sample.int(38, 30), 5),
bin5=rep(sample.int(40, 30), 5),
bin6=rep(sample.int(42, 30), 5),
bin7=rep(sample.int(44, 30), 5),
bin8=rep(sample.int(46, 30), 5),
bin9=rep(sample.int(48, 30), …Run Code Online (Sandbox Code Playgroud)