user1946989
user1946989

Reputation: 387

R writting in file "" for null or na value

I am trying to write a dataframe in a file with the write.table function I have to fallow a particular format where empty value are represented by "" in the file

I edited my dataframe with "", NA and NULL values prior to using write.table without much success. With NULL I get "NULL", with NA and "" I get nothing in the file

Upvotes: 0

Views: 1037

Answers (1)

Ujjwal Kumar
Ujjwal Kumar

Reputation: 581

You need to specify the na parameter when using write.table. As per it's description: na:the string to use for missing value in data

write.table(df, na='""')

Upvotes: 1

Related Questions