similar to: Joining variables

Displaying 20 results from an estimated 3000 matches similar to: "Joining variables"

2006 May 16
3
subset
Hello everyone, I have a large dataset (x) with some rows that have duplicate variables that I would like to remove. I find which rows are the duplicates with X1<-which(duplicated(x)). That gives me the rows with duplicated variables. Now, how can I remove just those rose from the original data frame. I think I can create a new data frame without the duplicates using subset. I have tried:
2006 Oct 19
2
randomize a matrix
Hello everyone, If I have an incidence matrix of 0 and 1's P=[1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0] I want to create a new uniform random matrix [a] that is filled with 0's and 1's but constrained so that the row and column sums are the same as in [P]. Does anyone know how to accomplish this? Thanks in advance Cameron Guenther, Ph.D.
2006 May 10
3
Unique?
Hello, I have sample data set that looks like: YEAR MONTH DAY CONTINUE SPL TIMEFISH TIMEUNIT AREA COUNTY DEPTH DEPUNIT GEAR TRIPID CONVUNIT 1992 1 26 1 SP0073928 8 H 7 25 4 NA 1000000 02163399054 161 1992 1 26 1 SP0073928 8 H 7 25 4 NA 1000000 02163399054 8 1992 1 26 2 SP0004228 8 H 7 25 4 NA 1000000 02163399054 161 1992 1 26 2 SP0004228 8 H 7 25 4 NA 1000000 02163399054 8 1992
2005 Nov 21
3
Warning message help
I am trying to great a new column of effort data from an existing vector of gears used. It is a simple code where effort[Gear==300]=(DIST_TOW*7412) effort[Gear==301]=(DIST_TOW*7412) The code appears to work for some of the data but fails for others and inserts a NA value I also get this warning message Warning message: number of items to replace is not a multiple of replacement length Can
2005 Oct 18
3
Repeating lines in a data frame
Hello, I have a much larger dataset that is similar in form to: year species length count 1998 1 150 1 1998 2 200 1 1998 3 250 2 1999 1 150 3 1999 2 200 4 1999 3 250 5 2000 1 150 1 2000 2 200 1 2000 3 250 1 2001 1 150 2 2001 2 200 3 2001
2006 May 03
4
Aggregate?
Hello, I have a data set with a grouping variable (TRIPID) and several other variables. TRIPID is repeated in some areas and I would like to use a function like aggregate to sum the variable UNITS according to TRIPID. However I would also like to retain the other variables as they are in the data set with the new summed TRIPID. So what I have is something like this: YEAR MONTH DAY
2006 May 03
4
Aggregate?
Hello, I have a data set with a grouping variable (TRIPID) and several other variables. TRIPID is repeated in some areas and I would like to use a function like aggregate to sum the variable UNITS according to TRIPID. However I would also like to retain the other variables as they are in the data set with the new summed TRIPID. So what I have is something like this: YEAR MONTH DAY
2006 Mar 27
1
Glm poisson
Hello, I am using the glm model with a poisson distribution. The model runs just fine but when I try to get the null deviance for the model of the null degrees of freedom I get the following errors: > null.deviance(pAmeir_1) Error: couldn't find function "null.deviance" > df.null(pAmeir_1) Error: couldn't find function "df.null" When I do: >
2006 Sep 26
1
How to "Pack" a matrix
Hello, Suppose I have a matrix a where a= sp1 sp2 sp3 sp4 sp5 sp6 site1 1 0 1 1 0 1 site2 1 0 1 1 0 1 site3 1 1 1 1 1 1 site4 0 1 1 1 0 1 site5 0 0 1 0 0 1 site6 0 0 1 0 1 0 And I want to pack that matrix so that the upper left corner contains most of the ones and the bottom right corner contains most of the zeros so that matrix b is b= sp3 sp6 sp4 sp1 sp2 sp5 site1 1 1 1 1 0 0 site2
2006 Apr 06
1
Evaluating a function with another function
Hello all, I hope someone can help me with this. I have function that calculates two values based on input data. A simple example follows: test<-function(x,s,rangit=seq(0,10,1)) { rangit<-rangit y<-vector() p<-vector() for(i in 0:length(rangit)){ y[i]<-x+s[1]+rangit[i] p[i]<-x+s[2]+rangit[i] } return(data.frame(rangit,y,p)) } And returns the following: rangit y p 1
2006 Sep 19
1
-Need help with function
Hello everyone, I have a function here that I wrote but doesn't seem to work quite right. Attached is the code. In the calib funcion under the for loop Bt[i+2]<-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] returns NA's for everything after years 1983 and 1984. However the code works when it reads Bt[i+2]<-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i]. I don't quite understand why since it should be
2006 Sep 20
1
help with function
Hello everyone, I have a function here that I wrote but doesn't seem to work quite right. Attached is the code. In the calib funcion under the for loop Bt[i+2]<-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i+1] returns NA's for everything after years 1983 and 1984. However the code works when it reads Bt[i+2]<-(1-m)*Bt[i+1]+Rt[i]*Rerr-Ct[i]. I don't quite understand why since it should be
2005 Nov 10
2
IF/Else
Hi, I am trying to write a for loop with if else statements to calculate biomass density estimates for different types of sampling gear. My code is: bmd=for (i in 1:length(Gear)){ if (Gear==20) {bioden=Biomass/141} else {if (Gear==23) {bioden=Biomass/68}} else {if (Gear==160) {bioden=Biomass/4120}} else {if (Gear==170) {bioden=Biomass/2210}} else {if (Gear==300)
2006 Nov 28
5
Counting zeros in a matrix
Hi All, If you could help me with this problem I would greatly appreciate it. Suppose I have a matrix A: 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 I would like, for each row, to sum the number of times a 0 appears in front of a 1. So what I would like is to have Sum 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 0 2 1 0 1 0 0 1 0 0 0 2 1 1 0 0 0 0 1
2006 Nov 30
3
Expression
Hi all, I have a question about expression. In a figure I want to include the term D*obs with the star as as superscript and obs as subscript. I have even just tried to get the star to be superscript. The code I tried was text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I get a syntax error. I can't seem to find anything in the help files that explains it.
2005 Oct 25
1
file size limit for importing SAS file
Does anyone know if there is a file size limit for inputting a SAS data set? The file size I am trying to import is 184 MB. The code is: >library("foreign") > > sashome<-"C:/Program Files/SAS Institute/SAS/V8" > input.data<-read.ssd( file.path("G:/DATA/Cam/ECPATH/FIM"),"tbm_c", + sascmd=file.path(sashome,"sas.exe")
2007 Mar 05
1
Matrix/dataframe indexing
Hi all, I am hoping someone can help me out with this: If I have dataframe of years and ages and the first column and first row are filled with leading values: Df<- age1 age2 age3 Yr1 1 0.4 0.16 Yr2 1.5 0 0 Yr3 0.9 0 0 Yr4 1 0 0 Yr5 1.2 0 0 Yr6 1.4 0 0 Yr7 0.8 0 0 Yr8 0.6 0 0 Yr9 1.1 0 0 Now the rest of the cells need to be filled according to the previous year and age
2010 Feb 05
2
glm models with more than one response
Hi everyone, I am trying to construct a glm and am running into a couple of questions. The data set I am using consists of 6 categories for the response and 6 independent predictors representing nutrient concentrations at sample point locations. Ultimately I'd like to use the probabilities for each response category in a simulation model such that these probabilities are used to define a
2007 Mar 02
0
Matrix looping
Hi all, I am having a problem getting my fucntion to work correctly. Here is my problem. I have three ages: Nage<-c(1,2,3) I have an weight matrix: Wt<-c( 0.04952867, 0.23808432, 0.34263880) I have an age schedule of maturity: Mat<-c(0,1,1) where 0 is not mature, and 1 is mature I have a vulnerability schedule: Vul<-c(0,1,1) I have an survivorship schedule:
2005 Apr 21
2
Deciles and R
Hi everyone, I'm a new R user (if this is a really basic question, please do excuse me...) and I'm having some questions regarding a deciles problem. I have a variable which I need to categorize according to its deciles (X). However, this categorization should be made into another variable (call it NewVar). Ex. for the quartiles case (just for the sake of exposition, since I need