[R] Insert .eps files in to an R plot.
Hello Everybody, I have an eps figure an awesome bacteria and a plot (generated using R) also in eps format. Now it looks like there is space for only one figure and I have to insert the picture of the bacteria into the plot. Is there a way to insert figures (eps/png/jpg) in to plots (may be control over placement of figures in the plot as well?) ? By plots I mean data represented using axes and points and such and by figures I mean cartoons, pictures taken by a camera and such. Thanks, MoonStone -- View this message in context: http://n4.nabble.com/Insert-eps-files-in-to-an-R-plot-tp1690704p1690704.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with calculating entropy of data
Thanks Marsh, I'll look in to those references. MS -- View this message in context: http://n4.nabble.com/Help-with-calculating-entropy-of-data-tp1593954p1597963.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with calculating entropy of data
Hello All, My question is not directly related to R but rather on which statistical method I should look in to for capturing the entropy of a data-set as a number. In this figure http://www.twitpic.com/18sob5 are two data sets blue and green (x-axis is time) that fluctuate between (-1,+1). Clearly, green has 4 jumps while blue has 1 (and a some?). Intuitively, green has more entropy than blue. Is there a robust statistical quantity that can capture their relative flexibilities? Additionally I am hoping this method will differentiate between two cases where both spend 50% of time in each of the states -1 and +1 but one has more jumps than the other. I am guessing the limits of that quantity are 0 (no change) and N-1 (for N time steps). Sigma( mod(value(t)-value(t-1))/2 )? I am just thinking out loud here. I have about 200 such plots and I would like to arrange them in order of their entropy. Thanks and I sincerely apologize if you feel this is not the right place to ask this question. MoonStone -- View this message in context: http://n4.nabble.com/Help-with-calculating-entropy-of-data-tp1593954p1593954.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multiple figures margin problem
Hi Greg, This is precisely what I want. xaxt/yaxt='n' did the trick. Thanks for pointing it out. MoonStone -- View this message in context: http://n4.nabble.com/Multiple-figures-margin-problem-tp1490455p1556134.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Multiple figures margin problem
Hello All, I am trying to make a figure with 3x2 plots in it. Let us name the plots as such: 1 2 3 4 5 6 I begin my script with: par(mfcol=c(3,2)) par(oma=c(0,0,0,0)) -- This is for a postscript figure so I really don't need the outer margins. d=5 par(mar=c(d,d,d,d)) -- This applies to all the 6 plots. Now if d=0, plots 1-2,3-4 and 5-6 will have no gap between them and 1-3-5 and 2-4-6 will not have any spacing either. This is how I want it. But I also want y axis points and y label for 1, 3 and 5 and x axis points and labels for 5 and 6. With d=0, there is no space left for these labels. With d=5 (for ex.) I can have the labels but it also introduces a gap of 'd' text lines between the plots. I have tried: par(mar=c(0,d,0,0)) plot 1 par(mar=c(0,d,0,0)) plot 3 par(mar=c(d,d,0,0)) plot 5 par(mar=c(0,0,0,0)) plot 2 par(mar=c(0,0,0,0)) plot 4 par(mar=c(d,0,0,0)) plot 6 But in this approach, the plots are all not of the same size because of differences in margins and I want all the plots to be square and look similar when printed. Do have any comments or suggestions on how to go about doing it? Thanks, MoonStone -- View this message in context: http://n4.nabble.com/Multiple-figures-margin-problem-tp1490455p1490455.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multiple figures margin problem
Hello Greg, I tried that and got a similar result. The axes are still hidden. I am studying R Intro and Fig2A and 3B in http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm . They seem to indicate that the mar parameter alone controls the visibility of axis labels. Am I missing something obvious? MoonStone -- View this message in context: http://n4.nabble.com/Multiple-figures-margin-problem-tp1490455p1490493.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Re-execute previous command
Anita and Greg, Thank you for the useful information. -- View this message in context: http://n4.nabble.com/Re-execute-previous-command-tp1474629p1475397.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re-execute previous command
Hello All, In bash, to re-execute a command, say, 'gnuplot plot.gnu', one can type !gnu. Is there a similar feature in the R console? For example: plot(g1$mean,g2$mean) . . . Lines, many lines of commands -Here I want to repeat the previous plot command. !plot and plot(+TAB) do not work. This question was asked in this forum back in 2006 but the answer seems to have been lost somewhere in their discussions. This is the thread http://n4.nabble.com/R-command-line-need-intelligent-command-history-recall-td793072.html#a793075 . Can some one comment if there is a way to do it? Thank you, MoonStone -- View this message in context: http://n4.nabble.com/Re-execute-previous-command-tp1474629p1474629.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Re-execute previous command
Thanks David, I guess I have to settle with the upper-arrow thing I have been doing all along. My figures do not return any value so ggplot, lattice are out. -- View this message in context: http://n4.nabble.com/Re-execute-previous-command-tp1474629p1474813.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Conditional plot
Hello All, I have the following data set: all [,1] [,2] [1,] 297.04115 286.34645 [2,] 303.94056 270.81590 [3,] 297.87190 290.48009 [4,] 305.81938 304.26238 [5,] 294.92061 92.14025 [6,] 72.09721 304.83084 [7,] 66.53062 279.65700 [8,] 218.46609 318.90179 [9,] 306.55251 295.80110 [10,] 278.48156 269.71947 [11,] 201.24514 277.66272 [12,] 303.93334 296.89303 [13,] 295.89849 81.98786 [14,] 46.82938 74.70764 I would like to plot(all[,1],all[,2]) when all[,2]200. The answer, I am guessing, is embarrassingly simple but I simply cannot figure it out. Please help me. Thanks. -- View this message in context: http://n4.nabble.com/Conditional-plot-tp1473754p1473754.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Conditional plot
Thanks Dennis and David, That is precisely what I was looking for. I will remember to post the data in a readable format in future. Cheers! -- View this message in context: http://n4.nabble.com/Conditional-plot-tp1473754p1473834.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Conditional read-in of data
Hello Jim and Gabor, Thanks for your inputs. The lines: a-as.matrix(read.table(pipe(awk -f cut.awk Data.file))) cut.awk{for(i = 1; i = NF; i=i+10) print $i,} solved my problem. I know that 40k lines is not a large data set. I have about 150 files each of which has 40k rows and in each file I wanted to visualize (basically to ensure nothing odd is going on) how the data behaves in each quarter of the data w/o making 150 figures/pdf files. In future as my data size increases I will consider using relational databases. Thanks again, mnstn Gabor Grothendieck wrote: 1. You can pipe your data through gawk (or other scripting language) process as in: http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2129.html 2. read.csv.sql in the sqldf package on CRAN will set up a database for you, read the file into the database automatically defining the layout of the table, extract a portion into R based on an sql statement that you provide and then destroy the database all in one statement. It uses the sqlite database which is included in the RSQLite R package that it depends on so there is nothing to separately install. See ?read.csv.sql in the package and also see example 13 on the home page: http://sqldf.googlecode.com On Wed, Nov 4, 2009 at 12:07 AM, mnstn pavan.n...@gmail.com wrote: Hello All, I have a 40k rows long data set that is taking a lot of time to be read-in. Is there a way to skip reading even/odd numbered rows or read-in only rows that are multiples of, say, 10? This way I get the general trend of the data w/o actually reading the entire thing. The option 'skip' in read.table simply skips the first n rows and reads the rest. I do understand that once the full data set (40k rows) is read-in, I can manipulate the data. But the bottle-neck here is the first read/scan of data. I searched in the forum using key words (conditional skip/skip reading rows/skip data/conditional data read) etc. but couldn't find relevant conversations. I apologize if this has already been discussed since it does seem hard to imagine that nobody has come across this problem yet. Any suggestions/comments are welcome. Thanks, mnstn -- View this message in context: http://old.nabble.com/Conditional-read-in-of-data-tp26191091p26191091.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://old.nabble.com/Conditional-read-in-of-data-tp26191091p26197793.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Conditional read-in of data
Hello All, I have a 40k rows long data set that is taking a lot of time to be read-in. Is there a way to skip reading even/odd numbered rows or read-in only rows that are multiples of, say, 10? This way I get the general trend of the data w/o actually reading the entire thing. The option 'skip' in read.table simply skips the first n rows and reads the rest. I do understand that once the full data set (40k rows) is read-in, I can manipulate the data. But the bottle-neck here is the first read/scan of data. I searched in the forum using key words (conditional skip/skip reading rows/skip data/conditional data read) etc. but couldn't find relevant conversations. I apologize if this has already been discussed since it does seem hard to imagine that nobody has come across this problem yet. Any suggestions/comments are welcome. Thanks, mnstn -- View this message in context: http://old.nabble.com/Conditional-read-in-of-data-tp26191091p26191091.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Transparent Bands in R
Hello Megha and Jim, Thanks for your comments. The green bands actually correspond to data that looks like: 13 0 42 0 183 0 186 0 187 0 192 0 194 0 and so on. I plotted them using: plot(v[,1],3+v[,2],type=h,col=gray,lwd=5) and the rest of the data using points. The result is here: http://www.twitpic.com/md2li Thanks! Jim Lemon-2 wrote: On 10/21/2009 09:40 AM, mnstn wrote: Hello All, My question is regarding the attached plot. I would like to have multiple transparent green bands running the length (yaxis) of the plot the width of which is determined by the green lines at y=0 in the plot. Can you suggest a way to do it? Hi mnstn, Transparency is only supported by some graphic devices. It may be simpler to plot the values, use rect to draw green rectangles: xylim-par(usr) rect(start1,xylim[3],stop2,xylim[4],col=green) rect(start2,... then redraw the lines over the rectangles using lines. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Transparent-Bands-in-R-tp25983169p25995374.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Transparent Bands in R
Hello All, My question is regarding the attached plot. I would like to have multiple transparent green bands running the length (yaxis) of the plot the width of which is determined by the green lines at y=0 in the plot. Can you suggest a way to do it? For those who can't or are unwilling to download the file the plot is at http://www.twitpic.com/ma8w0 Thanks! http://www.nabble.com/file/p25983169/foo.ps foo.ps -- View this message in context: http://www.nabble.com/Transparent-Bands-in-R-tp25983169p25983169.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.