Hello Everyone,
Well, i need a help in a simple problem, i have a loop in R that create 7 tables, and i want to export these tables to my computer in a .txt format, my objetive is to export these tables in the final of the loop, but i want to export these 7 tables with different names, i know that this procedure is very simples in SAS, because i can use macro variables, but i dont have no idea how to do this in R.
Code:
setwd("C:/Users/yurip/Documents")
x<-read.table("Tabela_Pds_Reduzidas.csv", sep=";",dec=",", header=TRUE)
for(i in 1:7){
data <- x %>% filter(Rating_Ini_num == i)
data_f<-data.frame(Prazo=data$Prazo, PD=data$PD, Rating_num=i)
p<-approx(data_f$Prazo, data_f$PD, n=120)
exp<-data.frame(Prazo = p[1] ,PD =p[2])
write.table(k, "C:/Users/yurip/Documents/tablename.txt")
}