similar to: help with formula and data= argument

Displaying 20 results from an estimated 10000 matches similar to: "help with formula and data= argument"

2007 Aug 01
1
Problem to remove loops in a routine
Dear R-users, I have written the following code to generate some trellis plots. It works perfectly fine except that it is quite slow when it is apply to my typical datasets (over several thousands of lines). I believe the problem comes from the loops I am using to subset my data.frame. I read in the archives that the tapply function is often more efficient than a loop in R. Unfortunately ,
2010 Jun 13
1
add only selected labels using thigmophobe
hi, I am trying to label data points within a scatter plot using thigmophobe. While the data set consists of about 3000 points I only would like to label a subset of these points. I read the x and y coordinates in from a txt file and define them as: MLPM1<-log2(Ratio.M.L.G2.PM) HLG2<-log2(Ratio.H.L..G2.PM) the names and a corresponding ID are read in from the same txt file as:
2009 Sep 02
1
get function to return object "name"?
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't know how to refer to this generically (the object "name"? I tried
2001 Jan 10
1
eval() bug in plot.formula() ?
I don't have time now to investigate myself, and I'm not feeling like deciding myself if the following is a bug: myplot <- function(dat, cex = 1.2, ...) { if(!is.data.frame(dat <- as.data.frame(dat))) stop("`dat' must be a data.frame") if(any(is.na(match(c("x","y"), names(dat))))) stop("`dat' must have a `x' and a
2009 Feb 05
0
plotrix::thigmophobe could usefully coerce to numeric...
thigmophobe.labels() fails with error when supplied with an array resulting from tapply (example below). The error originates in thigmophobe() I know the help page says 'numeric vector' but it would be kind of nice if it worked with numeric things of class array too. I think it would need no more than a couple of as.numeric() calls in thigmophobe itself, or (simpler but slightly less
2007 Dec 09
1
R + LaTeX formula
Hi, what is actually the best method to include R-plots into LaTeX documents? At the moment i use postscript("myplot.eps", width = 12.0, height = 9.0, horizontal = FALSE, onefile = TRUE, paper = "special",encoding = "TeXtext.enc") plot(foo,bar) dev.off() But it is a bit unhandy to scale later and its difficult to get nice formula in the plots. And how should
2013 Feb 26
1
How to avoid overlapping labels
Hi Remko, thanks for your answer. but i do not really understand how to use the commands. if i want to use thigmophobe.labels(x,y,) do i need to identify the xy coordinates for each point first and then manually move every point? and if i neet to do so how to use the identify() function? or is there any possibility to automatically place the labels in the best position? >MatArab <-
2006 Dec 08
1
lattice: defining an own function using args for "formula" and "groups"
x.fun <- function( formula, data ) dotplot( formula, data ) x.grp <- function( formula, groups, data ) dotplot( formula, groups, data ) data( barley ) > x.fun( variety ~ yield | site, data=barley ) # no problem > dotplot( variety ~ yield | site, groups=year, data=barley ) # no problem > x.grp( variety ~ yield | site, groups=year, data=barley ) object "year" not found
2009 Jul 03
3
Variable names in lattice XY-plot
Hi, how can I get a more descriptive text instead of the variable names in my XY-lattice plot, according to the table below? Variable text acet = "Acetylaspartate Thalamus" chol = "Choline Thalamus" acetp = "Acetylaspartate parieoc" ino = "Inositole Thalamus" I could not find a solution. Please have a look at my syntax. Thanks a lot,
2005 Oct 03
2
grob questions
If I run the following example from: http://www.stat.auckland.ac.nz/~paul/grid/doc/grobs.pdf > grid.newpage() > pushViewport(viewport(w = 0.5, h = 0.5)) > myplot <- gTree(name = "myplot", children = gList(rectGrob(name = "box", + gp = gpar(col = "grey")), xaxisGrob(name = "xaxis"))) > grid.draw(myplot) >
2009 Apr 20
2
plotCI (plotrix) problem
I am attempting to create a plot with intervals "stretched" in the x-direction using plotCI() in the plotrix package. The same data provides an appropriate set of intervals when "stretched" in the y-direction but I only get a lower interval when "stretched" in the x-direction. The data are as follows mns <-
2008 Aug 08
2
gridBase and new.page() / grid.newpage()
Hello all, I'm trying to write a function using the gridBase package. I'd like to push several base subplots to a larger plot constructed with grid. However, I'm having trouble getting consistent results when running the function when the plotting window (quartz) is closed, when it is left open and the plot function is repeated to the same window, and when the output is saved to a
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
2009 May 04
1
ellipsis problem
Hi, I'm confused about the use of ellipsis in function arguments. I'm trying to write a wrapper for plot to automate the combination of plot() and points() calls for a data.frame. Some arguments seem to get passed through to the inner plot, while others cause an error: Error in eval(expr, envir, enclos) : ..1 used in an incorrect context, no ... to look in As a minimal example: tmp
2010 Apr 07
1
ggplot2, density barplot and geom_point layer
Hi, Please consider the example below. How can I manage to overlay the points the way I want in the second case? Thanks, Joh library(ggplot2) # Modify data to match "real" case myDiamonds <- diamonds myDiamonds[["clarity"]] <- as.character(myDiamonds[["clarity"]]) myDiamonds[myDiamonds[["clarity"]]=="I1","clarity"] <- 1
2009 Sep 14
2
How to set default plotting colors by treatment?
Dear R-helpers, I have a number of dataframes that looks something like this: mydfr <- data.frame(treatment=c(rep("A",3),rep("B",3)), Xmeas=1:6, Ymeas=c(2,4,3,3,5,6)) # except with many more variables, which I plot all the time colored by treatment to quickly check things: with(mydfr, plot(Xmeas, Ymeas, pch=19, col=c("blue","red")[treatment])) # I
2010 Dec 17
2
Nested layout()
Hello, Is it possible to call a graphing function that uses layout() multiple times and layout those outputs ? Here's a minimal example : myplot <- function() { layout(matrix(1:2, nrow=1), widths = c(1, 1)) plot(1:10) plot(10:1) } layout(matrix(1:2), heights = c(1, 2)) myplot() myplot() -------------------------------------- Dario Strbenac Research Assistant Cancer Epigenetics Garvan
2007 Jun 14
2
function with xyplot
Hi, I'm a new user trying to switch from SAS, so sorry for the beginner's question: Suppose I have a dataframe DF that contains variables X,Y,Z. I am trying to write a function like this: myplot <- function(varname){xyplot(varname ~ Y, group = Z, data = DF)}. The problem is then how to enter X into my function. If I write myplot("X") I get an error because the argument is a
2000 Aug 17
1
Things I don't understand about the graphics interface
Using R-1.1.1 on RedHatLinux 6.2. I've made some progress, succeeded in outputting bitmap, jpeg, and png files. Yipee. I did them with this command: > dev2bitmap("whatever.bmp",res=300) > dev.print(png, file="myplot.png", width=480, height=480) > dev.print(jpeg, file="myplot.jpg", width=480, height=480) > dev.print(pictex,
2008 Sep 25
2
ggplot, qplot in loop
Dear List, yes, me again trying to work with qplot ;-) I would like to make several single plots within a loop, like this (simplified and so on...): trials <- c("A","B","C") mycolours <- ("wheat","darkolivegreen","lightgreen",