Is there an equivalent to the unix less
command that can be used within the R console?
To run an R command, put the cursor on the line of the command and then click the Run button at the top of the file window. Or just press CTRL-Enter.
In RStudio, this command line interaction occurs in the command console. R is an interpreted programming language. This means that R will interpret each line of code as it is entered and, if it is valid, R will execute it, returning the result in the command console.
less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to more, but has the extended capability of allowing both forward and backward navigation through the file.
The UNIX “r” commands enable users to issue commands on their local machines that run on the remote host. These commands include the following: rcp.
There is also page()
which displays a representation of an object in a pager, like less.
dat <- data.frame(matrix(rnorm(1000), ncol = 10)) page(dat, method = "print")
Not really. There are the commands
head()
and tail()
for showing the beginning and end of objectsprint()
for explicitly showing an object, and just its name followed by return does the samesummary()
for concise summary that depends on the objectstr()
for its structureand more. An equivalent for less
would be a little orthogonal to the language and system. Where the Unix shell offers you less
to view the content of a file (which is presumed to be ascii-encoded), it cannot know about all types.
R is different in that it knows about the object types which is why summary()
-- as well as the whole modeling framework -- are more appropriate.
Follow-up edit: Another possibility is provided by edit()
as well as edit.data.frame()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With