[R] Can nested data frame be used in machine learning?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sun Oct 13 19:39:36 CEST 2019


Your question is too vague to answer.

Many R functions have "predict" methods that can be used to make
predictions using a new object (e.g. a data frame) from a fitted object fit
on another data frame/object. See e.g. ?predict.lm for an exemplar. But
that's the closest I can come to guessing what you want.

I think you need to spend time with a tutorial or two on whatever
functions/methods you are using for "machine learning." You should not
expect us to do such homework for you.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Oct 13, 2019 at 10:04 AM vod vos via R-help <r-help using r-project.org>
wrote:

> Hello,
>
> If we got a data frame like below, how to use "data" to predict type,
>  if "data" is another data frame (called nested data frame):
>
>
> by_subject
> #> # A tibble: 1000 x 3
> #>   subject            type       data
> #>   <fct>                <fct>      <list>
> #> 1 subject1      aa            <tibble [100 × 10]>
> #> 2 subject2      bb           <tibble [100 × 10]>
> #> 3 subject3      cc            <tibble [100 × 10]>
> #> # … with 997 more rows
>
>
> by_subject$data[[1]]
> #> # A tibble: 100 x 10
> #>    parts      weight    length    height
> #>   <int>     <dbl>       <int>      <dbl>
> #> 1    1         28.8           100          170
> #> 2    2        30.3           105           169
> #> 2    3       10.5            109           189
> #> # … with 97 more rows
>
> Sincerely yours,
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list