-3

I have an excel database with around 250 objects (names of different people), and I would like to know if there´s a function to perform the same command on all of my objects, I have been using the function grep() with each individual name, but i would like to obtain the urls for each individual name without having to do it manually, is there an easier way of doing it? enter image description here

`Alejandro Díaz Domínguez` [grep(".gob.mx", `Alejandro Díaz Domínguez`)] 

 
 [1] "http://www.csg.gob.mx                                        
 [2] "http://www.csg.gob.mx                                      
 [3] "https://sic.gob.mx 
oguz ismail
  • 1
  • 16
  • 47
  • 69
  • Hi there and welcome to SO. Please give us some context to your question. Take a look at [How to Ask](https://stackoverflow.com/help/how-to-ask) for hints. It's a good start to give some data, make a [great reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and give an example of your desired output. – Martin Gal Jun 10 '21 at 22:26
  • Also: in general, please include text-based examples (like your data frame example) as **text** rather than as screenshots; it's much more accessible that way – Ben Bolker Jun 11 '21 at 03:19

1 Answers1

0

If your pattern is ".gob.mx" for all columns and every column has a person, you may want to use lapply().

lapply(your_dataframe, function(x) x[grep(".gob.mx", x)])
GuedesBF
  • 8,409
  • 5
  • 19
  • 37