Вопрос

I have code that is doing this:

sapply(unique(groups.50),function(g)data$SEQUENCE_ID[groups.50 == g])

But in the RGui window, I can only scroll up to see some of the results. The first 10 or so doesn't show in the window (probably because my data is so large). How do I get it to show all of it, or alternatively, how do I print the first 10 results?

Thanks.

Это было полезно?

Решение

For scrolling through large datasets, the page function with method='print' is also pretty handy. It has the added benefit of not cluttering your command history with output.

Другие советы

Assuming your output of your function is a vector, save it to an object and then subset:

a <- sapply(unique(groups.50),function(g)data$SEQUENCE_ID[groups.50 == g])
a[1:10]

Or use head:

head(sapply(unique(groups.50),function(g)data$SEQUENCE_ID[groups.50 == g]),n=10)

You might try

x<-sapply(unique(groups.50),function(g)data$SEQUENCE_ID[groups.50 == g])
head(x)

But you should probably be using tapply instead?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top