0

I'm trying to replace the NA's in my output file with a blank. I'm combining columns from two different Excel workbooks with different column names. I added a picture of the output.

library(dplyr)
library(plyr)
library(tidyverse)
library(readxl)
library(xlsx)
file.list <- list.files(pattern='*.xlsx',recursive = TRUE)
file_names<-sapply(file.list,read_excel,simplify = FALSE)
df<-rbind.fill(file_names)
df1<- select(df,"Location Address",City,State,ZIP,address1,address2,city,state,zip)
df1<-unite(vf1,'Full Address',"Location Address",City,State,ZIP,address1,address2,city,state,zip,sep = ",")
write.csv(df1,"adv134.csv",row.names =FALSE,na = "0")

enter image description here

MrFlick
  • 195,160
  • 17
  • 277
  • 295

1 Answers1

2

I think you're looking for:

write.csv(df1,"adv134.csv",row.names =FALSE,na = "")

This will fill any NA values in the data frame as blanks (there is nothing between the quotes).

TTS
  • 1,818
  • 7
  • 16