Skip to content
Prev 367035 / 398506 Next

How do I best create a R procedure from a R file?

Hi,

I am working on the following file:
'data.frame':    641 obs. of  2 variables:
 $ indirizzo.sito: chr  "10ahora.com.ar" "abceconomia.co" "accmag.com" "
actu.orange.fr" ...
 $ nome.sito     : chr  "10ahora" "ABC economia" "Acc Magazine" "Orange
Actu" ...
indirizzo.sito    nome.sito
1         10ahora.com.ar      10ahora
2         abceconomia.co ABC economia
3             accmag.com Acc Magazine
4         actu.orange.fr  Orange Actu
5   affaires.lapresse.ca    La Presse
6 agipapress.blogspot.it   Agigapress

Which is regularly updated and I consequently need to update a procedure
that takes elencositi data to update dati$FONTE as indicated below:

dati$FONTE <- ifelse(dati$FONTE=='10ahora.com.ar','10ahora',dati$FONTE)
dati$FONTE <- ifelse(dati$FONTE=='abceconomia.co','ABC economia',dati$FONTE)
dati$FONTE <- ifelse(dati$FONTE=='accmag.com','Acc Magazine',dati$FONTE)

Currently I am using a time consuming procedure involving Excel to update
that, but how can I make that automatic?

Thank you in advance,

Luca