-1

I performed the split.plot analysis using doebioresearch package in R. The result for multiple traits is generated in form of nested lists and the overall structure of the output file is multi-layered. I want to save this output in form of table in excel sheets but gettimng problem in converting the list structure to data frame.

example_split<-splitplot(data=splitdata[4:5], 
          block=splitdata$Replication, main.plot=splitdata$Date_of_Sowing, 
          sub.plot=splitdata$Varities, mean.comparison.test=3)#3 for tuckey
class(example_split)
str(example_split)

now I want to save this example_split output in excel. for that i need to convert it to data frame. I tried:

data.frame(do.call(rbind.data.frame, example_split))

the error it shows is

Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
  cannot coerce class ‘"htest"’ to a data.frame
3
  • 1
    The output of doebioresearch::splitplot is not suitable for Excel. Commented Jul 8, 2024 at 6:11
  • how else can i save the output Commented Jul 8, 2024 at 6:13
  • If you really want to save the results to Excel, then choose the individual components to save. But Excel was not designed for showing the results of analyses. Commented Jul 8, 2024 at 6:23

1 Answer 1

0

Complicated lists are not suitable for conversion to data frames.

You can try the tidy function from the broom package, which can convert the results of certain R analyses into data frames, which can be saved to an Excel file. However, you need to choose which parts of the output you want to save. You can't just tidy the whole thing.

library(broom)

tidy(example_split$Yield[[1]][[1]])
# A tibble: 6 × 6
  term                  df   sumsq  meansq statistic p.value
  <chr>              <int>   <dbl>   <dbl>     <dbl>   <dbl>
1 block                  2  61557.  30779.   0.188    0.842 
2 main.plot              1    187.    187.   0.00114  0.976 
3 Ea                     2 328176. 164088.  NA       NA     
4 sub.plot               5 510277. 102055.   2.99     0.0356
5 main.plot:sub.plot     5 125447.  25089.   0.735    0.606 
6 Eb                    20 682307.  34115.  NA       NA 

tidy(example_split$Yield[[1]][[1]])
 # A tibble: 6 × 6
  term                  df   sumsq  meansq statistic p.value
  <chr>              <int>   <dbl>   <dbl>     <dbl>   <dbl>
1 block                  2  61557.  30779.   0.188    0.842 
2 main.plot              1    187.    187.   0.00114  0.976 
3 Ea                     2 328176. 164088.  NA       NA     
4 sub.plot               5 510277. 102055.   2.99     0.0356
5 main.plot:sub.plot     5 125447.  25089.   0.735    0.606 
6 Eb                    20 682307.  34115.  NA       NA     
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.