similar to: finding the row(s) for a date in a data frame

Displaying 20 results from an estimated 1000 matches similar to: "finding the row(s) for a date in a data frame"

2009 Jan 21
1
finding row and column indices of date in multiple columns of a data frame
Hi, I have a data.frame SAMPLES with columns: Site Site# Season Day1 Day2 Day3 Day1, Day2, Day3 are class "Date", the other columns are numeric or factor. I have a date "mydate" that may or may not be listed in my data.frame and I need to find that out. If "mydate" is there, I want to get the number of the data.frame row where it occurs.
2001 Oct 26
3
question about anova() output
Hello, I am getting output from anova() and summary(aov()) that depends on the order of the factors in the fitted model object, and this has me baffled. I see this dependency with the data.frame below but not with an example (table 6.4) from Montgomery's DOE book. This is with R 1.3.0 on Debian GNU-Linux. Where have I gone wrong? > centerpts run sample CH50mg 1 day1 dev126 0.56 2
2013 Apr 21
2
how to import several files every day
Hi All I want to import several .dat files every day of the week from the same folder. Let say, on day 1, I have about 100 files in the folder. By using this code, everything works perfectly (maybe there is a more efficient way to do it): filenames <-list.files(path="pathtofile", full.names=TRUE) library(plyr) import.list <- llply(filenames, read.table, header=TRUE,
2009 Jun 01
1
Reshaping Data
Hi, i did a mistake with my first post. I have to reshape data from this matrix: id x1 x2 x3 x4 day1 day2 day3 day4 day5 day6 day7 day8 day9 1 0.129 0.797 0.231 0.615 4 4 1 1 1 1 3 3 3 2 0.420 0.376 0.501 0.282 4 4 4 4 5 4 2 5 5 3 0.377 0.486
2011 Nov 01
1
Counting entries to create a new table
Hi, I am an R novice and I am trying to do something that it seems should be fairly simple, but I can't quite figure it out and I must not be using the right words when I search for answers. I have a dataset with a number of individuals and observations for each day (7 possible codes plus missing data) So it looks something like this Individual A, B, C, D Day1 1,1,1,1 Day 2 1,3,4,2 Day3
2002 Nov 01
1
Reshape function
Can someone help me with the proper usage of the reshape function? Let's say I have a dataset with columns like this (wide format): Id Sex Group Test Day1 Day 2 Day 3... And I want to transpose this into something like this (thin): Id Sex Group Test Time Where the new column labeled time contains all the time variables (Day 1, Day 2, Day 3...) that were in the wide
2008 Jul 31
2
S 3 generic method consistency warning please help
I would like to include this in a package. The S3 methods on R CMD check says * checking S3 generic/method consistency ... WARNING window: function(x, ...) window.chron: function(data, day1, hour1, day2, hour2, ...) See section 'Generic functions and methods' of the 'Writing R Extensions' manual. I have looked and can not figure it out. This function is for convience. What
2007 Aug 17
4
matching elements from two vectors
Hi, Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with elements (2,3). I need to find out what elements of x match any of the elements of y. Is there a simple command that will return a vector with elements (F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with dataframe colums as well. I have tried x==y and it doesn't work. x==any(y) doesn't work
2010 May 21
4
indexing problem
Dear group, Here is my environment : > ls() [1] "l" "PLglobal" "Pos100415" "Pos100416" "Pos100419" "Pos100420" "position" "select" "Trad100415" "Trad100416" "Trad100419" "Trad100420" "trade" "y" With objects : > l [1]
2007 Aug 21
2
extracting month from date in numeric form
Hi, Anyone knows what would be a short way of extracting a month from a date in numeric or integer format? months("1979-12-20") returns "December" in character format. How could I get 12 in numeric or integer format? Thanks! G. [[alternative HTML version deleted]]
2009 Sep 11
1
help with plotting
HI all, raw_urine = read.table("Z:\\bruce.9.3.09.sample.stability.analysis\\urine\\mz.spot.sam.dat.new", header = TRUE ) pvalue = read.table("Z:\\bruce.9.3.09.sample.stability.analysis\\urine\\all.urine.features.t.test.result", header = TRUE ) library(compositions) p = function(a,b){ y = pvalue[,a] if(y<0.01){ index = which(y, arr.ind=TRUE) day1 = raw_urine[index,3:7] day2 =
2006 May 31
0
Ruby on Rails Workshop in Kansas City !
Ruby on Rails Workshop ------------------------------------ Kansas City Ruby User''s Group (http://kcrug.org/) proudly presents the first "Ruby on Rails Workshop" for those eager to get started into Ruby on Rails. This one-and-half-day workshop will offer a quick introduction to Ruby and the Ruby on Rails web application framework. Sponsored by Reevik, Inc., it will
2012 Mar 15
1
Bar graph with 2 Y axis
Dear R users,   I need to draw a barplot with 2 Y axis. I have 3 days each of wich having 2 groups (and error bar for each of them). The height of the 3rd day is too tall compared to others. That's why I have to use a second Y axis for that. I am using  "barplot2" function of "gplots" library (to be able to add error bars as well). Data and  codes currently I am using is
2010 May 26
0
substitution in a function
I have the following function defined as below match.trace <- function(dfobj, distance, day1, day2) { day1 <- substitute(dfobj$day1); day1 day2 <- substitute(dfobj$day2) distance <- substitute(dfobj$distance) xx <- NULL for (i in 0:10) xx[i+1] <- with(dfobj, cor(Lag((day1-day1[1]),i), (day2-day2[1]), use='pair')) i <- match(max(xx), xx) with(dfobj, {
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi, I have: a <- matrix(c(0,1,0,1),nrow=2) b <- matrix(c(1,1,1,0,0,0),nrow=3) c <- 1 d <- c(1,0,1) And I would like to join them in an object 'thing' so that I can access a, b, c, or d through an index in a for loop. For example: thing[4] would return [1] 1 0 1 Note however, that I have many of these 'thing' components. So many that a command like thing
2012 Nov 08
4
Accessing selected elements of a list
Hi, If I have a vector: junk <- c(2,0,0,3,0) and want to access, say, all the elements that are greater than zero. I just do: junk[which(junk>0)] Now, If I have a list: jlist <- list(NULL,c(1,0),NULL,c(1,2,3), NULL) and want to access all the elements that have length greater than zero, I know how to find the elements with: which(sapply(jlist,length)>0) But how do I get a
2012 Nov 01
2
Name assignment in for loop
Dear helpeRs- I'm using a for loop to create a series of models. I'm trying to assign a name to each model created, using the loop index. The loop gets stuck at the name of the model, giving the error "target of assignment expands to non-language object". The linear model runs without error; only the name is problematic. Here is the current loop syntax. The use of dat
2006 May 07
1
Anyone care for a braindump?
I have this problem with records that have to be alligned on end- and startdate. I came up with the following. but am not convinced that this is the best way to tackle this problem. Anyone care for a braindump? def head_to_tail # Remove days that have startdate >= self.startdate AND enddate <= self.enddate # # before after # # |=====| |=====|
2008 Jan 27
1
calling a list element from a list name passed to a function
Hi, 'true_name' is a list of numerical, matrix, and text items I do pass_name <- "true_name" and pass the name of the list to a function so that the character class variable 'passed_name' contains the name of the list called 'true_name' Inside the function, how can I get a specified element from the list? For example, if I want to get
2010 Aug 20
3
change object name within for loop
Hi, I am writing a for loop that creates one object, say 'outn' on every round of the loop. I would like the name of each object to include the index of the loop as in, for example: out1, out2, out3, ... And I would like the naming of the object to take place automatically as the loop moves through? Similarly, I would like to be able to call different objects (in1, in2, in3,