lm(y~x )model, R only displays first 10 rows, how to get remaining results see below

Hi All,

I have 1440 simple reg model but R only displays first 10 row, see code below pls can someone advise? Thanks

One simple way is to pipe your command into View()

regression %>%
  unnest(tidied) %>%
  View()

You have to use some special library for that, one option

library(openxlsx)

regressions %>%
    unnest(tidied) %>% 
    write.xlsx(file = "some_name.xlsx")
1 Like

Hi @2020,

I don't believe that error is due to the write.xlsx command. But perhaps I'm wrong. The write.xlsx function will take your data (which is in R format) and translate and write it to an Excel file (.xlsx). It won't open the data in Excel, it will just save the file to the current working directory. You will need to locate and open the file yourself. To find out where the file is saved, you can run the following command in R to find out the working directory (the location on your computer where R is "looking"):

getwd()

You are getting that error message because you are keeping nested columns in regressions try selecting only the unnested columns before saving the xlsx file.

1 Like

Hi Matt, thank you for the explanation. File is in correct location but still not working.

This is a quick way to do it

regressions %>%
    unnest(tidied) %>%
    select_if(~!is.list(.)) %>% 
    write.xlsx("sample.xlsx")
1 Like

You are legend thank you so much. Promise this is my last question ( pls, dont be mad at me ) why I cant open for other output using the code you gave me.

regressions %>%
unnest(glanced, .drop = TRUE) %>%

regressions1 %>%
unnest(tidied) %>%
select_if(~!is.list(.)) %>%
write.xlsx("R-squared.xlsx")

This is the last fish I give you because it seems like you are not learning how to fish, you are not taking syntax into account at all.

regressions %>%
    unnest(c(tidied, glanced), .drop = TRUE) %>% 
    select_if(~!is.list(.)) %>%
    write.xlsx("R-squared.xlsx")

If you want to learn this is a good resource

1 Like

That is just console output if you want to see the rest of the rows add a view() command at the end, and you will see them on the data viewer.

regressions %>%
    unnest(tidied) %>% 
    view()

You have to pay more attention to the syntax, you are missing a pipe operator

regressions %>%
    unnest(glanced, .drop = TRUE) %>% 
    view()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.