0

I have a dataframe with a column Website_URLs that holds website urls. Some of these urls are not working anymore, as the website is inactive. I want to loop through this website column and check all urls and create a new binary column Website_Failure that gives a 1 if the website is not active anymore and the url produces and error message and a 0 if the website is still up and running.

Here is a test dataframe with some active and inactive urls.

structure(list(Website_URL = c("zyx.network", "antodex.com", 
"apexit.finance", "0xtrade.finance", "fireants.global", "fiattoken.org"
)), class = "data.frame", row.names = c(NA, -6L))

The output here should look like this

Website_URL       Website_Failure
zyx.network       0             
antodex.com       1     
apexit.finance    0     
0xtrade.finance   1         
fireants.global   0         
fiattoken.org     1

Any idea how I can accomplish this?

Soph2010
  • 563
  • 3
  • 13
  • 1
    Have you checked [this](https://stackoverflow.com/questions/52911812/check-if-url-exists-in-r)? – Julian Mar 21 '23 at 09:45
  • This code unfortunately does not give me the required output - for the last URL (fiattoken.org) I get a TRUE when using the code provided, however, there should be a FALSE @Julian – Soph2010 Mar 21 '23 at 10:05

0 Answers0