Hi
I would appreciate to help me this:
how to replace list of word (file1.txt) using another list (file2.txt)?
file1.txt looks like this:
word1
word2
word3
file2.txt looks like this:
word1 please replace it with me 1
word2 pleasereplaceitwithme2
word3 please_replace_it_with_me 3
words1 <- data.frame(before = LETTERS)
words1
#> before
#> 1 A
#> 2 B
#> 3 C
#> 4 D
#> 5 E
#> 6 F
#> 7 G
#> 8 H
#> 9 I
#> 10 J
#> 11 K
#> 12 L
#> 13 M
#> 14 N
#> 15 O
#> 16 P
#> 17 Q
#> 18 R
#> 19 S
#> 20 T
#> 21 U
#> 22 V
#> 23 W
#> 24 X
#> 25 Y
#> 26 Z
words2 <- data.frame(the_froms = LETTERS, the_tos = letters)
words1[1] <- words2[2]
words1
#> before
#> 1 a
#> 2 b
#> 3 c
#> 4 d
#> 5 e
#> 6 f
#> 7 g
#> 8 h
#> 9 i
#> 10 j
#> 11 k
#> 12 l
#> 13 m
#> 14 n
#> 15 o
#> 16 p
#> 17 q
#> 18 r
#> 19 s
#> 20 t
#> 21 u
#> 22 v
#> 23 w
#> 24 x
#> 25 y
#> 26 z
# the exemplary data are pretty silly, since
# it could be done more directly
words1 <- data.frame(before = LETTERS)
tolower(words1[[1]])
#> [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
#> [20] "t" "u" "v" "w" "x" "y" "z"