search for: mhosack

Displaying 20 results from an estimated 22 matches for "mhosack".

Did you mean: hosack
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 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
2010 Mar 15
1
Assigning a sequence to a subsetted data frame variable
Hey folks, I have a difficult (at least for me) problem that I was hoping one of you may know how to solve. I want to assign a sequence to subsets of a variable in a data frame based on date. The variable is 'SITE1' and the date is a unique day (DD) and month (MM) combination. The sequence contains site numbers 101:104, and each day-month combination takes four site numbers from that
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
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 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)
2010 Mar 24
0
R-help ordinal regression
...http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, > reproducible code. > > > > > > ------------------------------ > > Message: 22 > Date: Tue, 23 Mar 2010 10:10:50 -0400 > From: "Hosack, Michael" <mhosack at state.pa.us> > To: "R-help at r-project.org" > <R-help at r-project.org> > Subject: [R] Converting date format > Message-ID: > ??? <E41D7FA2CA85D6448617E05E0F9A05569B8F328A6C at ENHBGMBX07.PA.LCL> > Content-Type: text/plain; charset="us-ascii"...
2011 Feb 04
1
read.table error
R experts, I am working with a fairly large data set comprised of 563 rows by 116 columns including several different modes. I have been unable to read in the data set completely using the read.table function and the RGui (i.e. nearly half the total number of rows are missing from the data set along with the column names). The data does read in fully using Tinn-R's Rterm; however, at several
2010 Aug 20
0
Reshape package and variable assignment
R Experts, I would like to create a series of variables without having to assign a separate line of code for each new variable. My abbreviated dataframe (DF) contains two groups of linked variables (SP1:SP3) and (CAU1:CAU3). Within SP1:SP3 are character codes (full dataframe contains 26 unique codes and SP1:SP9, CAU1:CAU9). CAU1 represents the quantitative measurement of code x in variable
2010 Mar 10
0
FW: How to assign week numbers to a time-series (additional question)
I want to thank everyone who has provided me advice on how to solve this problem, it was all very helpful. However, I am still left with one issue remaining. All of the methods provided still require me to input the origin date, which to lead to correct week number assignment, must be the last Saturday prior to the survey start date of May 01 or May 01 if that date happens to be a Saturday. I
2010 Mar 10
0
How to assign week numbers to a time-series (duplicate message in plain text formatting)
I want to thank everyone who has provided me advice on how to solve this problem, it was all very helpful. However, I am still left with one issue remaining. All of the methods provided still require me to input the origin date, which to lead to correct week number assignment, must be the last Saturday prior to the survey start date of May 01 or May 01 if that date happens to be a Saturday. I
2011 Jun 14
0
sqlFetch and factor conversion
R users, Hello, I used sqlFetch to import a data table from MS Access 2007 and I set as.is = TRUE to prevent character vectors from becoming factors. However, I can't figure out how to prevent the $ operator from being added by sqlFetch to the end of each character vector(e.g. TD$ and SITE$). This causes subsequent parts of my code not to work and also results in some behavior that I
2010 Mar 16
2
Conditional variable assignment
Hi everyone, Once again I am stuck with a problem I can't seem to figure out. I suppose this learning curve levels off eventually, lol. I am learning on my own with absolutely no background in programming, so if I seem to request help a lot it's not because I am seeking others to do the work for me. I need to assign one of two arrival times to the 'ARRIVE' variable of my
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
2011 Feb 10
1
Conditional sampling
R experts, I need to sample two rows without replacement from the following data frame such that neither row contains the same 'DOW'. For example, I cannot select both a Monday morning and a Monday afternoon. I am using STRATA_NUM as an index to randomly select rows from, since this variable indexes all unique permutations of DOW, SITE, and TOD. I know how to use the sample function
2011 Feb 17
0
Data frame sampling
R users, I have been trying to write a program in R that will extract rows from a data frame and combine the rows into a new smaller data frame while meeting several criteria. I would greatly appreciate any advice that could help me get started down the right path. What I want to do is to extract two rows WEEK (26 weeks total) from the data frame by sampling without replacement from the
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
2011 Mar 09
2
Complex sampling?
R users, I am trying to generate a randomized weekday survey schedule that ensures even coverage of weekdays in the sample, where the distribution of variable DOW is random with respect to WEEK. To accomplish this I need to randomly sample without replacement two weekdays per week for each of 27 weeks (only 5 are shown). However, I need to sample from a sequence (3:7) that needs to be