Questions about R on linux
4
0
Entering edit mode
Steve Lee ▴ 30
@steve-lee-1297
Last seen 10.2 years ago
have two questions. when i do fix() it brings up my data in vi is there a way to make it bring up the data in more of a spreadsheet like format like it does in the windows version? also, is there a way to save a plot to a file? i've tried dev.print and dev.copy to no avail. thank you very much.
• 1.4k views
ADD COMMENT
0
Entering edit mode
Jeff Gentry ★ 3.9k
@jeff-gentry-12
Last seen 10.2 years ago
> when i do > fix() > it brings up my data in vi > is there a way to make it bring up the data in more of a spreadsheet > like format like it does in the windows version? The fix() function is just keying off of your EDITOR environment variable, so changing your EDITOR variable to the editor of your choice (e.g. emacs, pico, nedit, etc) should do it for you.
ADD COMMENT
0
Entering edit mode
@saroj-mohapatra-847
Last seen 10.2 years ago
> > is there a way to save a plot to a file? i've tried dev.print and > dev.copy to no avail. > jpeg(file="my.jpg") plot(rnorm(100)) dev.off() The plot of random numbers have been saved to a file called my.jpg -- Saroj
ADD COMMENT
0
Entering edit mode
You can also use postscript instead of jpeg. Use ?postscript for more detail. Ting-Yuan On Mon, 20 Jun 2005, Saroj Mohapatra wrote: > > > > is there a way to save a plot to a file? i've tried dev.print and > > dev.copy to no avail. > > > > jpeg(file="my.jpg") > plot(rnorm(100)) > dev.off() > > The plot of random numbers have been saved to a file called my.jpg > > -- Saroj > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor >
ADD REPLY
0
Entering edit mode
@kasper-daniel-hansen-1306
Last seen 10.2 years ago
The editor you bring up in R is set either through the options(editor = ...) command or by setting your R_EDITOR environment variable. The last thing you can do in several ways, but an easy way is to create a file in your home directory called ~/.Renviron and in that file have a line like R_EDITOR=/usr/bin/nano or something. I do not think that linux has the options of a spreadsheet like interface to data interogation, but I never use it anyway, so I may be completely out of phase. If it has it might be using "gnumeric" which is an oss spreadsheet. Saving a plot: one way is to plot sirectly to the device, such as pdf(file = "test.pdf") ## opens a pdf file plot(1:10, 1:10) ## make a plot dev.off() ## close the device Another way is to use dev.copy, try eg. dev.copy2eps(file = "test.eps") ## copying directly to an eps file Kasper On Mon, 20 Jun 2005, Steve Lee wrote: > have two questions. > > when i do > fix() > > it brings up my data in vi > > is there a way to make it bring up the data in more of a spreadsheet > like format like it does in the windows version? > > > also, > > is there a way to save a plot to a file? i've tried dev.print and > dev.copy to no avail. > > thank you very much. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor >
ADD COMMENT
0
Entering edit mode
Jan T. Kim ▴ 70
@jan-t-kim-1050
Last seen 10.2 years ago
On Mon, Jun 20, 2005 at 12:40:01PM -0400, Steve Lee wrote: > have two questions. > > when i do > fix() > > it brings up my data in vi > > is there a way to make it bring up the data in more of a spreadsheet > like format like it does in the windows version? > > > also, > > is there a way to save a plot to a file? i've tried dev.print and > dev.copy to no avail. One standard way is to use the postscript device: postscript("myplot.ps"); plot(1:10, sqrt(1:10)); dev.off(); Don't forget / omit the dev.off() call when done, otherwise the file may be incomplete (unflushed). With (e.g.) postscript("myplot.eps", width=8, height=6, onefile=FALSE, horizontal=FALSE); you can create nice EPS files, suitable for inclusion in LaTeX... Best regards, Jan -- +- Jan T. Kim -------------------------------------------------------+ | *NEW* email: jtk at cmp.uea.ac.uk | | *NEW* WWW: http://www.cmp.uea.ac.uk/people/jtk | *-----=< hierarchical systems are for files, not for humans >=-----*
ADD COMMENT
0
Entering edit mode
Jan T. Kim wrote: > On Mon, Jun 20, 2005 at 12:40:01PM -0400, Steve Lee wrote: > >>have two questions. >> >>when i do >>fix() >> >>it brings up my data in vi >> >>is there a way to make it bring up the data in more of a spreadsheet >>like format like it does in the windows version? >> >> >>also, >> >>is there a way to save a plot to a file? i've tried dev.print and >>dev.copy to no avail. > > > One standard way is to use the postscript device: > > postscript("myplot.ps"); > plot(1:10, sqrt(1:10)); > dev.off(); > > Don't forget / omit the dev.off() call when done, otherwise the file may > be incomplete (unflushed). > > With (e.g.) > > postscript("myplot.eps", width=8, height=6, onefile=FALSE, horizontal=FALSE); > > you can create nice EPS files, suitable for inclusion in LaTeX... I think you forgot 'paper="special"' (see ?postscript). Since I always forget myself, I use the following wrapper eps <- function(file="Rplot%03d.eps", onefile=FALSE, horizontal=FALSE, paper="special", ...) { postscript(file=file, onefile=onefile, horizontal=horizontal, paper=paper, ...) } with use: eps("myplot.eps") plot(1:10, sqrt(1:10)) dev.off() Henrik Bengtsson > > Best regards, Jan
ADD REPLY

Login before adding your answer.

Traffic: 874 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6