How can I change all names like: Finland:Aland Islands:Foglo into only: Finland? I tried using lapply(gsub , pattern = "Finland*", replace = "Finland") But it won't work.
I would also do the same with other countries, like Germany, Denmark.. e.t.c. And also, is there a way to order these countries alphabetically in a list?
Thank you in advance
1 Finland:Aland Islands:Foglo
2 Finland:Aland Islands:Eckero
3 Finland:Aland Islands:Fasta Aland
4 Austria
5 Belgium
6 Bulgaria
7 Switzerland
8 Cyprus:Northern Cyprus
9 Cyprus
10 Czech Republic
11 Germany:Usedom
12 Germany:Fehmarn
13 Germany:Rugen
14 Germany:4
15 Germany
16 Germany:6
17 Denmark:Lolland
18 Denmark:2
19 Denmark:Mon
20 Denmark:Als
21 Denmark:Langeland
22 Denmark:Bornholm
23 Denmark:Fyn
24 Denmark:8
25 Denmark:Samso
26 Denmark:Sjaelland
27 Denmark:Laeso
28 Denmark
29 Spain:Formentera
30 Spain:Ibiza
31 Spain:Majorca
32 Spain:Minorca
33 Spain
34 Estonia:Saaremaa
35 Estonia:Muhu
36 Estonia:Hiiumaa
37 Estonia
38 Finland:1
39 Finland:2
40 Finland:3
41 Finland:4
42 Finland:5
43 Finland:Vallgrund
44 Finland:Halluoto
45 Finland
46 France:Corsica
47 France:Ile d'Oleron
48 France
49 UK:Isle of Wight
50 UK:Wales:Anglesey