similar to: Creating dataframe of all possible variable combinations

Displaying 20 results from an estimated 5000 matches similar to: "Creating dataframe of all possible variable combinations"

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
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 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 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 Apr 20
5
Assigning Week Numbers
R experts, How could I extract the week number from a date vector (in Date class) such that week numbering (week 1...2...) begins (May 01) and ends (October 31) on the same specific dates each year? Week numbering must conform to the following day numbering format (Sat=1,Sun=2,Mon=3.....Fri=7). This means that new weeks must begin on Saturdays, and end on Fridays (except for the first date
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 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 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
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 Oct 01
3
Converting a dataframe column from string to datetime
Hi, I have a dataframe column of the form v<-c("Fri Feb 05 20:00:01.43000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:06.34000 2010") I need to convert this to datetime form. I did the following.. lapply(v,function(x){strptime(x, "%a %b %d %H:%M:%OS %Y")}) This gives me a list that looks like
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
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 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
2008 Dec 11
3
getting ISO week
Hi all, Is there a simple function already implemented for getting the ISO weeks of a Date object? I couldn't find one, and so wrote my own function to do it, but would appreciate a pointer to the "default" way. If a function is not yet implemented, could the code below be of interest to submit to CRAN? Best Regards, Gustaf --------------------
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
2013 Oct 04
2
Possible POSIXlt / wday glitch & bugs.r-project.org status
Wanted to raise two questions: 1. Is bugs.r-project.org down? I haven't been able to reach it for two or three days: ``` ping bugs.r-project.org PING rbugs.research.att.com (207.140.168.137): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3 Request timeout for icmp_seq 4 Request timeout for icmp_seq 5
2009 Nov 01
4
convert list to Dataframe
Hi. I have a huge list called twitter: > dim(twitter) NULL > str(twitter) List of 1 $ :Classes 'PlainTextDocument', 'TextDocument', 'character' atomic [1:35575] 11999;10:47:14;20;10;2009;ObamaLouverture;Trails Mixed Lessons For Governance From Campaigner-in-chief: President obama jumps campaign 09 tuesday..
2007 Dec 17
4
wday not honored in cron trigger
Hey guys, I was playing with the cron trigger, and I noticed that wday is not honored. Looking at the code confirms this. Has anyone else seen this? Thanks Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071217/44d3a8a6/attachment.html
2009 Jan 26
2
heatmap with levelplot
Hi there, I'd like to create a heatmap from my matrix with a) a defined color range (lets say from yellow to red) b) using striking colors above and below a certain threshold (above = "green", below = "blue") Example matrix (there should be a few outliers generated...) + simple levelplot without outliers marked: library(lattice) my.mat <- matrix(rnorm(800), nrow =
2007 Oct 15
3
for loop if else conditional
date <- as.POSIXlt(Sys.time()) #present date for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01")) if (date$wday != 0 & date$wday != 6) {print(date);assign("date", (date-86400))} else (assign("date", (date-86400))) I am trying to print dates from present day to a day in the past, but omitting weekends. I am not doing something right, but can't