Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用R从基于特定单元格格式的数据框中删除行_R_Csv_Twitter - Fatal编程技术网

如何使用R从基于特定单元格格式的数据框中删除行

如何使用R从基于特定单元格格式的数据框中删除行,r,csv,twitter,R,Csv,Twitter,因此,我试图对Twitter Analytics中的.csv进行一些基本分析。对于那些不知道的人来说,推特分析导出包括关于您帐户的所有帖子和@repress的信息。不过,我只想看看我们实际发布的信息。没有列指定帖子是原创还是回复。帖子是回复的唯一信号是,在“Tweet text”列中,它总是以“@”用户名开头。如何使用R删除.csv中“Tweet text”列中以@开头的所有行 您可以使用grep()来执行此操作 # sample data frame df <- data.frame(t

因此,我试图对Twitter Analytics中的.csv进行一些基本分析。对于那些不知道的人来说,推特分析导出包括关于您帐户的所有帖子和@repress的信息。不过,我只想看看我们实际发布的信息。没有列指定帖子是原创还是回复。帖子是回复的唯一信号是,在“Tweet text”列中,它总是以“@”用户名开头。如何使用R删除.csv中“Tweet text”列中以@开头的所有行

您可以使用
grep()
来执行此操作

# sample data frame
df <- data.frame(text = c("Here's a tweet", 
                          "@user this is a reply", 
                          "another tweet", 
                          "@another reply"),
                 stringsAsFactors = FALSE)

# remove rows beginning with @
df[grep("^@", df$text, invert = TRUE), ]
# [1] "Here's a tweet" "another tweet"
#示例数据帧

df很抱歉我不够清晰,但我对编程是全新的,所以我很难解释我需要什么。。。