Displaying 20 results from an estimated 8000 matches similar to: "help with barplot"
2011 Sep 12
5
Hourly data with zoo
I have date data as a numeric and hourly data in 0 to 2300 hours in a dataframe.
d <- rep(20110101,24)
h <- seq(from = 0, to = 2300, by = 100)
df <- data.frame(LST_DATE = d, LST_TIME = h, data = rnorm(24, 0, 1))
S <- chron(dates. = as.character(df$LST_DATE), times. =
paste(as.character(df$LST_TIME/100), ":0:0", sep = ""),
format =
2010 Apr 25
3
Noobie question on aggregate tapply and by
I have a 43MB dataframe ( 5 variables) and I'm trying to summarize subsets
of the data.
I've RTFM ( not very clear) and looked at a variety of samples but cant seem
to figure out
how to make these functions work.
A sample of what I want to do would be this:
ids<-seq(1,50)
years<-c(rep(5,10),rep(6,10),rep(7,10),rep(8,20))
2010 Sep 08
2
dataframe selection using a multi-value key
I am merging two dataframes using a relational key (incident number and
incident year), but not all the records match up. I want to be able to
review only the records that cannot be merged for each individual dataframe
(essentially trying to select records from one dataframe using a multi-value
relational key from the other dataframe). The following code shows what I
am trying to do. The final
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
Dear all
I would like to superpose some smoothing line through boxplot in ggplot
> dput(ad)
structure(list(konc.f = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L,
7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 7L, 7L, 7L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
2011 Aug 29
1
Legend / bar order - ggplot2
Hi all,
I am trying to do a barplot in ggplot2 and want to make sure that the legend order is consistent with the bar order, that is the legend order is orig and match; and the bars are ordered in the same way. It seems to me that I can only control one of them. Any idea?
library(ggplot2)
df <- data.frame(value = rnorm(20),
name = factor(rep(letters[1:10], 2), levels =
2010 Sep 16
1
plotting time series using ggplots
Hi,
I would like to plot a bunch of tree ring width data (time series)
using ggplots, but I'm having trouble figuring out how to do it.
My data is in a data.frame, with years as rownames and a distinct tree
ring series in each column. So, something like this:
rwl<-matrix(rnorm(800), nrow = 100)
colnames(rwl) <- paste('V', 1:8, sep = '')
2009 Apr 23
1
ggplot2/aesthetic plotting advice
Consider the following situation:
we have quantified algal concentrations for
a variety of species using many samples at each
of three years. It seems to make sense to generate
a line plot (matplot-like), with each species plotted
as a separate line, with the points connected to emphasize
the temporal pattern.
The problem: lots of overlapping error bars.
The question: from both a
2011 Dec 04
1
Polishing my geom_bar for publication
Dear list,
I am new with ggplot2 and I have spend quiet some time putting together the following code to create the attached plot. However there's still a few things that I'm having trouble with!
I would be grateful if someone can tell me how to fix (1) the colour of my bars into grey scales (2) removing the y-axis (species name) on the right figure to avoid duplication, and (3) fix the
2009 Sep 14
1
ggplot, ribbon not showing up properly
Hi,
I'm trying to plot a longitudinal data set, using ggplot and adding some
summary info (eg. mean, 1 sd bounds) using geom=ribbon. The summary
info is based on a subset of the original data (eg. less an outlier).
But I'm having trouble getting the ribbons to show up correctly. It's
probably something obvious that I'm missing as a novice at ggplot2, and
any help is much
2010 Jul 15
3
Summing over intervals
Given a matrix of MxN
want to take the means of rows in the following fashion
m<-matrix(seq(1,80),ncol=20, nrow=4)
result<-matrix(NA,nrow=4,ncol=20/5)
result[,1]<-apply(m[,1:5],1,mean)
result[,2]<-apply(m[,6:10],1,mean)
result[,3]<-apply(m[,11:15],1,mean)
result[,4]<-apply(m[,16:20],1,mean)
result
[,1] [,2] [,3] [,4]
[1,] 9 29 49 69
[2,] 10 30 50 70
2010 Aug 11
2
Sweeping a zoo series
Given a long zoo matrix, the goal is to "sweep" out a statistic from the
entire length of the
sequences.
longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+")))
cnames<-c(12345,23456,34567,45678,56789,67890)
colnames(longzoomatrix)<-cnames
longzoomatrix[1:24,]
12345 23456 34567 45678
2010 Jun 05
5
Matrix to Vector
Given a matrix of m*n, I want to reorder it as a vector, using a row major
transpose.
so:
> m<-matrix(seq(1,48),nrow=6,byrow=T)
> m
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 2 3 4 5 6 7 8
[2,] 9 10 11 12 13 14 15 16
[3,] 17 18 19 20 21 22 23 24
[4,] 25 26 27 28 29 30 31 32
[5,] 33 34 35 36 37
2011 Jul 27
2
Elegant way to subtract matrix from array
there are really two related problems here
I have a 2D matrix
A <- matrix(1:100,nrow=20,ncol =5)
S <- matrix(1:10,nrow=2,ncol =5)
#I want to subtract S from A. so that S would be subtracted from the
first 2 rows of
#A, then the next two rows and so on.
#I have a the same problem with a 3D array
# where I want to subtract Q for every layer (1-10) in Z
# I thought I solved this one
2009 Mar 01
1
projecting GIS coordinates for analysis with spatstat package
I am working on creating an R package for doing fire department analysis and
am trying to create a function that can display emergency incident
densities. The following code sort of does the trick, but I need a display
that shows the number of incidents per square mile. I believe the code
below shows incidents per square unit (in this case, degrees lat/long).
To solve this problem, I believe
2011 Mar 18
2
Understanding tryCatch
I've read the help and the archives on tryCatch but I'm still stuggling
trying to understand how it
works exactly and how I can use it to get the result I need.
I have a data.frame of urls which point to 11 .zip files. Basically I use
RCurl to get the list of
files from a ftp and then reduce that directory dump to the 11 zip files I
want to download.
Its easy enough to do that in a loop
2010 May 03
2
Adding a header after the file is written
The situation arises where I open a file to write a data.frame to it. with
write.table.
multiple lines are written to the file and the file is kept in Append=TRUE
mode.
If one sets the col.names to the names of the variables being written, you
have output
that looks like this...
name1 name2 name3.....
x x x
x x x
x x x
name1 name2 name
2013 Feb 08
1
Problem with many to many relationship
Hi
I''m trying to create a many to many relationship between two models.
A User can be associated with many Incidents and vice versa.
class User < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
has_many :incident_participants, foreign_key: "participant_id"
has_many :participated_incidents, through: :incident_participants
end
class Incident
2009 Apr 12
7
Any news on ZFS bug 6535172?
We''re running a Cyrus IMAP server on a T2000 under Solaris 10 with
about 1 TB of mailboxes on ZFS filesystems. Recently, when under
load, we''ve had incidents where IMAP operations became very slow. The
general symptoms are that the number of imapd, pop3d, and lmtpd
processes increases, the CPU load average increases, but the ZFS I/O
bandwidth decreases. At the same time, ZFS
2010 Aug 09
1
nested 'by'
Assuming a data frame or matrix with two columns representing variable that
you want to aggregate over.
you want to calculate column means, by year, for each Id
example<-data.frame(id=c(rep(12345,5),rep(54321,6),rep(45678,7)),Year=rep(seq(1900,1902,by=1),6),
x=seq(1,18,by=1),y=seq(18,1,by=-1))
example
id Year x y
1 12345 1900 1 18
2 12345 1901 2 17
3 12345 1902 3 16
4 12345
2011 Nov 01
1
weird error
I was just rebuilding a package that has built before and I hit this error
Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
keep.source) :
cyclic name space dependency detected when loading 'GhcnDaily', already
loading 'GhcnDaily'
The package built just fine last revision, and the only changes I made were
to Rd files
How do I track this puppy down