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$).
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
could not find
any info. on them in the R archives.
Thanks again
Mike
-Original Message-
From: jim holtman [mailto:jholt...@gmail.com]
Sent: Tuesday, March 22, 2011 1:00 PM
To: Hosack, Michael
Cc: r-help@R-project.org
Subject: Re: [R] Infinite loop
The simple thing to do is to put
Thank you so much Martyn. Now I can most likely avoid having to rerun my
program
multiple times.
Mike
-Original Message-
From: Martyn Byng [mailto:martyn.b...@nag.co.uk]
Sent: Tuesday, March 22, 2011 1:21 PM
To: Hosack, Michael
Cc: r-help@R-project.org
Subject: RE: [R] Infinite loop
R users,
I am trying to use a numeric vector to extract rows from a data frame. I want
to extract two rows
per unique WEEK (27 weeks) based on variable DOW_NUM by using pairs of vector
(s3) elements in the order
they appear. For example, vector initial elements 7 and 5 will be used to
R users,
I found a solution to my own question. I just needed to insert (j+(j-1)):(2*j)
as the indices for vector s3. No need to respond.
Thank you
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
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
-Original Message-
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Hosack, Michael
Sent: Wednesday, March 09, 2011 7:34 AM
To: r-help at R-project.org
Subject: [R] Complex sampling?
R users,
I am trying to generate a randomized
to
3:7 (i.e. DOW_NUMs). I know that
this must be relatively simple for someone out there and I would really
appreciate some help.
Thank you,
Mike
From: ajmac...@gmail.com [mailto:ajmac...@gmail.com] On Behalf Of Aaron Mackey
Sent: Wednesday, March 09, 2011 1:30 PM
To: Hosack, Michael
Cc: r
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
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
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
[mailto:dig...@ohsu.edu]
Sent: Friday, August 13, 2010 4:11 PM
To: Hosack, Michael
Cc: r-help@r-project.org
Subject: Re: assign multiple variables at once
On 8/13/2010 11:08 AM, Hosack, Michael wrote:
R Experts,
I would like to create a series of variables without having
to assign a separate
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 dataframe (DF)
contains
two groups of linked variables (ESP1:ESP9) and (ECRL1:ECRL9). Within ESP1:ESP9
are
abbreviated species codes (full dataframe contains 26
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
...@gmail.com]
Sent: Tuesday, July 20, 2010 1:41 PM
To: Hosack, Michael
Cc: r-help@r-project.org
Subject: Re: [R] ifelse() and missing values in test conditions
Hi Mike,
Probably the simplest way from what you have done would be to just set
any NA values in the column to 0:
DF$ANYEF[is.na(DF$ANYEF
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
__
R-help@r-project.org mailing
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,
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,
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
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.
Erich,
Thank you so much for the effort you put into writing this code.
I ran it and then assigned the two variables you created to the
'ARRIVE' and 'DEPART' variables of my dataframe as you directed and
the resultant calculations were incorrect. I am not sure why it did
not work, I do not yet
)
delays-as.vector(t(cbind(waitVec,travelVec)))
newtimes-format(start+cumsum(delays)*60,format=%H:%M:%S)
list(departs=c(arriveTime,(evens(newtimes))[-1]),
arrives=odds(newtimes))
}
Using the new definition of addDelays above should do the trick.
On 3/19/2010 5:30 PM, Hosack, Michael
Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thursday, March 18, 2010 10:31 AM
To: Hosack, Michael
Subject: offlist Re: [R] Dataframe manipulation
Here's why I am not taking this one one. You've been posting similar
problems for the last 6 months and you still have
Thank you Gustaf for your help! It worked perfectly. Now I just need to figure
out how you did it.
Petr, thank you for assisting me, but I could not get your approach to work.
Mike
__
R-help@r-project.org mailing list
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.
Hello everyone,
My progress has stalled on finding a way of creating a somewhat complicated
variable to add to my existing dataframe and I am hoping one of you could help
me out. The dataframe below contains only a fraction of the data of my complete
dataframe, but all of the variables. What I
Hello everyone,
My progress has stalled on finding a way of creating a somewhat complicated
variable to add to my existing dataframe and I am hoping one of you could help
me out. The dataframe below contains only a fraction of the data of my complete
dataframe, but all of the variables. What I
28 matches
Mail list logo