发现了一些我不知道的奇怪行为。
给出以下数据集:
"Well" "PlateID" "SourceFile" "Frequency" "SI" "Description"
"341" "H10" 1 "94: DDG-00005, HVTN505 CC, Plate1_H10_H10_094.fcs" 24.5 9867 "PBS Background"
"342" "H10" 2 "190: DDG-00005, HVTN505 CC, Plate2_H10_H10_094.fcs" 26.7 10493 "PBS Background"
"343" "H10" 3 "286: DDG-00005, HVTN505 CC, Plate3_H10_H10_094.fcs" 31.1 10508 "PBS Background"
"344" "H10" 4 "382: DDG-00005, HVTN505 CC, Plate4_H10_H10_094.fcs" 52.8 11780 "PBS Background"
"345" "H11" 1 "95: DDG-00005, HVTN505 CC, Plate1_H11_H11_095.fcs" 2.75 8741 "PBS Background"
"346" "H11" 2 "191: DDG-00005, HVTN505 CC, Plate2_H11_H11_095.fcs" 1.74 10422 "PBS Background"
"347" "H11" 3 "287: DDG-00005, HVTN505 CC, Plate3_H11_H11_095.fcs" 2.11 9368 "PBS Background"
"348" "H11" 4 "383: DDG-00005, HVTN505 CC, Plate4_H11_H11_095.fcs" 4.99 8580 "PBS Background"
"349" "H12" 1 "96: DDG-00005, HVTN505 CC, Plate1_H12_H12_096.fcs" 4.26 9845 "PBS Background"
"350" "H12" 2 "192: DDG-00005, HVTN505 CC, Plate2_H12_H12_096.fcs" 41 11455 "PBS Background"
"351" "H12" 3 "288: DDG-00005, HVTN505 CC, Plate3_H12_H12_096.fcs" 9.31 8982 "PBS Background"
"352" "H12" 4 "384: DDG-00005, HVTN505 CC, Plate4_H12_H12_096.fcs" NA NA "PBS Background"
如果我按此顺序进行操作,则会得到所需的输出:
run.data.avg.pbs <- run.data[run.data$Description == "PBS Background",] %>%
group_by(Description, PlateID) %>%
summarise(SI.plateCV = round(cv(SI), 2),
SI = round(mean(SI), 2),
Frequency.plateCV = round(cv(Frequency), 2),
Frequency = round(mean(Frequency), 2))
但是,如果按以下顺序进行操作:
run.data.avg.pbs <- run.data[run.data$Description == "PBS Background",] %>%
group_by(Description, PlateID) %>%
summarise(SI = round(mean(SI), 2),
SI.plateCV = round(cv(SI), 2),
Frequency = round(mean(Frequency), 2),
Frequency.plateCV = round(cv(Frequency), 2))
SI.plateCV和Frequency.plateCV列返回为空(NA)。有什么作用?
编辑:忘记提到的cv()来自栅格数据包。
答案 0 :(得分:2)
这应该有效:
````<head>
````<title>My access grant search title</title>
````<link ````href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTable````s.min.css" rel="stylesheet" />
````<link rel="stylesheet" ````href="http://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
````<script ````src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
````</script>
````<script ````src="http://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js">
````</script>
````<script ````src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.````min.js"></script>
````<script>$(document).ready(function() {
```` $('#example').DataTable({
```` responsive: {
```` details: {
```` type: 'column',
```` target: 5
```` }
```` },
```` columnDefs: [{
```` className: 'btn-info',
```` orderable: false,
```` targets: 5
```` }],
```` });
````});</script>
````<table id="example" class="display">
```` <thead>
```` <tr>
```` <th class="all">Project Name</th>
```` <th class="all">Project Number</th>
```` <th class="all">PI(s)</th>
```` <th class="all">End Date</th>
```` <th class="all">Organization</th>
```` <th class="all">Abstract</th>
```` <th class="none"></th>
```` </tr>
```` </thead>
```` <tbody>
```` <tr>
```` <td>Geographic Access to VHA Rehabilitation Services for OEF/OIF ````Veterans</td>
```` <td>DHI 06-010</td>
```` <td>Cowper Ripley, Diane</td>
```` <td>2007-09-30</td>
```` <td>VA</td>
```` <td>
```` <button type=""button"" class=""btn btn-info"" data- ````toggle=""collapse"" data-target=""#example"">Expand</button>
```` </td>
```` <td>(1) To identify a cohort of Operation Enduring Freedom ````(OEF)/Operation Iraqi Freedom (OIF) combat veterans who accessed Veterans ````Health Administration (VHA) facilities for conditions and injuries ````sustained while on active duty.</td></tr>
````<tr>
```` <td>A Role of Multilevel Healthcare Access Dimensions in Ovarian ````Cancer Disparities</td>
```` <td>R37CA233777</td>
```` <td>AKINYEMIJU, TOMI F;</td>
```` <td>2020-04-30</td>
```` <td>DUKE UNIVERSITY</td>
```` <td>
```` <button type=""button"" class=""btn btn-info"" data- ````toggle=""collapse"" data-target=""#example"">Expand</button>
```` </td>
```` <td>*No changes from original application* Narrative Ovarian cancer ````(OC) survival has improved over the past several decades as new, frontline ````treatment strategies have been developed.</td></tr>
```` </tbody>
````</table>