簡體   English   中英

R讀取csv文件我只想以該行結尾的一列以特定字符串值結尾

[英]R reading csv file i want to only one column with that row end with specific string value

在此處輸入圖片說明 ** 上圖顯示了示例數據列表,因此我只想記錄該內容特定的關鍵字結尾,如(聯系人); 在那一行。 **

data <- read.csv("csv.csv", sep = ',')

# Get the max salary from data frame.
Piname <- data$col_NAME
print(Piname)
poname <- Piname[str_detect(Piname,"(end_string);")]
print(poname)

#summary(warnings())

tail(warnings(), 50)

我們可以轉義() \\\\(contact\\\\);$並將其用作模式

Piname[str_detect(Piname, "\\(contact\\);$")]

默認情況下, ()將被識別為元字符以將字符捕獲為一個組。 $是表示字符串結束的元字符

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM