-1

I have a list composed of different data frame of different lenghts (they have also different columns). I did some tests with something found in the threads where they spoke about a similar problem: but all that approaches seem to list where the components have same lenthts, I tried different approaches no one of them worked:

example:

x <- rnorm(10)
y <- data.frame( z = c(a,b,d), l = c(1,2,3))
mylist <- list(x,y)


lapply(mylist, function(x) write.table( data.frame(x), 'test.csv'  , append= T, sep=',' ))

and

write.table(as.data.frame(mylist),file="mylist.csv", quote=F,sep=",",row.names=F)

that is actually what I got from both tests:

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 490, 499, 491, 1, 9, 0, 427, 495, 432, 5, 68

then:

capture.output(summary(mylist), file = "My New File.txt")
cat(capture.output(print(my.list), file="test.txt")

these actually worked better, but the text file just contain the first rows and when I am opening the csv file in the excel I got this after some lines:

reached getOption("max.prin t") -- omitted 240 rows ]

How I could do?

thank you for your help

Salvo R
  • 31
  • 7
  • You should provide some sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to make it clear what your data looks like and what exactly the desired output is. What error did your first line of code generate? Do all your data.frames have the exact same columns? – MrFlick Nov 27 '17 at 16:37

1 Answers1

0

If you are looking for a quick and dirty fix with printing out the full lines, use the options command.

E.g. options("max.print"=1000000).

Edit: However, if your total count of lines exceedes this value, they will not be printed, instead the reached getOption("max.print") -- omitted XYZ rows ] will be displayed when max is reached.

You can check how many lines your print will print out by running the command options("max.print"), so you can verify that you actually changed this internal value.

chrisFix
  • 30
  • 6
  • if I understood well, you mean like: capture.output(summary(mylist), file = "My New File.txt0", ptions(max.print=1000000) )? – Salvo R Nov 27 '17 at 16:44
  • actually, the `max.print` is an internal option that can be modified in your R Client before you use the actual `print()`, so the function will print more lines than the previously set value. The higher you set the value, the more lines it will print. Type `options("max.print"=1000000)` in your R Client, hit Enter and the option is modified, then try running your command again and see if it still omitts lines. – chrisFix Nov 27 '17 at 17:13