Displaying 20 results from an estimated 400 matches similar to: "Polishing my geom_bar for publication"
2012 Mar 09
2
Create a list object in a loop
Dear all,
I'm trying to create a list of point patterns ppp.object {spatstat} in a loop.
My dataset looks like this:
> names(OT1);head(OT1);dim(OT1)
[1] "EID" "latitude" "longitude" "month" "year" "CPUE" "TSUM"
[8] "fTSUM"
EID latitude longitude
2009 Mar 02
3
ways to put multiple graphs on single page (using ggplot2)
Hi, Here are three plots:
library(ggplot2)
data(diamonds)
randind <- sample(nrow(diamonds),1000,replace=FALSE)
dsmall <- diamonds[randind,]
qplot(carat, data=dsmall, geom="histogram",binwidth=1)
qplot(carat, data=dsmall, geom="histogram",binwidth=.1)
qplot(carat, data=dsmall, geom="histogram",binwidth=.01)
What are ways to put these three plots on a single
2010 Jul 09
1
print.trellis draw.in - plaintext (gmail mishap)
I am attempting to plot a trellis object on a grid.
vplayout = viewport(layout.pos.row=x, layout.pos.col=y)
grid.newpage()
pushViewport(viewport(layout=grid.layout(2,2)))
g1 = ggplot() ...
g2 = ggplot() ...
g3 = ggplot() ...
p = xyplot() ...
# works as expected
print(g1, vp=vplayout(1,1))
print(g2, vp=vplayout(1,2))
print(g3, vp=vplayout(2,1))
# does not work
print( p,
2013 Jun 07
4
matched samples, dataframe, panel data
I R-helpers
#I have a data panel of thousands of firms, by year and industry and
#one dummy variable that separates the firms in two categories: 1 if the firm have an auditor; 0 if not
#and another variable the represents the firm dimension (total assets in thousand of euros)
#I need to create two separated samples with the same number os firms where
#one firm in the first have a corresponding
2008 Nov 24
3
multiple plots in R
Hi, I just try to draw multiple plots in one page using R, I used par
command. For example I have 7 plots, but instead of arranging them in
the default way
plot1 plot2 plot3
plot4 plot5 plot6
plot7
I want them in this order
plot1 plot2 plot3
plot4 plot5 plot6
plot7
Could somebody tell me how to do this, please? Thanks so many.
Suyan
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
Hi R-helpers,
My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information (variables X, Y, Z, for example), the number of firms by year and industry is not always equal, the number of years by industry is not always equal.
#reproducible example
firm1<-sort(rep(1:10,5),decreasing=F)
year1<-rep(2000:2004,10)
2013 Feb 27
1
Separation issue in binary response models - glm, brglm, logistf
Dear all,
I am encountering some issues with my data and need some help.
I am trying to run glm analysis with a presence/absence variable as
response variable and several explanatory variable (time, location,
presence/absence data, abundance data).
First I tried to use the glm() function, however I was having 2 warnings
concerning glm.fit () :
# 1: glm.fit: algorithm did not converge
# 2:
2006 Sep 21
2
R data query
Dear Sir/Madam,
I am encountering one of those alien computer momements one finds every
so often in life. See the sequence below:
> fish3.fis <-read.csv("emperor2.csv", check.names = TRUE, strip.white =
TRUE)
> colnames(fish3.fis)
[1] "Month" "Year" "FishingArea"
"SumOfTotalCatch" "CPUE"
[6]
2015 Jun 16
4
Ayuda boxplot ggplot2
Hola a todos
Me gustaría saber si me pueden ayudar con lo siguiente.
Realicé un Boxplot usando ggplot2 para visualizar el comportamiento de dos
variables. Visualmente no se notan las diferencias porque la gráfica de la
derecha (parásitos en el abdomen) llega hasta 20 en el eje y. ¿Cómo puedo
hacer para que las dos gráficas muestren la misma escala en el eje Y, es
decir, que las dos lleguen a 60?
2013 Jan 21
1
Very slow in processing the equation in the scatter plot ggplot
Hello All,
I have plotted a scatter plot in ggplot2 and added a regression line and a
regression equation. But the processing is very very slow. One reason might
be because I have so many data pairs. Is there any way to speed up this
code ? I need to create a multiple layout as well.
The code I have used is as follows:
setwd("C:/Users/jzd0009/Documents/R software")
mydata <-
2011 Sep 05
1
ggplot2-grid/viewport and PNG
Dear All,
The following code save my graphs as pdf:
pdf("j:/mix.pdf", width = 18, height = 16)
grid.newpage()
pushViewport(viewport(layout = grid.layout(3,1)))
vplayout <- function(x, y)
viewport(layout.pos.row = x, layout.pos.col = y)
print(Aplot, vp = vplayout(1, 1))
print(Bplot, vp = vplayout(2, 1))
print(Cplot, vp = vplayout(3, 1))
dev.off()
How can I save it in
2011 Jul 02
5
How many times occurs
Hi all,
I have a data matrix likein "input.txt"
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 5 6 4
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 9 2 2
In this example will be an 6x10 matrix (or data frame)
I want to detect how many times in a row appears this combination 8 follewd
by 9 followed by 2, and create a new matrix with only this number of occurs
then
2011 Apr 07
1
By function
Hello all!
I have a data frame with nine variables and 293 cases. (attached goes
the csv file).
I need to calculate a index using the sum of one variable (N) divided
by the length of other variable (Fisherman), but for each day (Date).
I tried to use that codes:
by (cpue, cpue$Date, function (x) sum (cpue$N)/length(cpue$Fisherman))
tapply (cpue$Data, cpue$Data, function (x) {sum
2015 Jan 14
3
Abreviado de especies
Hola,
Vaya desastre al mandar la cabecera de la base de datos. Al enviarlo, se veía bien, pero está visto que por el camino la cosa se torció.
Siguiendo el consejo de Javier, he subido un pequeño fragmento al DropBox. He quitado algunas especies para no hacerlo muy largo. Espero que ésta vez no haya problemas.
https://www.dropbox.com/s/q7zla50oq7owg8k/CPUE.csv?dl=0
Un saludo y gracias
Juan
2007 Mar 23
1
objects of class "matrix" and mode "list"?
Hello everyone,
I cannot seem to find information about objects of class "matrix" and mode
"list", and how to handle them (apart from flattening the list). I get this
type of object from using sapply(). Sorry for the long example, but the code
below illustrates how I get this type of object. Is anyone aware of
documentation regarding this object?
Thanks very much,
Stephen
2012 Jan 30
1
how to sum multiple data entries for the same sampling event?
I'm having trouble with some catch per unit effort data (CPUE, fisheries
data). Some of the samples were "retained" and some "unretained," and they
are entered as 2 separate entries for the same sampling event (Date and
time). I want to calculate the total CPUE (so sum the "retained" and
"unretained" number for each sampling event) and am having troubld
2012 Aug 06
4
Overlay Histogram
Dear all,
For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y
<- rnorm(1000. 3, 20).
Is there any way to overlay the histograms (and density curves) of x and y
on the plot of y vs. x?
The histogram of x is on the x axis and that of y is on the y axis.
The density curve here is to approximate the shape of the distribution
and does not have to have area 1.
Thank you
2009 Nov 10
1
Titles on panel graphs created in zoo
I have a plotted a stacked panel graph (single x axis and multiple y axis)
using the package zoo and would like to add a title for each separate panel.
I am using the script:
z <- with(mydata,zoo(cbind(mydata$Water.level,mydata$Submerged.plants,
mydata$Crayfish.CPUE,mydata$Carp.CPUE),Year))
plot(z,type="b",pch=16,lty=2,xlab="Year",ylab=c("Metres","Realtive
2012 May 19
4
weighted averages for two variables
Hi R users,
I have a dataset with multiple variables and i'm trying to weigh average
depths for fish species per year by their abundance (CPUE. I have tried the
weighted.mean function but as i have two columns for the x value the lenghts
differ with the w (CPUE). How do I solve this problem?
So far I have tried this:
data<-by(allspecies, list(allspecies$Depth, allspecies$Year),
2006 Nov 26
1
GLM and LM singularities
Hi-
I'm wrestling with some of my data apparently not being called into a GLM or
an LM. I'm looking at factors affecting fish annual catch rates (ie. CPUE)
over 30 years. Two of the factors I'm using are sea surface temperature and
sea surface temperature anomaly. A small sample of my data is below:
CPUE
Year
Vessel_ID
Base_Port
Boat_Lgth
Planing
SST
Anomaly
0.127