我想为每个组获取因子/分类变量值的频率。
以下不起作用:
Error in `[.data.table`(dt, , list(table(fac)), by = grp) :
All items in j=list(...) should be atomic vectors or lists. If you are trying something like j=list(.SD,newcol=mean(colA)) then use := by group instead (much quicker), or cbind or merge afterwards.
错误消息是:
Sub Example1_ForLoop()
Dim lastRow As Long, x As Long
Dim Criteria1 As Variant, Criteria2 As Variant
Criteria1 = 2134
Criteria2 = "003"
lastRow = Range("A" & Rows.Count).End(xlUp).Row
For x = 1 To lastRow
If Cells(x, 1) = Criteria1 And Cells(x, 2) = Criteria2 Then
Cells(x, 6) = Cells(x, 3)
End If
Next
End Sub
Sub Example2_ForEachLoop()
Dim c As Range, SearchRange As Range
Dim Criteria1 As Variant, Criteria2 As Variant
Criteria1 = 2134
Criteria2 = "003"
Set SearchRange = Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each c In SearchRange
If c = Criteria1 And c.Offset(0, 1) = Criteria2 Then
c.Offset(0, 5) = c.Offset(0, 3)
End If
Next
End Sub
'Here is the proper way to use Find and FindNext.
Sub Example3_DoLoop_Find_FindNext()
Dim c As Range, SearchRange As Range
Dim firstAddress As String
Dim Criteria1 As Variant, Criteria2 As Variant
Criteria1 = 2134
Criteria2 = "003"
Set SearchRange = Range("A1", Range("A" & Rows.Count).End(xlUp))
Set c = SearchRange.Find(Criteria1, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If c = Criteria1 And c.Offset(0, 1) = Criteria2 Then
c.Offset(0, 5) = c.Offset(0, 3)
End If
Set c = SearchRange.FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End Sub
有没有简单的方法来完成这项任务?感谢。
答案 0 :(得分:2)
我们可以使用 recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
fileName = FileHelper.getFilename(phoneNumber);
recorder.setOutputFile(fileName);
recorder.start();
并绕过OP代码的第二和第三行。
dcast