I have created a list of tables with the same columns but different number of
row.
Example (actual list has ~200 elements):
> temp1<- data.frame(ID=c("Herb","Shrub"),stat=c(4,5),pvalue=c(.03,.04))
> temp2<- data.frame(ID=c("Herb","Shrub",
> "Tree"),stat=c(12,15,13),pvalue=c(.2,0.4,.3))
> L<-list
I have a dataset I need to sort:
test.df<-data.frame(Zone=c("Floodplain", "Lake",
"Shoreline"),Cover=c(50,60,70))
However, I don't want it sorted ascending/descending but in an order that I
define via a vector:
sort.v<-data.frame(c("Lake","Shoreline","Floodplain"))
I realize I could probabl
I am learning R, and instead of learning by rote, I am trying to better
understand the language in order to improve my programming. So any
"meta-information" on why the following code works would be greatly
appreciated...
I obtained this code to extract the first record from each of a series of
v
I have a dataframe:
Empirical.df <- data.frame(ID=c("MCUP1-2","MCUP2-5", "MCUP3-3",
"MCUP4-3","MCUP5-9"), Cover=c(60,40,45,68,72))
However, I only want to use a subset of Cover.df for my analysis. The
samples I want to use are:
Samples.v <- c("MCUP1-2", "MCUP4-3","MCUP5-9")
How do I use index
Here is an example dataset:
ZoneCover.df<- data.frame(Value=c(1,2))
row.names(ZoneCover.df) <- c("Floodplain1.Tree", "Floodplain1.Shrub")
I want to Export the Row.Names to a column in the dataframe:
ZoneCover.df$ID <- names(ZoneCover.df)
which yields this:
> ZoneCover.df
V
Recently, I ran a series of Kruskal-Wallace tests [kruskal.test()] using by()
to group by site Output is a list:
>Herb.KW
Herb.df$ID: 10-1
Kruskal-Wallis rank sum test
data: Indicator_Rating by Year
Kruskal-Wallis chi-squared = 15.24, df = 7, p-value = 0.03302
--
, '[', 'p.value')
On Thu, Feb 18, 2010 at 5:21 PM, chipmaney <[hidden email]> wrote:
>
> I have run a kruskal.test() using the by() function, which returns a list of
> results like the following (subset of results):
>
> Herb.df$ID: 4-2
> Kruskal-Wallis ch
I have run a kruskal.test() using the by() function, which returns a list of
results like the following (subset of results):
Herb.df$ID: 4-2
Kruskal-Wallis chi-squared = 18.93, df = 7, p-value = 0.00841
Herb.df$ID: 44-1
This code works:
subset(NativeDominant.df,!ID=="37-R17")
This code does not:
Tree.df<-subset(NativeDominant.df,!ID==c("37-R17","37-R18","10-R1","37-R21","37-R24","R7A-R1","3-R1","37-R16"))
how do i get subset() to work on a range of values?
--
View this message in context:
http://n4.nabbl
typically, the apply family wants you to use vectors to run functions on.
However, I have a function, kruskal.test, that requires 2 arguments.
kruskal.test(Herb.df$Score,Herb.df$Year)
This easily computes the KW ANOVA statistic for any difference across
years
However, my data has multiple
Basically I need to use the following data to calculate a squared error for
each Sample based on the expected Survival for the zone.
Basically, this code has Live/Dead for each sample, and I need to calculate
the square error based on the Expected Mean (ie, Survival). The code looks
up the expec
#I have these data. Basically, I want to run a tapply to calculate the mean
and st. err. by factor.
#The problem is, I want to add a finite correction to the variance prior to
calculating the standard error.
#Now I know I could just do this in 3/4 steps by calculating the var,
applying the correct
I have a dataset. Initially, it has 25 levels for a certain factor,
Description.
However, I then subset it, because I am only interested in 2 of the 25
factors. When I subset it, I get the following. The vector lists only the
two factors, yet there remain 25 levels:
> Quadrats.df$Description
I have read all the help on axis scales, which seems to be much harder to
deal with than it should be, given how common the need to alter axes.
Anywayyeah, suppress the axis using yaxt then call and define the new
scale using axis().
The problem is, this doesn't change the actual axis, only
I am basically trying to append a value(vector) to one dataframe using a
relational value from another dataframe. Obviously, I can use a loop to
accomplish this. However, is there a way to vectorize it?
Example:
> data <- data.frame(c(1,1,1,2,2,2,3,3,3),rep(2,9)); names(data) <-
> c("Sample","
I wrote a function with some loops and avoided a third loop by using the "by"
function. The output object is an array (or list) of class "by" that looks
like this:
>StationCover.df
Empirical.df$Quadrat: VFFF9-21
Station Shrub Tree Woody Invasive Herb Litter Bare
[1,] 0.0 11
I have a function (see below). This function has one object, ID. If I run
the loops by themselves using a character value (ie,"VFFF1-7") instead of
the function object, then the loops work fine. However, when I try to
insert the character value via the function call, it doesn't work. I don't
ge
17 matches
Mail list logo