[R] fill 0-row data.frame with 1 line of NAs
Liviu Andronic
landronimirc at gmail.com
Wed Jul 11 23:18:36 CEST 2012
On Wed, Jul 11, 2012 at 9:56 PM, William Dunlap <wdunlap at tibco.com> wrote:
> Why does one want to replace a zero-row data.frame
> with a one-row data.frame of NA's? Unless this is for
> an external program that cannot handle zero-row inputs,
> this suggests that there is an unnecessary limitation (i.e.,
> a bug) in the R code that uses this data.frame.
>
I'm running an apply(df, 1, f) function, where f() matches a df$string
in another matrix and fetches data associated with this string. When
no match is made I do not need a zero-row data frame, but to preserve
the structure of the original df I need a data frame with 1 row of
NAs. There may be a nicer approach, but I'm not aware of any.
Regards
Liviu
More information about the R-help
mailing list