similar to: Assigning a sequence to a subsetted data frame variable

Displaying 20 results from an estimated 1400 matches similar to: "Assigning a sequence to a subsetted data frame variable"

2007 May 07
1
Predicted Cox survival curves - factor coding problems..
The combination of survfit, coxph, and factors is getting confused. It is not smart enough to match a new data frame that contains a numeric for sitenew to a fit that contained that variable as a factor. (Perhaps it should be smart enough to at least die gracefully -- but it's not). The simple solution is to not use factors. site1 <- 1*(coxsnps$sitenew==1) site2 <-
2010 Mar 25
4
Creating dataframe of all possible variable combinations
Hello, I need to create a dataframe containing all possible combinations of three variables: SITE (101,102,103,104), WDAY (MON,TUE,WED,THR,FRI), and TOD (MORN, AFTN). There should be a total of 40 unique combinations in my dataframe. I used expand.grid() successfully(?) to create my dataframe, but then when I went to order it by SITE, the resultant dataframe only contained four rows, one for each
2012 Oct 30
4
multi tenant
Hi all, I need to configure DIDs for different companies and they should reach on different extension with different context. Cant we have same extension in different context? This is what we we want Company A: Context Company_A IVR Company A Extensions: 101,102,103,104 etc. Company B: Context Company_B IVR Company B Extensions: 101,102,103,104 etc. Company C: Context Company_C IVR Company
2010 Mar 12
6
Randomly sampling subsets of dataframe variable
Fellow R users, I am stumped on what would seem to be something fairly simple. I have a dataframe that has a variable named 'WEEK' that takes the numbers 1:26 (26 week time-period) with each number repeated five times consecutively (once for each weekday, Monday through Friday). Ex. 111112222233333.....2626262626. I would like to randomly extract two weekdays per five day week for
2010 Mar 23
3
Converting date format
R community: Hello, I would to like to convert a character date variable from %m/%d/%Y to %m/%d/%y. Any advice would be greatly appreciated. I have tried functions for changing the formatting and removing the unnecessary digits without success. Mike
2011 Mar 22
2
Infinite loop
R experts, Hello, I am trying to sample a vector 1:40 without replacement such that no element in the new vector is within 7 units of either of its immediate neighbors. This is part of a larger program I am working on. The following code works well about 65 % of the time (14/40). The problem I encounter happens when the last element remaining to be sampled from the vector STRATA is within 7
2010 Mar 18
2
Dataframe manipulation
Hello R users, I spent most of my workday yesterday trying unsuccessfully to write code that will perform a series of calculations on my dataframe (partial copy is attached). What I need to do is multiply the 24 hr time in the 'DEPART' column by the time (in the 'TRAVEL' column (travel time in minutes), and store this result in the 'ARRIVE' column for the following
2010 Apr 19
1
Week number calculation
R community, How could I extract the week number from a date vector (in class Date) such that week numbering (week 1...2...) begins (May 01) and ends (October 31) on the same specific dates each year? Thank you, Mike
2010 Jul 20
1
ifelse() and missing values in test conditions
R experts, I have been unable to get the following ifelse statement to work as desired when applied to my data frame. Example: DF$ANYEF <- with(DF,ifelse(PSOUGHT1=='ANY'|PSOUGHT2=='ANY'|PSOUGHT3=='ANY',PEFF,0)) ##### this statement will be replicated 16 times for 16 unique _EF variables ### Basically, I want each ANYEF for each row to equal the corresponding row
2010 Mar 17
3
Adding minutes to 24 hour time
Hi, Does anyone know how to add minutes (up to 100 min) to a 24 hour time, to create a new 24 hour time? I can't seem to find any documentation or examples explaining how to do this. The variables of interest are 'ARRIVE','WAIT', and 'DEPART' in the attached partial dataframe. I want 'DEPART' to be the "sum" of 'ARRIVE' and 'WAIT' in
2014 Jun 24
1
share mailbox Asterisk 1.8.22
Hello, I want to share mailbox between two extensions Ext. 101 Ext. 102 I want the messages to go to mailbox 101, when when checked mailbox from extension 102 to be able to clear the bliking red light. here is extensions.conf exten => 102,hint,SIP/${EXTEN} exten => 102,1,Dial(SIP/101&SIP/102,20,t) exten => 102,2,Voicemail(101,u) exten => 102,102,Voicemail(101,b) exten =>
2011 Jan 17
1
filling in datasets of differing lengths
g''day all, I need help with this please. I have a dataset of site names and years they were trapped in (a subset of it is bs, below) and a dataset of sites that actually caught animals (subsetted as brep, below). I need to add to brep, a row with a zero in the classcount column, for every year each site was trapped but caught nothing. so for Site 1, I need to add rows that say
2007 May 04
0
Predicted Cox survival curves - factor coding problems...
I am trying to use the survfit() function with the newdata argument to produce predicted survivor curves for a particular covariate profile. The main purpose of the plot will be to visualise the effect of snp1, coded 0 and 1. In my Cox model I have stratified by one variable, edu, and so I know I will automatically get a separate curve for each strata. My problem is how to deal with the
2012 Oct 22
2
Assigning values to several consecutives rows in a sequence while leaving some empty
Hello all, I'm trying to group several consecutives rows (and assigning them the same value) while leaving some of the rows empty (when a certain condition is not fulfilled). My data are locations (xy coordinates), the date/time at which they were measured, and the time span between measures. Somehow simplified, they look like this:
2003 Oct 22
3
Subsetted 1-D arrays (PR#4110)
In R-patched_2003-10-20, subsetted 1-D arrays no longer get converted to vectors. The NEWS file documents this change, as an indirect result of bug report 4110. I just wanted to mention this can break code in some rather obscure ways, such as this toy example: R> x <- sort(tapply(1:8, rep(1:4,2), sum)) # Was vector, now is 1D array R> y <- matrix(1:4, 1,4) #
2011 Apr 30
3
Copying to R a rectangular array from a Java class
Bare test code: My simple Java test class source and R test code follow: public class RJavTest { public static void main(String[]args) { RJavTest rJavTest=new RJavTest(); } public final static String conStg="testString"; public final static double con0dbl=10000001; public final static double[]con1Arr=new double[] { 10001,10002,10003,10004,10005,10006 }; public final static
2009 Jul 29
0
Maximizing values in subsetted dataframe
Dear List, I am trying to sub-sample some data by taking a data point every x minutes. The data contains missing values, and I would like to take the sub-sample that maximizes the number of valid points in the sample. I.e. minimizes the number of NA's in the data set. For example, given the following: da<-seq(Sys.time(),by=1,length.out=10) x<-c(1,2,NA,4,NA,6,NA,8,9,10)
2001 Oct 04
2
Characters subsetted with NA (was: Several R vs S-Plus issues)
Hello, R-devel! I posted to R-help, and (inappropriately) to R-bugs, this R/S-Plus difference: > LETTERS[c(NA,2)] in S is c("","B"), but in R is c("NA","B") Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> wrote: > I think we do not want to change this. ... > R> is.na(LETTERS[c(NA,2)]) [1] TRUE FALSE > so we really have NA but it is
2008 Apr 10
1
adonis (vegan package) and subsetted factors
Hi, I'm trying to use adonis on a subset of data from a dataframe. The actual data is in columns 5:118, and the first four columns are various factors. There are 3 levels of the factor Habitat, and I want to examine differences among only two of them. So I started with: > CoastNear = subset(gel_data, Habitat != "I") The resulting data.frame has three levels for Habitat, but
2010 Mar 19
2
Dataframe calculations
Hi everyone, My question will probably seem simple to most of you, but I have spent many hours trying to solve it. I need to perform a series of sequential calculations on my dataframe that move across rows and down columns, and then repeat themselves at each unique 'MM' by 'DD' grouping. Specifically, I want to add 'DEPART' time (24 hr time) to 'TRAVEL'(minutes)