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()

Thanks Matt this works nicely. Apologies if this is a stupid question, do you know how can I extract this table to excel ?

image

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

library(openxlsx)

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

Thanks Andres for this reply and the other one. Last question, just simply running this code should paste the data in the excel. Sorry, I am not really familiar with this package trying to understand what it is exactly doing ? I tried below but giving me an error.

image

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.

Andres thanks for your reply. But, how do I choose unnested columns, sorry being dumbo ?

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

Hello, can anybody pls help R wont show whole rows results how to obtain remaining row s?

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()

Yep thanks for this. This works for the estimates values but why it doesn't work for the below function as I want to get all R-squared values similar way. Thanks a lot!

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

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