similar to: show and produce PDF file with pdf() and dev.off( ) in function

Displaying 20 results from an estimated 3000 matches similar to: "show and produce PDF file with pdf() and dev.off( ) in function"

2007 Nov 16
1
graphics - line resolution/pixelation going from R to windows metafile
I have a recurring graphics issue that I've not been able to resolve with R. If I make a series of regression estimates and then plot the estimated function for the regression lines over a scatter plot of the data, e.g., using a sequence of plot( ) and lines ( ) similar to those below
2013 Mar 12
1
Fine control of plot
Hi everyone. I'm trying to create a graph where I could plot some lines on the right side. Here an example: layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(6,2), heights=c(1,1)) x = 1:100y = rnorm(x)+xplot(x,y) reg = lm(y~x)abline(reg, col = "red") plot(1, type="n", axes=F, xlab="", ylab="", xlim = c(-1,1), ylim = c(min(y),
2010 Apr 25
1
How to save as PDF when I used par(ask=T)
====================================================== y=c(9,9,17,11,7,8,15,5) treat=c("A","C","B","C","D","A","B","D") block=c(1,1,2,2,2,3,3,3) q1.mod=aov(y~as.factor(treat)+as.factor(block)) q1.mod summary(q1.mod) par(ask=T) plot(TukeyHSD(q1.mod)) ======================================================= This way,
2005 Mar 09
3
function in order to plot the same graph to postscript and pdf
Hi, I've written a function in order to plot the same graph in a postcript and in a pdf file. Unfortunately, the second graph is always empty, i.e.: plot.both <- function{myplot, filename}{ pdf(file=paste(filename, ".pdf", sep="")) myplot dev.off() postscript(file=paste(filename, ".eps", sep="")) myplot dev.off() } yields in a
2010 Nov 20
3
how to add frequencies to barplot
Hi, I have count data x2=rep(c(0:3),c(13,80,60,27)) x2 0 1 2 3 13 80 60 27 I want to graph to be ploted as barplot(table(x2),density=4) how do I add relative frequency to it, like in hist(x2,labels=T) above the 'bar's Thanks. casper -- View this message in context: http://r.789695.n4.nabble.com/how-to-add-frequencies-to-barplot-tp3051923p3051923.html Sent from the R help
2004 Apr 15
1
tapply() and barplot() help files for 1.8.1
Hi, I've just upgraded to 1.9.0 and one of my Sweave files that produces a number of barplots in a standard manner now produces them in a different way. I have made a couple of small changes to my code to get the back the output I was getting before upgrading and now (mostly out of curiosity) would like to understand what has changed. I *think* I've tracked it down to tapply() and/or
2010 Nov 28
4
how to divide each column in a matrix by its colSums?
Hi, I have a matrix, say m=matrix(c( 983,679,134, 383,416,84, 2892,2625,570 ),nrow=3 ) i can find its row/col sum by rowSums(m) colSums(m) How do I divide each row/column by its rowSum/colSums and still return in the matrix form? (i.e. the new rowSums/colSums =1) Thanks. Casper -- View this message in context:
2010 Nov 08
3
how do i plot this "hist"?
Hi all, I have the following data in abc.dat ======================= 50 0 1 0 0 55 1 14 0 1 60 7 86 0 3 65 22 324 2 3 70 58 1035 1 7 75 30 2568 0 34 80 9 2936 15 162 85 27 2169 46 365 90 80 1439 212 432 95 236 1670 521 281 100 332 827 709 172 105 156 311 556
2010 Dec 18
3
use of 'apply' for 'hist'
Hi all, ########################################## dof=c(1,2,4,8,16,32) Q5=matrix(rt(100,dof),100,6,T,dimnames=list(NULL,dof)) par(mfrow=c(2,6)) apply(Q5,2,hist) myf=function(x){ qqnorm(x);qqline(x) } apply(Q5,2,myf) ########################################## These looks ok. However, I would like to achieve more. Apart from using a loop, is there are fast way to 'add' the titles to be
2010 Apr 13
3
writing function ( 'plot' and 'if') problem
=========================== myf=function(ds=1){ x=rnorm(10) y=rnorm(10) { #start of if if (ds==1) { list(x,y) } else (ds==2) { plot(x,y) } } # end of if } # end of function =========================== Hi All, the problem i am having here is, that I want to be able to control the display, lf ds=1, i want to just have a list, but it seem to always plot... Thanks. casper -- View this
2010 Mar 07
3
barplot with factors problem
http://www.harding.edu/fmccown/R/#autosdatafile http://www.harding.edu/fmccown/R/#autosdatafile I am tring to get a barchat by factors, following the example in that link above. =========================== x=c(145,40,40,120,180, 140,155,90,160,95, 195,150,205,110,160, 45,40,195,65,145, 195,230,115,235,225, 120,55,50,80,45 ) y2=c( rep(as.character(1),5), rep(as.character(2),5),
2009 Dec 07
5
confint for glm (general linear model)
Hi, I have a glm gives summary as follows, Estimate Std. Error z value Pr(>|z|) (Intercept) -2.03693352 1.449574526 -1.405194 0.159963578 A 0.01093048 0.006446256 1.695633 0.089955471 N 0.41060119 0.224860819 1.826024 0.067846690 S -0.20651005 0.067698863 -3.050421 0.002285206 then I use confint(k.glm)
2013 Jan 04
1
group variables in classes
Dear R users, I want to group the d values in classes. If I use this script I have a problem. classes <- function(x, n){ s <- seq(0, ceiling(max(x)), by = n) factor(n*findInterval(x, s), levels = s) } z<-sapply(tapply(t$d,t$plot,function(x) classes(t$d, 4)),table) z<-cbind(z) Thank you! Initial data: nr x y d plot plotn xplot yplot 121 162 50.26989 46.230
2010 Nov 16
3
plot linear model problem
Hi all, Say I fit a linear model, and saved it as 'test.lm' Then if I use plot(test.lm) it gives me 4 graphs How do I ask for a 'subset' of it?? say just want the 1st graph, the residual vs fitted values, or the 1,3,4th graph? I think I can use plot(test.lm[c(1,3,4)]) before, but now, it's not working... Every time, it goes to the end, the only thing I can click is
2011 Aug 02
1
Need to compute density as done by panel.histogram
Hi, This might be a simple problem but I don't know how to calculate a random variable density the way panel.histogram does it before it creates the actual density rectangles. The documentation says that it uses the density function but the actual code suggests that the hist.constructor function (which does not seem to be easily accessible). Any suggestion for computing the density values of
2012 Mar 23
3
R numerical integration
Hi all, Is there any other packages to do numerical integration other than the default 'integrate'? Basically, I am integrating: integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value The integration is ok provided sigma is >0. However, when mu=-1.645074 and sigma=17535.26 It stopped working. On the other hand, Maple gives me a value of 0.5005299403. It is an
2010 Nov 10
1
par mfrow in "function" problem
Hi all, I defined the following ############################# myhist=function(x){ hist(x,xlab="",main="") h=hist(x) xfit=seq(min(x),max(x),length=100) yfit=dnorm(xfit,mean(x),sd=sd(x)) yfit=yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col="blue", lwd=2) } ############################# individually, it worked fine however, if I used par(mfrow=c(2,2))
2010 Dec 21
3
how to see what's wrong with a self written function?
Hi all, I am writing a simple function to implement regularfalsi (secant) method. ################################################### regulafalsi=function(f,x0,x1){ x=c() x[1]=x1 i=1 while ( f(x[i])!=0 ) { i=i+1 if (i==2) { x[2]=x[1]-f(x[1])*(x[1]-x0)/(f(x[1])-f(x0)) } else { x[i]=x[i-1]-f(x[i-1])*(x[i-1]-x[i-2])/(f(x[i-1])-f(x[i-2])) } } x[i] }
2010 Apr 10
1
writing function (plot problem)
Hi, ======================= x=rnorm(20) y=rnorm(20) t=lm(y~x) plot(t) ======================= you will get "click or hit enter to next page..." how do I write a function to archieve this ? say plot(x,y) then pause, wait plot(y,x) Thanks! casper -- View this message in context: http://n4.nabble.com/writing-function-plot-problem-tp1835723p1835723.html Sent from the R help mailing
2010 Dec 08
1
how to add these "axis" label?
Hi All, How do I add these axis labels? ############################################### p=seq(0,1,length.out=500) p=p[-c(1,length(p))] g1=log(p/(1-p)) g2=qnorm(p) g3=log(-log(1-p)) g4=-log(-log(p)) plot(p,g1, 'n',ylim=c(-5,5),las=1, bty='n', xaxt='n',yaxt='n', xlab="",ylab="" ) lines(p,g1,lty=1,col=1) lines(p,g2,lty=1,col=2)