similar to: color by group in ggplot

Displaying 20 results from an estimated 10000 matches similar to: "color by group in ggplot"

2013 Apr 18
6
count each answer category in each column
Hey, Is it possible that R can calculate each options under each column and return a summary table? Suppose I have a table like this: Gender Age Rate Female 0-10 Good Male 0-10 Good Female 11-20 Bad Male 11-20 Bad Male >20 N/A I want to have a summary table including the information that how many answers in each category, sth like this: X
2010 Nov 08
2
Several lattice plots on one page
Dear all, I am trying (!!!) to generate pdfs that have 8 plots on one page: df = data.frame( day = c(1,2,3,4), var1 = c(1,2,3,4), var2 = c(100,200,300,4000), var3 = c(10,20,300,40000), var4 = c(100000,20000,30000,4000), var5 = c(10,20,30,40), var6 = c(0.001,0.002,0.003,0.004), var7 = c(123,223,123,412), var8 = c(213,123,234,435), all = as.factor(c(1,1,1,1)))
2013 May 07
4
create unique ID for each group
Hey All, I have a dataset(dat1) like this: ObsNumber ID Weight 1 0001 12 2 0001 13 3 0001 14 4 0002 16 5 0002 17 And another dataset(dat2) like this: ID Height 0001 3.2 0001 2.6 0001
2013 Apr 12
2
split date and time
Hi R experts, For example I have a dataset looks like this: Number TimeStamp Value 1 1/1/2013 0:00 1 2 1/1/2013 0:01 2 3 1/1/2013 0:03 3 How can I split the "TimeStamp" Column into two and return a new table like this: Number Date Time Value 1 1/1/2013 0:00 1 2 1/1/2013 0:01 2 3 1/1/2013 0:03 3 Thank! [[alternative HTML version
2011 Mar 12
2
Merge data under conditions
Dear All, Debuting in R, I'm facing a problem. I have 2 vectors, say 'a' et 'b', and I'd like to merge them according to the proximity of their variable 'time'. How to do to keep elements which satisfy (for example) 'a$time-b$time<0.5'? For example : > a time x 1 1.0 4 2 2.2 5 3 5.2 6 > b time y 1 0 1 2 1 3 3 2 5 4 4 7 5
2012 Apr 19
2
suggested method to transform list to a matrix
I have data in the following list format: USER,VARIABLE,COUNT user1, var1, 3 user1, var2, 4 user2, var1, 7 userN, var12, 5 And would like to have it format as a matrix: var1 var2 var12 user1 3 4 user2 7 userN 5 What is the suggested method to do this for 1 million rows, with 12 variables and ~ 4,000 unique users? Thank you, Tim Stutt tim@ischool.berkeley.edu [[alternative
2013 May 21
3
add identifier column by row
I want to add identifier column (Date) to a time series data frame. I want to name the "Date" column be from 1 to 30 every 1440 rows. Say I have a data like this (I simply my actual data here): $dat ID Var 1 1 2 4 3 6 4 7 5 7 6 8 How can I add identifier column (Date) from 1 to 3 every 2 rows and have output like this: ID
2013 Apr 10
3
how to calculate average of each column
Hey All, I have a large dataset and I want to calculate the average of each column then return a new dataset. Here is my question: I dont know if there is a function that can allow me to calculate the average every 60 records of data in the whole dataset, and return a new data frame. Not sure if I have to divide the dataset first for every 60, then do the mean or can i directly do that. thanks
2018 Nov 08
2
ggplot con muchos colores
Buenos días, estoy haciendo unos mapas con ggplot, con 29 categorías, por lo que tengo que utilizar library(RColorBrewer) para disponer de suficientes colores. El problema es que al hacerlo acorde a dos variables distintas (color=var1 y color=var2), cuyas 29 categorías son obviamente las mismas, les da distintos colores y no puedo comparar los mapas. Muchas gracias, Manuel
2013 Feb 14
2
Plot a Matrix as an Image with ggplot
Dear all, I am trying to plot a matrix I have? as an image str(matrixToPlot) ?num [1:21, 1:66] 0 0 0 0 0 0 0 0 0 0 . ?that contains only 0s and 1s, where the xlabel will be Labeled as str(xLabel) ?num [1:66] 1e+09 1e+09 1e+09 1e+09 1e+09 ... and the yLabels will be labeled as str(yLabel) ?num [1:21] -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 ... I have found on the internet that I can do
2010 Dec 08
1
ggplot - line_range help, second tier axis label
Hi All, Will try and keep brief, excuse the poor graphics skills, first time using GIMP. I would like to make the first one look (somewhat) like the second if possible. From: http://d.imagehost.org/0519/Screen_shot_2010-12-08_at_3_50_23_PM.png To here: http://d.imagehost.org/0293/Screen_shot_2010-12-08_at_3_50_23_PM2.png I imagine the line going over the top with the p-values is probably not
2013 Apr 16
2
plot 2 y axis
Hi, I want to plot two variables on the same graph but with two y axis just like what you can do in Excel. I searched online that seems like you can not achieve that in ggplot. So is there anyway I can do it in a nice way in basic plot? Suppose my data looks like this: Weight Height Date 0.1 0.3 1 0.2 0.4 2 0.3 0.8 3 0.6 1
2012 Jan 16
1
ggplot- using geom_point and geom_line at the same time
Hi I am plotting line chart using ggplot and want to use geom_line and geom_point simultaneously. I get the plot but now I have two legends. None of the legend is representing the true values. I need the legend with shape and color both. Thanks > con = textConnection("inputs var1 var2 var3+ 100 10 5 2+ 1000 20 10 4+ 5000 30 15 8+ 10000 40 20 16+ 30000 50 25 32")> data =
2011 Aug 17
2
dotchart vs. dotplot ... groups
I'm trying to create a dotplot with some grouping. I've been able to create what I want using dotchart (basic graphics), but can't quite get it using dotplot (lattice). I prefer to use lattice (or ggplot2) because I think it's a bit easier to control some other aspects of the plot appearance. Basically, w/ lattice I've not been able to get the y-axis label to include the
2004 Aug 17
5
Bug in colnames of data.frames?
Hi, I am using R 1.9.1 on on i686 PC with SuSE Linux 9.0. I have a data.frame, e.g.: > myData <- data.frame( var1 = c( 1:4 ), var2 = c (5:8 ) ) If I add a new column by > myData$var3 <- myData[ , "var1" ] + myData[ , "var2" ] everything is fine, but if I omit the commas: > myData$var4 <- myData[ "var1" ] + myData[ "var2" ] the name
2009 Sep 22
3
converting a character vector to a function's input
Hi all, I have been trying to solve this problem and have had no luck so far. I have numeric vectors VAR1, VAR2, and VAR3 which I am trying to cbind. I also have a character vector "VAR1,VAR2,VAR3". How do I manipulate this character vector such that I can input a transformed version of the character vector into cbind and have it recognize that I'm trying to refer to my numeric
2008 Jul 16
2
Group level frequencies
Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of "var1" and "var2" on the group level. I found a way, but there must be a much simpler way. data.ml <- data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4),
2014 Apr 11
6
crear variable en base a nombre de columnas que tienen un 1
Buenos días. Hoy ando un poco (o bastante) espeso y no doy con la tecla de una cosa que seguro que es muy simple.. Pongo un ejemplo. var1 <- c(rep(0,3),rep(1,2)) var2 <- c(rep(1,2),0,0,1) var3 <- c(rep(1,2),rep(0,3)) var4 <- c(rep(1,2),rep(0,3)) datos <- data.frame(fila=1:5,var1, var2, var3, var4) datos datos fila var1 var2 var3 var4 1 1 0 1 1 1 2 2 0
2012 Feb 15
2
assign same legend colors than in the grouped data plot
Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , bty='L') legend(locator(1),c("level 1 var3",
2013 Mar 25
2
Plot Matrix with Data
Hi , I would like to use ggplot2 to plot a matrix as an image. You can copy paste the following Data<-matrix(data=rnorm(900,80,20),nrow=30,ncol=30) lengthOut<-5 Lengths<- 15 library(reshape2) library(ggplot2) tdm <- melt(Data) ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value)),levels=seq(0,1,by=0.1)) +                   labs(x = "MHz", y =