Displaying 12 results from an estimated 12 matches for "yloc".
Did you mean:
loc
2011 Feb 23
1
Fwd: Re: sum data from data.frame in a matrix
...al Message --------
Subject: Re: [R] sum data from data.frame in a matrix
Date: Wed, 23 Feb 2011 00:10:52 -0800
From: Dennis Murphy <djmuser at gmail.com>
To: Nicolas Gutierrez <nicolasg at uw.edu>
Hi:
...and a second way, using the reshape2 package:
library(reshape2)
dcast(df, yloc ~ xloc, value_var = 'yield', fun = sum)
yloc 10 11 12
1 10 0 81 0
2 11 0 0 30
3 12 95 0 0
Dennis
On Tue, Feb 22, 2011 at 11:30 PM, Nicolas Gutierrez <nicolasg at uw.edu
<mailto:nicolasg at uw.edu>> wrote:
Hi all (again),
I have a data frame "p...
2011 Feb 25
1
data.frame operations
Hi All,
I've been doing circles with this all morning, although I'm sure there's
a simple solution. I have a data.frame "pop" as follows:
> pop
ind xloc yloc gonad
1 1 5 2 12
2 1 5 4 25
3 1 3 3 30
4 1 5 4 10
5 1 1 4 08
. . . . .
10 1 1 4 11
And I need the following steps:
1. Sum "gonad" by combining (xloc, yloc) as follows and create
data.frame "fish":...
2011 Mar 19
3
create a matrix with values from data.frame
Hello,
I'm trying to create a matrix (95x55) with data from a data.frame pop:
xloc yloc go ind Ene totW
1 23 20 516 1 0.02 20.21
2 23 20 1143 1 0.02 20.21
3 23 20 250 1 0.02 20.21
4 22 15 251 1 0.02 18.69
5 22 15 598 1 0.02 18.69
6 21 19 250 1 0.02 20.21
7 22 20 251 1...
2011 Feb 23
1
sum data from data.frame in a matrix
Hi all (again),
I have a data frame "pop":
xloc yloc yield
1 10 12 95
2 11 10 81
3 12 11 20
4 12 11 10
And I want to get the sum of yield for the cell (pop$xloc, pop$yloc) in
a matrix as follows:
xloc
10 11 12
10 0 81 0
yloc 11 0 0 30
12 95 0 0
Any ideas? thanks!
Nico
2011 Feb 08
2
delete a row in dataframe w/o changing indexing
Hi All,
I'm trying to delete a row from my dataframe "pop" without changing the
indexing (column 0) as follows:
>pop
id birth size xloc yloc weight energy gonad consumed
1 1 36 13 34 43 0 18 0 0
2 2 36 10 39 38 0 18 0 0
3 3 36 10 37 35 0 18 0 0
4 4 36 10 31 25 0 18 0 0
5 5 36 17 34 43 0 18 0...
2011 Mar 18
4
subset data frame with condition
Hello,
One more question.. I have the data.frame "pop":
xloc yloc gonad ind Ene W Area
1 23 20 516.74 1 0.02 20.21 1
2 23 20 1143.20 1 0.02 20.21 1
3 23 20 250.00 1 0.02 20.21 1
4 22 15 251.98 1 0.02 18.69 2
5 22 15 598.08 1 0.02 18.69 2
6 21 19 250.00 1 0.02 20.21 3
7 22 2...
2011 Aug 17
1
Symbol Font Baseline, Cairo, Card Symbols
...mbol('\252'))
csymbols <- c(clubs, diamonds, hearts, spades)
CairoPDF(file = "cardsymbols.pdf")
plot( 0, xlim=c(0,5), ylim=c(0,2), type="n" )
clr <- c("black", "red", "red", "black")
for (i in 1:4) {
hline <- function( yloc, ... ) for (i in 1:length(yloc)) lines(
c(-1,6), c(yloc[i],yloc[i]), col="gray")
hline(0.9); hline(1.0); hline(1.1); hline(1.2)
text( i, 1, csymbols[i], col=clr[i], cex=5 )
text( i, 0.5, csymbols[i], col=clr[i] )
}
dev.off()
----
Ivo Welch (ivo.welch at gmail.com)
2011 Feb 27
2
substract 2 data.frames
Hi!
I have 2 data.frames: "fish" and "popn":
>fish
xloc yloc id birth size weight energy gonad
20 15 15 54 -60 107.9 63.0 15952.9 8.0
21 15 15 32 -60 105.1 61.4 15538.8 7.8
91 4 43 96 -60 118.9 69.4 17573.2 8.8
71 32 4 64 -60 121.6 71.0 17976.0 9.0
34 2 64 20 -60 116.2 67.9 17173.0 8.6
95 6 20 58...
2012 Dec 11
2
lattice question: how to change the dot on boxplot to line
Hi,
How does one change the dot for the median in a boxplot drawn using
lattice? I have been looking at
> names(trellis.par.get())
[1] "grid.pars" "fontsize" "background"
[4] "panel.background" "clip" "add.line"
[7] "add.text" "plot.polygon"
2011 Jan 26
1
return object from loop inside a function
Hi All,
I have a for loop inside the function and I cannot get UUU to give me an
updated grid.dens object when I run the function (it does update when I
run just the for loop). Here's a simplified version of my function:
UUU=function(pop, grid.dens) {
for (i in 1:10){
Food=grid.dens[pop$yloc[i],pop$xloc[i]] #use initial grid.dens values
Consumed=(pop$weight[i]*0.25)
Left=Food-Consumed
grid.dens[pop$yloc[i],pop$xloc[i]]=Left #update grid.dens values on i
pop$birth[i]=pop$birth[i]+1
}
return(pop)
return(grid.dens)
}
I get an updated pop, but not an updated grid.dens. What am I doin...
2010 Sep 15
2
how to superimpose 2 matrices of different sizes
Hi All,
I?m trying to superimpose (or "add") two matrices:
1. resulting from a table function with frequencies:
> U=table(pop$xloc, pop$yloc))
14 15 16 17 18 19 20 21 22
5 0 0 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 9 0 5
10 0 0 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0 0 0
2. The second created to match my spatial grid (20x25):
>...
2013 Feb 11
2
how to make a median line thicker in bwplot (lattice)
Hello,
I am drawing a boxplot using bwplot in lattice.
I would like to learn how to draw a thicker median line instead of the
default setting.
Thank you.
Code
bwplot(........,
pch=rep("|",2))
Elaine
[[alternative HTML version deleted]]