stringr

    1熱度

    1回答

    文本=「護士是非常有益的的確是」 我想搜索「非常」,然後提取「非常」一個字後,「非常」 的輸出應爲:非常有益 我使用: 字(文本,開始= 4,末端= 9月5日=固定(」「)),用於提取 的是有益的,但我無法在該c中的字符串「4」中動態獲取該字的位置值ase 謝謝你的幫忙!

    1熱度

    1回答

    替換字符串中specfic列的每一行,我有以下tibble: library(tidyverse) df <- tibble::tribble( ~sample, ~colB, ~colC, "foo", 1, 2, "bar_x", 2, 3, "qux.6hr.ID", 3, 4, "dog", 1, 1 ) df #> # A t

    1熱度

    2回答

    我期望從列中的條目(user_entry)具有不同格式並且每行可能包含多個實例的數據創建查找表。 # create example dataframe. id <- c(1111,1112,1113,1114) user_entry <- c("999/1001","1002;1003","999/1004\n999/1005","9991006 9991007") df <- data.f

    0熱度

    1回答

    文本字符串創建新的類別我有以下行一列: Telephone line rental|Fixed broadband|Mobile phone|NET: No home phone calls|NET: Internet access Telephone line rental|Fixed broadband|Mobile phone|NET: No home phone calls|NET: I

    0熱度

    1回答

    在R中,我可以看到一個環境變量具有正確的文件路徑。 > Sys.getenv() ... TEMP C:\Users\username\AppData\Local\Temp\1 TMP C:\Users\username\AppData\Local\Temp\1 USERPROFILE C:\Users\username ... 但是,當我直接檢索USERP

    2熱度

    1回答

    我想提取HBA1C的值。這些值出現在數據幀df的文本變量X2中的模式「HBA1C =」之後。該圖案可以在字符串的開始在中間顯示爲行2,3和6,以及如行4中 df<-data.frame(X1=1:6,X2=c(NA,"HBA1C = 8.9 (09/06/15)","HBA1C = 9.8 (03/08/15)", "JUN 2014, WAS ON LANTUS AND A

    0熱度

    1回答

    我有兩個數據幀每列名 df1: name @one2 !iftwo there_2_go come&go df1 = structure(list(name = c("@one2", "!iftwo", "there_2_go", "come&go")),.Names = c("name"), row.names = c(NA, -4L), class = "data.frame")

    1熱度

    1回答

    我有一個西里爾文寫的名字和姓氏列表。 head(text, n = 20) unique(clients$RODITEL) 1 <NA> 2 ЃОРЃИ 3 ALEKSANDAR 4 000000000000 5 ТР4АЈЧЕ 6 0 7 HHHHHHH 8 0000000 9 TASKO 10

    0熱度

    1回答

    考慮R中的一個字符向量。如您猜測,這是一個信用卡語句提取(保存在一個變量x) [1] "Statement includes payments and charges received by April 20, 2017 May 11, 2017" [2] "Statement Period From March 21 to April 20, 2017" [3] "At Apr

    -2熱度

    1回答

    「」「我需要向數據框x添加一列,指示y的元素出現在」動物「列中的次數X: 「」」 library(stringr) x <- data_frame(c("cat", "dog", "cat and dog")) colnames(x) <- "animal" x$count <- 0 y <- data_frame(c("cat", "dog")) colnames(y) <- "a