Displaying 20 results from an estimated 4000 matches similar to: "Conditional variable assignment"
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
2007 Jun 20
1
making a Time of Day axis
I am wrestling with time and date data. I came up with a way to plot and
label a histogram with "time of day" on the x-axis, but it seemed like a
lot more work than should be necessary. Is there a better way to do what
I am trying to do?
require(chron)
# read input data
data = read.table("input.dat", header=T)
# Create date-time and chron objects
datetime =
2010 Mar 05
2
How to assign week numbers to a time-series
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 want to do is add another variable named 'WEEK' to this dataframe that is assigned 1 for row 1
2010 Aug 13
1
assign multiple variables at once
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 codes). ECRL1 represents the
number of species x in variable ESP1 harvested, and so on through ESP9 and
2009 Mar 21
4
How to convert Mod/Tod to any video formats
Question:
1: What is .Mod and .Tod video?
2: How to convert .Mod and .Tod video to AVI, MPG, WMV, MPEG?
Answer:
1: .Mod and .Tod videos are mainly produced by digital harddisk camcorder such as JVC camcorder and so on. It is not common video formats and can only be played on some special players.
2:Tipard Mod Converter (http://www.tipard.com/mod-converter.html)Windows and Tipard Mod Converter for
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
2006 Nov 20
1
a little help needed plotting chron object
Hello there,
Using R 2.4.0 on Solaris (Unix):
I am trying to control the X axis range on a simple time of day plot.
I made a test program (below) that gets file time stamp information from
the files in the directory where R starts. The goal of the test program is
to plot the time of day of file creation on an x axis that spans a
user-specified range (like 12:00:00 to 15:00:00).
If I allow
2011 May 16
2
conditional rowsums in sapply
Hi all
I have a data frame with duplicate columns and i want to remove duplicates
by adding rows in each group of duplicates, but have lots of NA's.
Data:
dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4)
names(dfrm) <- c("a", "a", "b", "b", "b")
dfrm[3,2:3]<-NA
dfrm
a a b b b
1 1 1 1 1 1
2 2 2 2 2 2
3
2007 Jun 05
1
Calculating stride values?
All,
I have a question about calculating the value for the -E stride option
to mke2fs.
The mke2fs man page says
stride=stripe-size
Configure the filesystem for a RAID array with stripe-size filesystem blocks per stripe.
So stride = size of stripe/blocksize.
The size of a stripe is the RAID chunk size * the number of drives in the RAID.
My question: are parity disks
2013 Sep 20
5
[Bug 69594] New: NVA3 - Flash overlays all tabs
https://bugs.freedesktop.org/show_bug.cgi?id=69594
Priority: medium
Bug ID: 69594
Assignee: nouveau at lists.freedesktop.org
Summary: NVA3 - Flash overlays all tabs
Severity: normal
Classification: Unclassified
OS: Linux (All)
Reporter: tod.jackson at gmail.com
Hardware: x86-64 (AMD64)
Status:
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
2009 Sep 29
1
How to parsing data like this in R
Hi, R-users,
I met a problem:
Items:[Anna 'moi =) akku loppu joskus 4ltä. Kestää kauan nää..'\tAmer, Tuusula (0:20)\t20\t12\t16\t00\t00\t11]/Anne 'Ei jakoa,uus päivä muistio et 4n niin peruin. Hups'\t (0:16)\t0\t12\t18\t00\t00\t11/Elina 'Konsertissa. En tod. vastaa teille'\tEtu-Töölö, Helsinki (2:40)\t24\t12\t18\t00\t00\t11
I want to parsing the above data into the
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
2007 Apr 25
1
asterisk answering machine
I'm learning asterisk, and decided to make myself an answering machine
out of it. Seems pretty straightforward to use an agi (perl) to do what
I want.
What I want is:
Answer the phone.
check for time of the day
If TOD is during the time I sleep I announce i'm sleeping & prompt
caller to dial1 (or whatever) to connect to my extension & then go to
voicemail if busy/una,
2013 Sep 14
3
[Bug 69346] New: nouveau card permanently stays in D3 on VT switch with Optimus laptops
https://bugs.freedesktop.org/show_bug.cgi?id=69346
Priority: medium
Bug ID: 69346
Assignee: nouveau at lists.freedesktop.org
Summary: nouveau card permanently stays in D3 on VT switch with
Optimus laptops
Severity: normal
Classification: Unclassified
OS: Linux (All)
Reporter: tod.jackson at
2011 Sep 02
2
conditional replacement of character strings in vectors
Hello, I have a dataframe that looks like this:
a b NA Honduras China NA NA Sudan Japan NA NA Mexico NA Mexico
I would like to replace the NA values in column b with the non-NA values in
column a. I have tried a number of techniques, (if, ifelse) but I must have
the logic wrong.
Thanks
--
Josh
[[alternative HTML version deleted]]
2023 Oct 14
2
Create new data frame with conditional sums
Well, here's one way to do it:
(dat is your example data frame)
Cutoff <- seq(0, .15, .01)
Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p])))
I think there must be a more efficient way to do it with cumsum(), though.
Cheers,
Bert
On Sat, Oct 14, 2023 at 12:53?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote:
>
> This seems like it should be simple but I
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)