similar to: use ggplot in a function to which a column name is given

Displaying 20 results from an estimated 5000 matches similar to: "use ggplot in a function to which a column name is given"

2007 Sep 20
1
ggplot and xlim/ylim
Hello everyone, I am (happily) using ggplot2 for all my plotting now and I wondered is there is an easy way to specify xlim and ylim somewhere when using the ggplot syntax, as opposed to the qplot syntax. Eg. qplot(data=mtcars,y=wt, x=qsec,xlim=c(0,30)) <-> ggplot(mtcars, aes(y=wt, x=qsec)) + geom_point() + ??? Indeed the ggplot syntax is in general more flexible and powerful and
2009 Mar 05
1
Using vectors of names in calls for functions
Dear R people, it is a pleasure to try and use functionnalities that are in ggplot, even with my poor capacities in R. so far, i'dlike to be able to use these in my own function, and to "be able to use it repeatedly from vectors where I store the names of my columns." I have understood that this is a very discussed topic, that many post have been exhanged but I cannot understand
2006 Apr 11
2
About list to list - thanks
Thank you very much for your useful suggestions. These are exactly what I was looking for. foo <- list(foo1, foo2, foo3) lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE)) or lapply(foo, function(x) do.call('rbind', x)) Best, Muhammad Subianto On 4/11/06, Muhammad Subianto <msubianto at gmail.com> wrote: > Dear all, > I have a result my experiment
2006 Apr 11
2
About list to list
Dear all, I have a result my experiment like this below (here my toy example): foo1 <- list() foo1[[1]] <- c(10, 20, 30) foo1[[2]] <- c(11, 21, 31) foo2 <- list() foo2[[1]] <- c(100, 200, 300) foo2[[2]] <- c(110, 210, 310) foo3 <- list() foo3[[1]] <- c(1000, 2000, 3000) foo3[[2]] <- c(1100, 2100, 3100) list(foo1,foo2,foo3) The result: > list(foo1,foo2,foo3) [[1]]
2008 Mar 25
1
Passing (Optional) Arguments
Dear List: In short, I am writing a number of functions as building blocks for other functions and have some questions about scoping and passing arguments. Suppose I have functions foo1, foo2, and foo3 such that: foo1<-function(a=1,b=TRUE,c=FALSE){#do stuff}; foo2<-function(x=1,y=FALSE,z=c(1,2,3,4)){#do stuff}; foo3<-function(lambda,...){lambda*foo1()*foo2()}; I want to be able to
2006 Jun 29
3
advice on arguments
I have a general style question about R coding. Suppose I'm writing a function (foo1) that calls other functions (foo2, foo3, ...) which have complicated argument lists (e.g. optim(), plot()), _and_ I may be calling several different functions in the body of foo1. Since foo2 and foo3 have different sets of arguments, I can't just use "..." ; I did write some code a while ago
2012 Nov 06
1
Depends/Imports/Suggest/Enhence
Hi the list In the DESCRIPTION file of my package foo0, I have: Depends: foo1 Imports: foo2 Suggest: foo3 Enhence: foo4 If I understand correctly, to install foo0 on my computer, I need to already have foo1, foo2, foo3. foo4 is not necessary. I my R sesssion, when I will write: library(foo0), then the package foo1 will be attach. foo2, foo3 and foo4 will not. Is that correct? But what is
2010 Feb 10
1
How to solve: Error in * unused argument(s) ?
Hi all, For some reason, I would like to use functions bellow (see example code bellow), but instead I get the following error message: *Error in foo2(...) : unused argument(s) (arg3 = 3)* #--------------------- # example code #--------------------- foo1 <- function(arg1,...) { print(arg1) foo2(...) foo3(...) } foo2 <- function(arg2) { print(arg2) } foo3 <- function(arg3) {
2007 May 31
3
Problem with Weighted Variance in Hmisc
The function wtd.var(x,w) in Hmisc calculates the weighted variance of x where w are the weights. It appears to me that wtd.var(x,w) = var(x) if all of the weights are equal, but this does not appear to be the case. Can someone point out to me where I am going wrong here? Thanks. Tom La Bone [[alternative HTML version deleted]]
2010 Mar 23
1
S4: Multiple inheritance
Hi all, Working with S4 object, I definine two class foo1 and foo2. I define '[' (resp. '[<-') for the two classes. Then I define a third class foo3 that inherit from both foo1 and foo2. Is there a way to make '[' (resp. '[<-') for foo3 inherit from '[' (resp. '[<-') for foo1 and foo2? Thanks Christophe
2008 Jan 11
1
ggplot2, coord_equal and aspect ratio
Hi everyone, Hi Hadley, I am a heavy user of coord_equal() in ggplot2 since most of my data is spatial, on x,y coordinates. Everything works. However by enforcing an aspect ratio of 1 for the plotting region, coord_equal() usually wastes a lot of space if the region of interest is not a perfect square. For example: x=runif(10) a=data.frame(x=x*3,y=x) ggplot(data=a, aes(x=x,y=y)) +
2011 Jun 20
1
access objects by name
Hi, I have several data structures (xts structures). I then have a list of the names of those objects. I'd like to access the object by name. For example: foo1 <- as.xts(....) foo2 <- as.xts(...) foo3 <- as.xts(...) structs <- c("foo1", "foo2", "foo3") for (thisOne in structs){ print(thisOne$colA) } The above fails. Clearly I'm missing a
2004 Apr 20
2
Creating variable names
My apologies for asking what is doubtless a dumb question, but I have scant experience in R. It would be very convenient in doing lots of plots to be able to do them in a loop that stepped through a vector of variable names. For example one could say x<-("mydates") y<-c("foo1","foo2","foo3") #where "foon" were vectors
2007 Jul 30
2
apply, lapply and data.frame in R 2.5
Hello everyone, A recent (in 2.5 I suspect) change in R is giving me trouble. I want to apply a function (tolower) to all the columns of a data.frame and get a data.frame in return. Currently, on a data.frame, both apply (for arrays) and lapply (for lists) work, but each returns its native class (resp. matrix and list): apply(mydat,2,tolower) # gives a matrix lapply(mydat,tolower) # gives
2014 May 02
1
Authors@R: and Author field
Hi to all Authors@R: c(person("fooa","foob", role = c("aut","cre"), email = "fooa.foob@fooc.de"), person("foo1","foo2", role = c("ctb"), email = "foo1.foo2@foo3.de")) Author: fooa foob, with contributions from foo1 foo2 using r CMD check --as-cran .. (R 3.1
2007 May 21
1
plot(......,new=T) vs. par(new=T)
Hello everybody, This is probably a classic but I cannot find an answer to this on the mailing list (i.e. with a google search restricted to the mailing list archive). Setting: par(new=T) plot(x,y) works but plot(x,y,new=T) doesn't while it is said in plot's help that ... arguments are passed to par. What am I missing? JiHO --- http://jo.irisson.free.fr/
2012 Nov 07
2
Correct use of Depends, Imports and ::
Dear R developers, Taking advantage of the yesterday discussion about the use of Depends/Import/Suggests/Enhances, I would like to add a related question. Let's assume, in the DESCRIPTION file of my package foo0, I have: Depends: foo1 Imports: foo2 while in the NAMESPACE file of my package I have importFrom("foo2", f2) and within my package I use the following two external
2009 Mar 22
3
'require' equivalent for local functions
Hello everyone, I often create some local "libraries" of functions (.R files with only functions in them) that I latter call. In scripts that call a function from such library, I would like to be able to test whether the function is already known in the namespace and, only if it is not, source the library file. I.e. what `require` does for packages, I want to do with my local
2008 Feb 05
2
Incomplete ouput with sink and split=TRUE
Dear List, I am trying to get R's terminal output to a file and to the terminal at the same time, so that I can walk through some tests and keep a log concurrently. The function 'sink' with the option split=TRUE seems to do just that. It works fine for most output but for objects of class htest, the terminal output is incomplete (the lines are there but empty). Here is an
2007 May 18
3
lapply not reading arguments from the correct environment
Hello, I am facing a problem with lapply which I ''''think''' may be a bug. This is the most basic function in which I can reproduce it: myfun <- function() { foo = data.frame(1:10,10:1) foos = list(foo) fooCollumn=2 cFoo = lapply(foos,subset,select=fooCollumn) return(cFoo) } I am building a list of dataframes, in each of which I want to keep only column