How to plot an R table in Linux terminal
up vote
0
down vote
favorite
I have a text file that I converted into a numeric vector:
numbers <- scan("list_of_numbers.txt")
I then put it into a table:
t <- table(numbers)
Which outputs like this:
1 2 3 4 5 6 7 8 9 10 11
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255
12 13 14 15 16 17 18 19 20 21 22
41934 24506 13778 7179 3646 1778 816 436 217 114 74
23 24 25 26 27 28 29 30 31 32 33
49 44 26 21 19 21 20 14 9 17 14
34 35 36 37 38 39 40 41 42 43 44
7 11 9 14 3 5 8 4 4 2 3
45 46 47 55 56 60 62 63 69 70 72
2 1 2 2 2 1 1 1 3 2 1
78 82 85 93 95 114 125 265 331 350
1 1 1 1 1 1 1 1 1 1
How would I plot a line graph with x axis of numbers 1 - 25 and y axis the frequency values of the x axis all in the terminal window?
In addition, how can a plot like this (which is default saved as a .pdf file) be viewd in the linux terminal?
Most commands like less, cat, and xdg-open output a bunch of strange unreadable symbols.
I am working over in an ssh server.
linux r
add a comment |
up vote
0
down vote
favorite
I have a text file that I converted into a numeric vector:
numbers <- scan("list_of_numbers.txt")
I then put it into a table:
t <- table(numbers)
Which outputs like this:
1 2 3 4 5 6 7 8 9 10 11
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255
12 13 14 15 16 17 18 19 20 21 22
41934 24506 13778 7179 3646 1778 816 436 217 114 74
23 24 25 26 27 28 29 30 31 32 33
49 44 26 21 19 21 20 14 9 17 14
34 35 36 37 38 39 40 41 42 43 44
7 11 9 14 3 5 8 4 4 2 3
45 46 47 55 56 60 62 63 69 70 72
2 1 2 2 2 1 1 1 3 2 1
78 82 85 93 95 114 125 265 331 350
1 1 1 1 1 1 1 1 1 1
How would I plot a line graph with x axis of numbers 1 - 25 and y axis the frequency values of the x axis all in the terminal window?
In addition, how can a plot like this (which is default saved as a .pdf file) be viewd in the linux terminal?
Most commands like less, cat, and xdg-open output a bunch of strange unreadable symbols.
I am working over in an ssh server.
linux r
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a text file that I converted into a numeric vector:
numbers <- scan("list_of_numbers.txt")
I then put it into a table:
t <- table(numbers)
Which outputs like this:
1 2 3 4 5 6 7 8 9 10 11
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255
12 13 14 15 16 17 18 19 20 21 22
41934 24506 13778 7179 3646 1778 816 436 217 114 74
23 24 25 26 27 28 29 30 31 32 33
49 44 26 21 19 21 20 14 9 17 14
34 35 36 37 38 39 40 41 42 43 44
7 11 9 14 3 5 8 4 4 2 3
45 46 47 55 56 60 62 63 69 70 72
2 1 2 2 2 1 1 1 3 2 1
78 82 85 93 95 114 125 265 331 350
1 1 1 1 1 1 1 1 1 1
How would I plot a line graph with x axis of numbers 1 - 25 and y axis the frequency values of the x axis all in the terminal window?
In addition, how can a plot like this (which is default saved as a .pdf file) be viewd in the linux terminal?
Most commands like less, cat, and xdg-open output a bunch of strange unreadable symbols.
I am working over in an ssh server.
linux r
I have a text file that I converted into a numeric vector:
numbers <- scan("list_of_numbers.txt")
I then put it into a table:
t <- table(numbers)
Which outputs like this:
1 2 3 4 5 6 7 8 9 10 11
621266 496647 436229 394595 353249 305882 253983 199455 147380 102872 67255
12 13 14 15 16 17 18 19 20 21 22
41934 24506 13778 7179 3646 1778 816 436 217 114 74
23 24 25 26 27 28 29 30 31 32 33
49 44 26 21 19 21 20 14 9 17 14
34 35 36 37 38 39 40 41 42 43 44
7 11 9 14 3 5 8 4 4 2 3
45 46 47 55 56 60 62 63 69 70 72
2 1 2 2 2 1 1 1 3 2 1
78 82 85 93 95 114 125 265 331 350
1 1 1 1 1 1 1 1 1 1
How would I plot a line graph with x axis of numbers 1 - 25 and y axis the frequency values of the x axis all in the terminal window?
In addition, how can a plot like this (which is default saved as a .pdf file) be viewd in the linux terminal?
Most commands like less, cat, and xdg-open output a bunch of strange unreadable symbols.
I am working over in an ssh server.
linux r
linux r
edited Nov 19 '14 at 13:39
Der Hochstapler
66.9k48230283
66.9k48230283
asked Jun 10 '14 at 18:04
Sean
10112
10112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Do you want an ASCII plot (i.e. it will show up in a terminal)? A plot over X11? The output device is important (as R can plot to many different devices).
If you are forwarding X11 via ssh and have R in an interactive session, then:
plot(t[1:24], type = "l")
should get you a basic line plot in a new X11 window. Do a ?plot
in R for more options on tweaking the format.
You can deliberately try to plot it to X11 if that doesn't work with:
x11(width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
If you don't have X11 up or forwarding, you can get a basic points plot in-ASCII terminal with the txtplot
function from the txtplot
package.
Similarly, there is a PDF device in R as well that works the same was as the X11 example above, but will generate output to a file:
pdf(file = "filenameyoudesire.pdf", width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
There are other methods of plotting and formatting plots, but this should get you started.
Also, despite R being intelligent enough to understand the difference, t
is also a built-in function name (do a ?t
in R to see what it does) so you should really avoid using it for a variable name.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Do you want an ASCII plot (i.e. it will show up in a terminal)? A plot over X11? The output device is important (as R can plot to many different devices).
If you are forwarding X11 via ssh and have R in an interactive session, then:
plot(t[1:24], type = "l")
should get you a basic line plot in a new X11 window. Do a ?plot
in R for more options on tweaking the format.
You can deliberately try to plot it to X11 if that doesn't work with:
x11(width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
If you don't have X11 up or forwarding, you can get a basic points plot in-ASCII terminal with the txtplot
function from the txtplot
package.
Similarly, there is a PDF device in R as well that works the same was as the X11 example above, but will generate output to a file:
pdf(file = "filenameyoudesire.pdf", width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
There are other methods of plotting and formatting plots, but this should get you started.
Also, despite R being intelligent enough to understand the difference, t
is also a built-in function name (do a ?t
in R to see what it does) so you should really avoid using it for a variable name.
add a comment |
up vote
0
down vote
Do you want an ASCII plot (i.e. it will show up in a terminal)? A plot over X11? The output device is important (as R can plot to many different devices).
If you are forwarding X11 via ssh and have R in an interactive session, then:
plot(t[1:24], type = "l")
should get you a basic line plot in a new X11 window. Do a ?plot
in R for more options on tweaking the format.
You can deliberately try to plot it to X11 if that doesn't work with:
x11(width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
If you don't have X11 up or forwarding, you can get a basic points plot in-ASCII terminal with the txtplot
function from the txtplot
package.
Similarly, there is a PDF device in R as well that works the same was as the X11 example above, but will generate output to a file:
pdf(file = "filenameyoudesire.pdf", width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
There are other methods of plotting and formatting plots, but this should get you started.
Also, despite R being intelligent enough to understand the difference, t
is also a built-in function name (do a ?t
in R to see what it does) so you should really avoid using it for a variable name.
add a comment |
up vote
0
down vote
up vote
0
down vote
Do you want an ASCII plot (i.e. it will show up in a terminal)? A plot over X11? The output device is important (as R can plot to many different devices).
If you are forwarding X11 via ssh and have R in an interactive session, then:
plot(t[1:24], type = "l")
should get you a basic line plot in a new X11 window. Do a ?plot
in R for more options on tweaking the format.
You can deliberately try to plot it to X11 if that doesn't work with:
x11(width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
If you don't have X11 up or forwarding, you can get a basic points plot in-ASCII terminal with the txtplot
function from the txtplot
package.
Similarly, there is a PDF device in R as well that works the same was as the X11 example above, but will generate output to a file:
pdf(file = "filenameyoudesire.pdf", width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
There are other methods of plotting and formatting plots, but this should get you started.
Also, despite R being intelligent enough to understand the difference, t
is also a built-in function name (do a ?t
in R to see what it does) so you should really avoid using it for a variable name.
Do you want an ASCII plot (i.e. it will show up in a terminal)? A plot over X11? The output device is important (as R can plot to many different devices).
If you are forwarding X11 via ssh and have R in an interactive session, then:
plot(t[1:24], type = "l")
should get you a basic line plot in a new X11 window. Do a ?plot
in R for more options on tweaking the format.
You can deliberately try to plot it to X11 if that doesn't work with:
x11(width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
If you don't have X11 up or forwarding, you can get a basic points plot in-ASCII terminal with the txtplot
function from the txtplot
package.
Similarly, there is a PDF device in R as well that works the same was as the X11 example above, but will generate output to a file:
pdf(file = "filenameyoudesire.pdf", width = 8, height = 8)
plot(t[1:24], type = "l")
dev.off()
There are other methods of plotting and formatting plots, but this should get you started.
Also, despite R being intelligent enough to understand the difference, t
is also a built-in function name (do a ?t
in R to see what it does) so you should really avoid using it for a variable name.
answered Jun 11 '14 at 11:03
hrbrmstr
1614
1614
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f767047%2fhow-to-plot-an-r-table-in-linux-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown