Displaying 20 results from an estimated 1000 matches similar to: "List extraction"
2009 Jul 13
1
Help get this simple function to work...
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
get an error, but the TotalCover.df dataframe does not update according to
the loop
2009 Aug 19
2
how do i vectorize relational queries in R
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","Score")
> meta <-
2009 Jul 13
2
Help me get this function to work...
I have a function (see below). This function has one object, ID. If I run the loops by itself using a character value (ie,"VFFF1-7"), 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 get an error, but the TotalCover.df dataframe does not update according to the loop criteria. Any obvious problems that
2011 Jan 09
1
Rectangle height in lattice xyplot key
Dear All
I have a problem with the height of the boxes in the key in the following.
(The text is over 2 lines to accentuate the problem of no space
between the rectangles.)
Is there an easy way to put a space between the rectangles; size
controls the width but there appears to be nothing for the height?
xyplot(1~1,
key = list(corner = c(0.8,0.8),
2010 Nov 09
2
new column from column in another df
If I have a data frame where a species occupies several rows with different
phases such as (both col's ar factors):
species,phase
Populus tremula,1
Populus tremula,2
Populus tremula,3
Calluna vulgaris,1
Calluna vulgaris,2
Betula alba,1
Betula alba,2
Betula alba,3
Primula veris,1
Primula veris,2
and another df where each species only have one row:
species,growth_form
Populus tremula,tree
Acer
2010 Feb 24
1
extracting results from wilcox_test (package::coin)
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
-----------------------------------------------------------------------------------------------------
Herb.df$ID: 18-1
2010 Feb 18
2
Extracting values from a list
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
Kruskal-Wallis chi-squared = 4.43, df = 6, p-value = 0.6187
So then, how do extract a vector
2008 Jan 15
1
error in my selection
Hi everybody,
Well, I really hoped that until now i know how to do a selection ..... but obviously i don't. So risking your laughing at me - here you go.
I have a table with lots of vegetation data, and one column specifies in which region the data is. There are only 2 regions, region 1 and region 3. I want to select all data that belong to region 1 and after do some xtabs on it. If i do
2008 Aug 29
1
significance of random effects in poisson lmer
Hi,
I am having problems trying to assess the significance of random terms
in a generalized linear mixed model using lme4 package. The model
describes bird species richness R along roads (offset by log length of
road log_length) as a function of fixed effects Shrub (%shrub cover) and
Width (width of road), and random effect Site (nested within Site
Cluster).
>From reading answers to previous
2010 Jan 27
2
using functions with multiple arguments in the "apply" family
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 sites on which KW needs to be run...
here's the data:
Herb.df<-
2003 Jul 22
1
Making a group membership matrix
Hi Helpers:
I have a factor object that has 314k entries of 39 land cover types.
(This object can be coerced to characters neatly should that be easier
to work with.)
> length(foo)
[1] 314482
> foo[1:10]
[1] Montane Chaparral Barren Red Fir Red Fir
[5] Red Fir Red Fir Red Fir Red Fir
[9] Red Fir Red Fir
39 Levels:
2010 Aug 26
3
Non-standard sorts on vectors
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 probably just create the vector of
2010 Jun 23
1
Shapefile
Hopefully the attachment will make it this time...
Hi:
I am practicing with the attached shapefile and was wondering
if I can get some help. Haven't used 'rgdal' and 'maptools' much
but it appears to be a great way bring map data into R.
Please take a look at the comments and let me know if I need to
explain better what I am trying to accomplish.
library(rgdal)
2006 Mar 04
1
replicated time series - lme?
Dear R-helpers,
I have a time series analysis problem in R:
I want to analyse the output of my simulation model which is proportional
cover of shrubs in a savanna plot for each of 500 successive years. I have
run the model (which includes stochasticity, especially in the initial
conditions) 17 times generating 17 time series of shrub cover.
I am interested in a possible periodicity of shrub
2012 Nov 28
3
Conditional model in R
Hello all,
I have a data set where the response variable is the percent cover of a
specific plant (represented in cover classes 0,1,2,3,4,5, or 6). This data
set has a lot of zeros (plots where the plant was not present).
I am trying to model cover class of the plant as a function of both total
nitrogen and shrub cover.
After quite a bit of research I have come across a conditional approach
2008 Jan 18
3
Problems with lattice plot
Hello useRs,
I have some problems when I try to plot a lattice. The lattice has 200
columns (X value) and 5 rows (Y value), with a total of 1000 squares. I
want to plot this lattice with the squares having different colours
according to a variable value.
The variable I want to plot is cover value of a shrub, and it has values
between 0 and 1. I want to plot the squares with value 1,
2010 Jul 29
2
Using '[' as a function
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
vectors in a list:
>example<- list(c(1,2),c(3,4),c(4,5))
[[1]]
[1] 1 2
[[2]]
[1] 3 4
2008 Dec 01
1
Spatstat - K2 index
Hi all,
I'm using spatstat to investigate the spatial structure of an arid shrub
population. The first-order intensity of my data does not appear to be
homogenous, so I would like to use inhomogeneous techniques. I realise
there is a inhomogeneous K-function available in spatstat, but there
doesn't not appear to be one for the pair-correlation function (O-ring
statistic). As such I was
2010 Jun 23
1
Plotting Data on a Map
Hi:
I am practicing with the attached shapefile and was wondering
if I can get some help. Haven't used 'rgdal' and 'maptools' much
but it appears to be a great way bring map data into R.
Please take a look at the comments and let me know if I need to
explain better what I am trying to accomplish.
library(rgdal)
library(maptools)
library(ggplot2)
dsn="C:/Documents and
2010 Feb 18
2
subset() for multiple values
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: