similar to: Extract subset of rows

Displaying 20 results from an estimated 10000 matches similar to: "Extract subset of rows"

2010 Oct 15
1
Random assignment
Dear List, I am doing some simulation in R and need basic help! I have a list of animal families for which i know the number of species in each family. I am working under the assumption that a species has a 7.48% chance of being at risk. I want to simulate the number of species expected to be at risk under a random binomial distribution with 10,000 randomizations. I am relatively knew to
2010 Oct 18
1
Randomly shuffle an array multiple times
Dear List, I have a table i have read into R: Name Yes/No John 0 Frank 1 Ann 0 James 1 Alex 1 etc - 800 different times. What i want to do is shuffle yes/no and randomly re-assign them to the name. I have used sample() and permute(), however there is no way to do this 1000 times. Furthermore, i want to copy the data into a excel spreadsheet in the same order as the data was input so i can
2005 Jul 08
2
removing factor level represented by less than x rows
In a number of different situations I'm trying to remove factor levels that are represented by less than a certain number of rows, e.g. if I had the dataset aa below and wanted to remove the species that are represented in less than 2 rows: data(iris) aa <- iris[1:101,] In this case, since I can see that the species virginica only has one row, I can write: table(aa$Species) setosa
2007 Aug 31
1
Strange behavior using subset
Dear R Gurus, Let's get the technical details out of the way first: Computer: 1.83 GHz MacBook R version 2.5.1 I have a data set that contains the following variables: site, species, total.vines. I need to partition the main data set by site, the further select only those species that occurred at each site. When I select by site (site.name<-subset(data frame,Site=="Site
2011 Jan 06
3
Extract data
Dear List, I have a data frame called trait with roughly 800 species in, each species have 15 columns of information: Species 1 2 3 etc.. a t y h b f j u c r y u etc.. I then have another data frame called com with the composition of species in each region, there are 506 different communities: community species NA1102 a NA1102 c NA0402 b NA0402 c AT1302 a AT1302 b etc.. What
2007 Jul 08
1
generating a data frame with a subset from another data frame
R gurus, I have a data set that looks something like this: Site Species DBH #Vines G PLOC 45.9 4 G ACNE 23.3 1 G ACNE 12.0 0 G FRAM 35.9 5 G AEGL 11.2 2 N PLOC 77.3 12 N JUNI 78.6 7 N ACNE 18.9 1 N ACNE 15.7 3 N ACRU 35.5 4 H ACSA2 24.1 6 H ULAM 35.2 7 There are 730 individual trees (22 species) from four sites in the actual data set. I would like to create a second data frame that
2004 Dec 06
1
using subset
Hi, I have doubts in using subset command. I have a list of, lets say, 15 species and I want to make a subset with only 2 of them. I??m the command data2 <- subset(data1, species=="sp1"|species=="sp2") Nevertheless, when I ask for the summary (summary(data2)) the others species names still apearing. Also I tried data2<-data1(data1$species %in%
2005 Feb 09
4
subset
Dear all, I am trying to extract rows from a data.frame based on the rowSums != 0. I want to preserve rownames in the first column in the subset. Does anyone know how to extract all species that don't have rowSums equal to zero? Here it is: # dataset x <- data.frame( species=c("sp.1","sp.2","sp.3","sp.4"), site1=c(2,3,0,0), site2=c(0,0,0,0),
2012 Apr 25
1
fill a dataframe with zeros where the rows are a smaller subset of a larger dataframe (species by site)
row <- c("a","b","c","d","e","f","g") #rows from larger data frame row.1 <- c("a","b","c","g") #rows of smaller data frame because d, e, and f don't contain any of the species, but the zeros are important x <- data.frame(sp1=rnorm(4), sp2=rnorm(4), sp3=rnorm(4),
2008 Dec 17
4
passing arguments to subset from a function
Hello R-helpers, I'm writing a long function in which I manipulate a certain number of datasets. I want the arguments of said function to allow me to adapt the way I do this. Among other things, I want my function to have an argument which I will pass on to subset() somewhere inside my function. Here is a quick and simplified example with the iris dataset. myfunction<-function(table,
2010 Jun 05
1
selecting only specific rows in R
Hi, I have a data frame with columns as follows: tree species (independent variable) and several dependent variables (e.g. carbon, nitrogen, phosphorus). Each row represents one tree sample. Some tree samples are unique species in the data frame while other species were replicated (i.e. rows 1,2,3 may be identical for the "tree species" column but have different values for the
2011 Apr 20
3
[test message] Can R replicate this data manipulation in SAS?
Apologies for troubling the list, but it is a test that needs to be carried out. I am resending the message that I sent earlier on behalf of Paul Miller, but with a certain word used in the variables names of the SAS code changed to a different word. With thanks for your tolerance ... Ted. [*** PLEASE NOTE: I am sending this message on behalf of Paul Miller: Paul Miller <pjmiller_57 at
2007 Dec 07
1
Adding a subset to a glm messes up factors?
Hi everyone, I have a problem with running a glm using a subset of my data. Whenever I choose a subset, in the summary the factors arent shown (as if the variable was a continuous variable). If I dont use subsets then all the factors are shown. I have copied the output from summary for both cases. Thanks for the help, Muri > model<-glm(log(cpue)~year,family=gaussian) Call: glm(formula =
2011 Jan 06
1
Multiple subsets of data
Dear List, I have a data frame called trait with roughly 800 species in, each species have 15 columns of information: Species 1 2 3 etc.. a t y h b f j u c r y u etc.. I then have another data frame called com with the composition of species in each region, there are 506 different communities: community species NA1102 a NA1102 c NA0402 b NA0402 c AT1302 a AT1302 b etc.. What
2007 Jul 02
4
Extracting sums for individual factors in data frames
I have a data frame with two columns, one of which is a factor (Species) and the other is numeric (BA, which stands for basal area). Here's a sample: Species BA ACSA 55.7632696 FRAM 122.9933524 ACSA 67.54424205 ACSA 89.22123136 ACSA 82.46680716 ACSA 22.46238747 ACSA 19.94911335 ACSA 20.42035225 ACSA 19.00663555 ACSA 21.67698931 ACSA 57.80530483 ACSA 30.31636911 Dead 43.98229715 Dead
2003 Oct 22
1
0-only-rows in correspondence analysis
Hello, I am looking for a workaround of "species empty" plots in a correspondence analysis. I tried to do a community structure analysis with a ca via decorana(), ca() and CAIV(), but none of them allow 0 only-rows. I have species (abs./pres) in columns and sites in rows sp1 sp1 sp3 ... plot1 0 1 1 plot2 0 0 0 plot3 1 0 1 ..... but on some plots no
2010 Jul 18
2
simple loop(?) analysing subsets
Hi All, I have a large data set with many columns of data. One of these columns is a species identifier and the remainder are variables such as temperature or mass. Currently I am carrying out a single regression on subsets of the data set, e.g. separated data sets with only the data from one species at a time. I have been searching for a thread that will help me to understand how best to repeat
2009 Sep 14
1
How to extract partial predictions, package mgcv
Dear package mgcv users, I am using package mgcv to describe presence of a migratory bird species as a function of several variables, including year, day number (i.e. day-of-the-year), duration of survey, latitude and longitude. Thus, the "global model" is: global_model<-gam(present ~ as.factor(year) + s(dayno, k=5) + s(duration, k=5) + s(x, k=5) + s(y, k=5), family =
2010 Feb 03
1
Calculating subsets "on the fly" with ddply
Hi, [I sent this to the plyr mailing list (late) last night, but it seems to be lost in the moderation queue, so here's a shot to the broadeR community] Apologies in advance for being more verbose than necessary, but I'm not even sure how to ask this question in the context of plyr, so ... here goes. As meaningless as this might be to do with the `iris` data, the spirit of it is what
2012 May 10
6
averaging two tables (rows with columns)
Hi R user,I am struggling to figure out on how I can calculate the average from the two tables in R. Any one can help me? really your help would be grateful- I am spending so much time to figure it out. It should not be so hard, I think. I have very big data but I have created a hypothetical data for simplification. for example I have : table 1 table 1: species occurance data