在以前的问题和问题的答案中找不到合适的答案:1.我有一个2.3 GB的csv文件,其中包含240万行希伯来文本,目前以ASCII编码.既然我们在谈论大文件,那么fread会更好,但编码呢?任何想法如何读取ASCII编码的csv文件,以避免着名的"嵌入式字符串中的nul"错误?
谢谢
一直在努力去除niqqud(用于表示元音的变音符号或区分希伯来字母的字母的替代发音).我有这个变量:sample1 < - "הֻסְמַק"
我找不到有效的方法来删除字母下面的标志.
尝试了纵梁,str_replace_all(sample1, "[^[:alnum:]]", "")
试过gsub('[:punct:]','',sample1)
没有成功... :-(任何想法?
我的数据看起来像这样,
posture code HR EE a b
cycling A03 102 100 3 6
standingA03 99 99 4 6
sitting A03 98 67 5 5
walking A03 97 78 3 6
cycling B01 111 76 5 5
standingB01 100 88 4 4
sitting B01 78 34 4 3
walking B01 99 99 2 2
Run Code Online (Sandbox Code Playgroud)
我需要转置它,使它看起来如下所示:
code cycling_HR cycling_EE cycling_a cycling_b standing_HR standing_EE standing_a standing_b sitting_HR sitting_EE sitting_a sitting_b walking_HR walking_EE walking_a walking_b
A03 102 100 3 6 99 99 4 6 …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种快速有效的扩展字典解决方案(df1)
pattern cat1 cat2
1 I want [food] a b
2 I'm [amplifier] [pos]. a b
df1 <- data.frame(pattern=c("I want [food]", "I'm [amplifier] [pos]"),
cat1=c("a", "c"), cat2=c("b", "d"), stringsAsFactors=FALSE)
Run Code Online (Sandbox Code Playgroud)
具有字符串模式,其中一些类别包含在方括号[]中.这些表示以字典格式(df2)出现在附加数据框中的类别.
pattern category
1 pizza food
2 hot dog food
3 chips food
4 very amplifier
5 very much amplifier
6 happy pos
7 optimistic pos
df2 <- structure(list(pattern = c("pizza", "hot dog", "chips", "very",
"very much", "happy", "optimistic"), category = c("food", "food",
"food", "amplifier", "amplifier", "pos", "pos")), .Names = c("pattern", …Run Code Online (Sandbox Code Playgroud)