在R

时间:2017-11-13 18:27:24

标签: r time-series aggregate-functions data-science summary

我有一张桌子,我正在尝试计算在发生致命事故之前和之后发生了多少次崩溃(事件是我的致命事故)并且我想计算在致命事故发生之前和之后一周发生的崩溃总数在每个区域。如果有人能提供帮助我感激不尽 非常感谢 sample table

enter image description here

<!DOCTYPE html>
<html>
<head>
<style>
table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
}

tr:nth-child(even) {
    background-color: #dddddd;
}
</style>
</head>
<body>

<table>
  <tr>
    <th>Crash_Date</th>
    <th>Injury_Stat</th>
    <th>Zone_ID</th>
  </tr>
  <tr>
    <td>12/9/2014</td>
    <td>No injury</td>   
    <td>3</td>
  </tr>
   <tr>
    <td>12/10/2014</td>
    <td>No injury</td>   
    <td>3</td>
  </tr>
   <tr>
    <td>12/12/2014</td>
    <td>Fatal_Crash</td>   
    <td>3</td>
  </tr>
   <tr>
    <td>12/14/2014</td>
    <td>No injury</td>   
    <td>3</td>
  </tr>
   <tr>
    <td>12/16/2014</td>
    <td>No injury</td>   
    <td>3</td>
  </tr>
   <tr>
    <td>12/17/2014</td>
    <td>Non-fatal injury - Possible</td>   
    <td>3</td>
    </tr>
</table>

</body>
</html>

0 个答案:

没有答案