[R] read.table : fill missing entry with "unAvailable" [edit]

R. Michael Weylandt michael.weylandt at gmail.com
Thu Nov 17 00:29:20 CET 2011


It's going to depend on how the data missing-ness is represented in the table.

If you have a csv like

1,2,3
1,,3
4,5,6

You automatically get an NA after using read.csv() -- this can be
omitted with the na.omit() command if desired.

If missingness is somehow encoded other than an empty spot, it may be
a bit harder.

Michael

On Wed, Nov 16, 2011 at 4:26 PM, Mary Kindall <mary.kindall at gmail.com> wrote:
> I am very sorry for multiple mails.
>
> Hi R users,
> I try to read a data file (tab delimited format) in which some of the
> entries in a particular field are missing. Is it possible to fill the
> unavailable data with 'UnAvailable' string while performing read.table()
>
> Something like
> df = read.table(DataFile, header=FALSE,  fill_missing_entry = 'unAvailable')
>
>
> Or remove the the complete row in which the missing entry appear.
>
>
> thanks
>
>
>
> --
> -------------
> Mary Kindall
> Yorktown Heights, NY
> USA
>
>
>
>
> --
> -------------
> Mary Kindall
> Yorktown Heights, NY
> USA
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list