similar to: ggplot's aes_ doesn't work as expected for x=factor()

Displaying 20 results from an estimated 1110 matches similar to: "ggplot's aes_ doesn't work as expected for x=factor()"

2003 Nov 10
Reading an upper triangular matrix
Hola! I have data in the form of a symmetric distance matrix, in the file I have recorded only the upper triangular part, with diagonal. The matrix is 21x21, and the file have row and col names, and some other information. I am trying to read with the following code (I tried many variations on it, but all give the same error). The items in the data file is delimited by white space. (Part
2006 Sep 15
Formula aruguments with NLS and model.frame()
I could use some help understanding how nls parses the formula argument to a model.frame and estimates the model. I am trying to utilize the functionality of the nls formula argument to modify garchFit() to handle other variables in the mean equation besides just an arma(u,v) specification. My nonlinear model is y<-nls(t~a*sin(w*2*pi/365*id+p)+b*id+int,data=t1,
2012 Feb 07
predict.naiveBayes() bug in e1071 package
Hi, I''m currently using the R package e1071 to train naive bayes classifiers and came across a bug: When the posterior probabilities of all classes are small, the result from the predict.naiveBayes function become NaNs. This is an issue with the treatment of the log-transformed probabilities inside the predict.naiveBayes function. Here is an example to demonstrate the problem (you might
2006 Aug 16
bwplot in loop doesn''t produce any output
Hi, running the following code by itself runs as expected. ---------------------------------------------------------------------------- k <- 1 i <- 2 j <- 3 NumName <- varnames[num.cols[k]] FacNames <- varnames[fac.cols[c(i,j)]] tmp <- paste(FacNames[1],NumName,sep="~") fml <- formula(paste(tmp,FacNames[2],sep="|")) bwplot(fml, data
2007 Oct 16
Adding axis lines to splom plots
Hi, I am trying to produce a 30x30 lattice grid. The 30 variables naturally fall into three groups of ten and I would like to add thicker axis lines around these to highlight this. However, I can only do this separately, so far, and I don''t know how to superimpose the grid with the thicker lines (separating the 10x10 groups) onto the overall grid of all 30x30 plots. I enclose a
2011 Aug 21
Multiple R linear models into one Latex table
Dear community, I had been looking for an easy way to produce latex tables from R output. xtable() and the package apsrtable produce good outputs but they are not exactly what I was looking for. I wrote this code that generates regression tables from multiple R linear models. I want to share it because it might be useful for someone else, and because I would appreciate comments on how to
2004 Feb 18
using names() as a variable in a formula
Greetings List, I''m having some trouble with the use of the names function in a formula. Below is an example of something that works (i.e first line), and the second line is the same formula which doesn''t. I want to be able to reference the column of the dataC table so I can run the variogram iteratively with a loop. > v<-variogram(A1~1,loc=~x+y, dataC) >
2004 Feb 15
manova() with a data frame
I''m trying to learn to use manova(), and don''t understand why none of the following work: > data(iris) > fit <- manova(~ Species, data=iris) Error in, y, offset = offset, singular.ok = singular.ok, ...) : incompatible dimensions > fit <- manova(iris[,1:4] ~ Species, data=iris) Error in model.frame(formula, rownames, variables, varnames,
2012 Dec 18
Changing Variable Names In VCD
Hello: What is the most efficient way to change the plotted variable names in mosaic plots in the vcd package? Should one do a separate contingency table first, change the dimension names there and then pass that to mosaic? Or is there a way to do it simply within mosaic. I was thinking something like: mosaic(~var1+var2, labelling_args=list(varnames=c(''newvar1'',
2008 Jun 26
bug in nls?
Dear all Nobody responded to my previous post so far so I try with more offending subject. I just encountered a strange problem with nls formula. I tried to use nls in cycle but I was not successful. I traced the problem to some parse command. Here is an example DF<-data.frame(x=1:10, y=3*(1:10)^.5+rnorm(10)) coef(lm(log(DF[,2])~log(DF[,1]))) (Intercept) log(DF[, 1]) 0.7437320
2010 Sep 30
panel.pairs in splom
Hello, I have a customized pairs () fonction as follows that displays correctely my data. ------------------------------------------------------------------------ panel.cor1 <- function (x, y, digits=2, prefix="") { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- cor(x, y,use="pairwise.complete.obs",
2003 Feb 10
problems using lqs()
Dear List-members, I found a strange behaviour in the lqs function. Suppose I have the following data: y <- c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8, 13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5, 12.0, 13.0, 14.1, 15.1) x1 <- c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4, 10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0,
2004 May 06
modifying the text size in splom
All, I have long variable names that are being fed through splom (R 1.8.1). I''d like to resize the text printed on the diagonals to better display the names (unless anyone can suggest another approach - creative use of varnames). I''ve looked at the code, R-Help, ?splom and the Trellis User''s Guide to no avail. Any suggestions? Thanks in advance, Max Kuhn, Ph.D. Becton
2017 Jul 27
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being counted" - I know how to do that. My question is: Why na.rm = T is not working for geom_bar in this case? On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski < dimitri.liakhovitski at> wrote: > Hello! > > I am trying to understand how ggplot2's geom_bar treats NAs. > The help file
2003 Dec 14
Problem with data conversion
Hi All: I came across the following problem while working with a dataset, and wondered if there could be a solution I sought here. My dataset consists of information on 402 individuals with the followng five variables (age,sex, status = a binary variable with levels "case" or "control", mma, dma). During data check, I found that in the raw data, the data entry
2012 Jan 29
ColorBrewer question
Hello, R friends,   I''m trying to change colors of my horizontal bars so that they show a sequence. I chose the ColorBrewer palette "Blues". However the resulting plot doesn''t show any changes to the default. I tried several places of "+ scale_colour_brewer(type="seq", pal = "Blues")" with no effect. This is my code:   p <- ggplot(data,
2017 Jul 27
na.rm = T treatment by ggplot2's geom_bar
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s). -- Sent from my phone. Please excuse my brevity. On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at> wrote: >To clarify: my question is not about "who could I exclude NAs from >being >counted" - I know how to do
2000 Apr 04
Can nonlinear models be used in gee?
Hi all, 1. Can nonlinear models be used in gee? For example, I have a dataset which contains 2 variables x and y, I wrote data(ex) atttach(ex) a<-100 b<- -0.5 c<-4.5 d<-20 Then: a. y~gee(y~d+(a-d)/(1+(x/c)^b)) Error in terms.formula(formula, data = data) : invalid power in formula b. y~gee(y~d+(a-d)/(1+(x/c)) Error in model.frame(formula, rownames, variables,
2008 Sep 28
reshape package does not recognize second id variable
I am trying to use the reshape package for the first time. I have two waves of a survey, so the id variables include a subject identification number and a variable denoting the wave of the survey. I used the following arguments: library(reshape) svy.melt <- melt(svy, id=c("id", "WAVE")) svy.wide <- cast(svy.melt, id ~ WAVE + ...) and got the following error:
2005 Jan 06
multiple trees
Hi, there: I made a function to do k-fold cross-validation as below. Basically whenever I call cv(test) for example, an error message like: 20Fold 1 Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : variable lengths differ please help. My test dataset has 142 variables, the last one is a categorical response variable. also, i am not sure how to save