我有这个数据框,我根据变量' redo'分开:
y_by_redo_i <- split(y, y$redo) #so I have:
y_by_redo_i
$`1012`
employed redo
42 1012
53 1012
62 1012 etc.
$`1013`
employed redo
45 1013
71 1013
98 1013 etc.
我可以打电话给例如第一个更小的&#39; dataframe使用:
y_by_redo_i[1] #or y_by_redo_i$'1012'
不同之处在于,在第一种情况下,它也会将$'1012'
作为标题。如何删除此标题,以便使用这两个命令获得相同的相同结果?我希望在&#39; for循环中使用后者y_by_redo_i[i]
。感谢你们!
答案 0 :(得分:0)
你可以使用双括号,这是一个例子:
function calculate() {
var pp = document.getElementById("pp").value;
var dp = document.getElementById("dp").value;
var mt = document.getElementById("mt").value;
var ir = document.getElementById("ir").value;
var result = document.getElementById("result");
var la = parseInt(pp.replace(/,/g, ""), 10) - parseInt(dp.replace(/,/g, ""), 10);
var intRate = (ir/100)/12;
var months = mt * 12;
var monthlyPayment = ((((la*intRate)/(1-Math.pow(1+intRate,(-1*months)))*100)/100).toFixed(2));
result.innerHTML = "£" + monthlyPayment.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function depositValue() {
var pp = document.getElementById("pp").value;
var percent = document.getElementById("percent").value;
var dp = document.getElementById("dp");
var dpValue = (parseInt(percent.replace(/,/g, ""), 10) / 100) * parseInt(pp.replace(/,/g, ""), 10);
dp.value = dpValue;
}
function depositPercent() {
var pp = document.getElementById("pp").value;
var dp = document.getElementById("dp").value;
var percent = document.getElementById("percent");
var dpPercent = (parseInt(dp.replace(/,/g, ""), 10) / parseInt(pp.replace(/,/g, ""), 10) * 100).toFixed(0);
percent.value = dpPercent;
}