最低频率表

时间:2019-01-22 08:57:22

标签: r vector conditional-statements

我有一个数字向量,我只想让所有条目以最小的频率出现:

$breakpoint: 992px;

.hamburger {
    display: block;
}

.m-menu {
    display: none;
}

@media (min-width: $breakpoint) {
    .hamburger {
        display: none;
    }

    .m-menu{
        display: block;
    }
}

在这种情况下,我想丢弃3和4,而只保留0、1和2,因为它们出现了3次以上。

2 个答案:

答案 0 :(得分:3)

使用ave

的一个选项
vec[ave(vec, vec, FUN = length) > min]
#[1] 0 1 1 2 0 2 1 1 0 0 0 1 1 2 1 1 1 2

答案 1 :(得分:1)

假设 Sub mergeFiles() 'Merges all files in a folder to a main file. 'Define variables: Dim numberOfFilesChosen, i As Integer Dim tempFileDialog As FileDialog Dim mainWorkbook, sourceWorkbook As Workbook Dim tempWorkSheet As Worksheet Set mainWorkbook = Application.ActiveWorkbook Set tempFileDialog = Application.FileDialog(msoFileDialogFilePicker) 'Allow the user to select multiple workbooks tempFileDialog.AllowMultiSelect = True numberOfFilesChosen = tempFileDialog.Show 'Loop through all selected workbooks For i = 1 To tempFileDialog.SelectedItems.Count 'Open each workbook Workbooks.Open tempFileDialog.SelectedItems(i), Local:=True Set sourceWorkbook = ActiveWorkbook 'Copy each worksheet to the end of the main workbook For Each tempWorkSheet In sourceWorkbook.Worksheets tempWorkSheet.Copy After:=mainWorkbook.Sheets(mainWorkbook.Worksheets.Count) Next tempWorkSheet 'Close the source workbook sourceWorkbook.Close Next i End Sub 是您的i1

table