我有一堆标题为这样的帖子......
在这些帖子的每一篇文章中,我都有一个下拉菜单,显示标题相同但年份不同的帖子。这是我的代码。我顺便使用Relavanssi插件:
setwd("~/Desktop/Automated Analysis/TXT/") # Set working directory
# List all txt files including sub-folders
list_of_files <- list.files(path = ".", recursive = TRUE,
pattern = "\\.txt$", full.names = TRUE)
library(data.table)
# Read all the files and create a FileName column to store filenames
DT <- rbindlist( sapply(list_of_files, fread, simplify = FALSE),
use.names = TRUE, idcol = "FileName" )
br = c(0,1,3,9,15,500) # Set breaks
bins = c(0,1,2,3,4) # Set bins
for (k in 1:length(list_of_files)) { # process all the files in the working directory
HScore_list = c() # create a vector for storing the results
for(i in 1:5) { my_vector = c(HScore_list,i) }
freq = hist(Count, breaks=br, plot=FALSE)
df = data.frame(bins, frequency=freq$counts,
df$percent=df$frequency / sum(df$frequency) * 100,
df$HScore=df$percent * df$bins)
HScore = sum(df$HScore)
}
write(HScore_list, "HScore_list.txt", sep="\n")
正如您所看到的,我正在寻找当前的帖子标题并删除这些年份。
一切都很好,但是如果我有更多的帖子叫做......
...这些帖子也会显示在上述“英语语言”的下拉菜单中。帖子,因为它正在使用短语&#39;英语语言&#39;但我想要一个完全搜索查询,因此它只会显示“英语语言”。关于这些帖子的下拉列表的帖子。
我尝试在引号中包装$ the_title var以尝试进行短语搜索,但这没有做任何事情。