Re: [R] re-direct to "more" or "less"
The first few lines or last few lines of an object can often be viewed like this: head(iris) tail(iris) On 6/28/06, Mike Wolfgang <[EMAIL PROTECTED]> wrote: > Dear list, > > sometimes my function generates too much data and shows them on screen, i > cannot view first several lines until program ends and I have to scroll my > mouse up to get them. Is there any re-direction function in R to pipeline > outputs to "more" or "less" type functions? > Thanks > > mike > >[[alternative HTML version deleted]] > > __ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > __ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
Please read the help before replying ...
page(iris, method="print")
does exactly what I understand was asked for.
On Thu, 29 Jun 2006, Søren Højsgaard wrote:
No - not like page(). Page (on windows) gives
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6,
5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1,
5.4, 5.1, 4.6, 5.1, 4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, .
while the less() function below gives
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
Regards
Søren
-Oprindelig meddelelse-
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne
af Peter Dalgaard
Sendt: 29. juni 2006 10:31
Til: Søren Højsgaard
Cc: Mike Wolfgang; R-help list
Emne: Re: [R] re-direct to "more" or "less"
Søren Højsgaard <[EMAIL PROTECTED]> writes:
Something like
less <- function(a){
fn <- paste(tempdir(),"\\dataframe.txt",sep='',collapse='')
write.table(a, quote=F, file=fn)
system(paste("less ",fn))
}
could perhaps help you (assuming that you have less on your
computer). I agree that it would be very nice to have a
built-in version...
Like page(), you mean... ?
:-)
(This goes via file.show, so Windows GUI users get a separate
window, I suppose.)
Regards
Søren
-Oprindelig meddelelse-
Fra: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] På vegne af
Mike Wolfgang
Sendt: 29. juni 2006 04:29
Til: R-help list
Emne: [R] re-direct to "more" or "less"
Dear list,
sometimes my function generates too much data and shows them on
screen, i cannot view first several lines until program
ends and I
have to scroll my mouse up to get them. Is there any re-direction
function in R to pipeline outputs to "more"
or "less" type functions?
Thanks
mike
[[alternative HTML version deleted]]
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
--
O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph:
(+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX:
(+45) 35327907
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Brian D. Ripley, [EMAIL PROTECTED]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax: +44 1865 272595__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
Søren Højsgaard <[EMAIL PROTECTED]> writes:
> No - not like page(). Page (on windows) gives
>
> structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6,
> 5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1,
> 5.4, 5.1, 4.6, 5.1, 4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, .
>
> while the less() function below gives
>
> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
> 1 5.1 3.5 1.4 0.2 setosa
> 2 4.9 3 1.4 0.2 setosa
> 3 4.7 3.2 1.3 0.2 setosa
> 4 4.6 3.1 1.5 0.2 setosa
>
If all else fails, read the manual...: page() has a method= argument.
(It might not be a bad idea to switch the default, though).
> > -Oprindelig meddelelse-
> > Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne
> > af Peter Dalgaard
> > Sendt: 29. juni 2006 10:31
> > Til: Søren Højsgaard
> > Cc: Mike Wolfgang; R-help list
> > Emne: Re: [R] re-direct to "more" or "less"
> >
> > Søren Højsgaard <[EMAIL PROTECTED]> writes:
> >
> > > Something like
> > >
> > > less <- function(a){
> > > fn <- paste(tempdir(),"\\dataframe.txt",sep='',collapse='')
> > > write.table(a, quote=F, file=fn)
> > > system(paste("less ",fn))
> > > }
> > >
> > > could perhaps help you (assuming that you have less on your
> > computer). I agree that it would be very nice to have a
> > built-in version...
> >
> >
> > Like page(), you mean... ?
> >
> > :-)
> >
> > (This goes via file.show, so Windows GUI users get a separate
> > window, I suppose.)
> >
> > > Regards
> > > Søren
> > >
> > >
> > >
> > > > -Oprindelig meddelelse-
> > > > Fra: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] På vegne af
> > Mike Wolfgang
> > > > Sendt: 29. juni 2006 04:29
> > > > Til: R-help list
> > > > Emne: [R] re-direct to "more" or "less"
> > > >
> > > > Dear list,
> > > >
> > > > sometimes my function generates too much data and shows them on
> > > > screen, i cannot view first several lines until program
> > ends and I
> > > > have to scroll my mouse up to get them. Is there any re-direction
> > > > function in R to pipeline outputs to "more"
> > > > or "less" type functions?
> > > > Thanks
> > > >
> > > > mike
> > > >
> > > > [[alternative HTML version deleted]]
> > > >
> > > > __
> > > > [email protected] mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide!
> > > > http://www.R-project.org/posting-guide.html
> > > >
> > >
> > > __
> > > [email protected] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html
> > >
> >
> > --
> >O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B
> > c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> > (*) \(*) -- University of Copenhagen Denmark Ph:
> > (+45) 35327918
> > ~~ - ([EMAIL PROTECTED]) FAX:
> > (+45) 35327907
> >
>
--
O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
No - not like page(). Page (on windows) gives
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6,
5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1,
5.4, 5.1, 4.6, 5.1, 4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, .
while the less() function below gives
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
Regards
Søren
> -Oprindelig meddelelse-
> Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne
> af Peter Dalgaard
> Sendt: 29. juni 2006 10:31
> Til: Søren Højsgaard
> Cc: Mike Wolfgang; R-help list
> Emne: Re: [R] re-direct to "more" or "less"
>
> Søren Højsgaard <[EMAIL PROTECTED]> writes:
>
> > Something like
> >
> > less <- function(a){
> > fn <- paste(tempdir(),"\\dataframe.txt",sep='',collapse='')
> > write.table(a, quote=F, file=fn)
> > system(paste("less ",fn))
> > }
> >
> > could perhaps help you (assuming that you have less on your
> computer). I agree that it would be very nice to have a
> built-in version...
>
>
> Like page(), you mean... ?
>
> :-)
>
> (This goes via file.show, so Windows GUI users get a separate
> window, I suppose.)
>
> > Regards
> > Søren
> >
> >
> >
> > > -Oprindelig meddelelse-
> > > Fra: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] På vegne af
> Mike Wolfgang
> > > Sendt: 29. juni 2006 04:29
> > > Til: R-help list
> > > Emne: [R] re-direct to "more" or "less"
> > >
> > > Dear list,
> > >
> > > sometimes my function generates too much data and shows them on
> > > screen, i cannot view first several lines until program
> ends and I
> > > have to scroll my mouse up to get them. Is there any re-direction
> > > function in R to pipeline outputs to "more"
> > > or "less" type functions?
> > > Thanks
> > >
> > > mike
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > [email protected] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html
> > >
> >
> > __
> > [email protected] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
> --
>O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen Denmark Ph:
> (+45) 35327918
> ~~ - ([EMAIL PROTECTED]) FAX:
> (+45) 35327907
>
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
Søren Højsgaard <[EMAIL PROTECTED]> writes:
> Something like
>
> less <- function(a){
> fn <- paste(tempdir(),"\\dataframe.txt",sep='',collapse='')
> write.table(a, quote=F, file=fn)
> system(paste("less ",fn))
> }
>
> could perhaps help you (assuming that you have less on your computer). I
> agree that it would be very nice to have a built-in version...
Like page(), you mean... ?
:-)
(This goes via file.show, so Windows GUI users get a separate window,
I suppose.)
> Regards
> Søren
>
>
>
> > -Oprindelig meddelelse-
> > Fra: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] På vegne af Mike Wolfgang
> > Sendt: 29. juni 2006 04:29
> > Til: R-help list
> > Emne: [R] re-direct to "more" or "less"
> >
> > Dear list,
> >
> > sometimes my function generates too much data and shows them
> > on screen, i cannot view first several lines until program
> > ends and I have to scroll my mouse up to get them. Is there
> > any re-direction function in R to pipeline outputs to "more"
> > or "less" type functions?
> > Thanks
> >
> > mike
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > [email protected] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
> __
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
Something like
less <- function(a){
fn <- paste(tempdir(),"\\dataframe.txt",sep='',collapse='')
write.table(a, quote=F, file=fn)
system(paste("less ",fn))
}
could perhaps help you (assuming that you have less on your computer). I agree
that it would be very nice to have a built-in version...
Regards
Søren
> -Oprindelig meddelelse-
> Fra: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] På vegne af Mike Wolfgang
> Sendt: 29. juni 2006 04:29
> Til: R-help list
> Emne: [R] re-direct to "more" or "less"
>
> Dear list,
>
> sometimes my function generates too much data and shows them
> on screen, i cannot view first several lines until program
> ends and I have to scroll my mouse up to get them. Is there
> any re-direction function in R to pipeline outputs to "more"
> or "less" type functions?
> Thanks
>
> mike
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] re-direct to "more" or "less"
maybe ?sink() or ?capture.output() could be useful, in this case. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Mike Wolfgang" <[EMAIL PROTECTED]> To: "R-help list" Sent: Thursday, June 29, 2006 4:28 AM Subject: [R] re-direct to "more" or "less" > Dear list, > > sometimes my function generates too much data and shows them on > screen, i > cannot view first several lines until program ends and I have to > scroll my > mouse up to get them. Is there any re-direction function in R to > pipeline > outputs to "more" or "less" type functions? > Thanks > > mike > > [[alternative HTML version deleted]] > > __ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
