similar to: Subset of Data Frame using the date

Displaying 20 results from an estimated 60000 matches similar to: "Subset of Data Frame using the date"

2010 Jun 25
2
Delete rows in the data frame by limiting values in two columns
Hi, folks, Finally Friday~~ Here comes the question: x=c('germany','poor italy','usa','england','poor italy','japan') y=c('Spain','germany','usa','brazil','england','chile') s=1:6 z=3:8 test=data.frame(x,y,s,z) #Now I only concern the countries ('germany','england','brazil').
2009 Sep 02
1
Problem at subsetting matrix by using dimnames
Given: > mitest <- matrix(1:16,ncol=4) > dimnames(mitest)[[1]] <- c("a","b","c","d") > dimnames(mitest)[[2]] <- c("a","b","c","d") > mitest a b c d a 1 5 9 13 b 2 6 10 14 c 3 7 11 15 d 4 8 12 16 I can do: > mitest[cbind(c(1,2,3),c(2,3,2))] [1] 5 10 7 but using the names does not
2008 Mar 04
3
creating a matrix subset based on a threshold cutoff
Hi, I have a table of x rows and y columns. The table is huge and so i'd like to create a subset of the data containing rows where any of the y values are below a threshold, say 1e-4. Is there a simple way of doing this in R? thanks Rich
2007 Aug 17
2
Date format on x-axis
Dear R users, Plotting question from a R beginner... When I try to plot a response through time, for example: >Date<-c("2006-08-17", "2006-08-18", "2006-08-19", "2006-08-20") >response<-c(4,4,8,12) >as.Date(Date) >plot(Date,response) The dates on the graphic appear in spanish. This I guess is the default way of plotting because my
2009 Jun 24
2
subsetting data frame using a vector of column names / values
Hello I have a data frame d with columns "var1", "var2", "var3" Then I have two vectors: columns <- c("var2", "var3") values <- c(0, 1) Is there a compact way to subset the data frame using these two vectors and get the result equivalent to: select (d, var2==0 & var3==1) ? Thank You Blazej
2007 Oct 22
3
median value dataframe coming from multiple dataframes
Hi all, I am not a skillful R programmer and has I am handling with large dataframes (about 30000 x 300) I am in need of an efficient function. I have 4 dataframes with the same dimension. I need to generate other dataframe with the some dimension than the others where in each position it has the median value of the 4 values in the same position coming from the 4 dataframes. Grateful by your
2007 Nov 07
2
Trouble in creating a list
I want to create a list based on the information from a data.frame, Model. So I tried the following: MyList <- list(colnames(Model)[2] = levels(Model$(colnames(Model)[2]))) but it failed with an error: Error: unexpected '=' in "list(colnames(Model)[2] =" I have the following problems with this command line: (1) I wanted to use colnames(Model)[2] as a tag for the list:
2011 Mar 18
4
subset data frame with condition
Hello, One more question.. I have the data.frame "pop": xloc yloc gonad ind Ene W Area 1 23 20 516.74 1 0.02 20.21 1 2 23 20 1143.20 1 0.02 20.21 1 3 23 20 250.00 1 0.02 20.21 1 4 22 15 251.98 1 0.02 18.69 2 5 22 15 598.08 1 0.02 18.69 2 6 21 19 250.00 1 0.02 20.21 3 7 22 20 251.98 1
2011 Jan 26
1
How to call subset in a for loop?
Dear all, I have a data frame 'myDf', in which one of the fields 'myField' can have several possible values. To extract the observations for which it has value "A", I can do: subset(myDf, myField="A") However, when I try to do this within a loop, it doesn't work, it returns everything, and not a subset for (currField in c("A", "B",
2008 Jul 03
1
subset function within a function
Hi, I am using this subset statement and it works outside a function. LIS[[i]]<- lapply(LI, subset, select=cov[[i]]) However, wrapped inside a function this statement produces the same values for every LIS[[1]] which is only the first subset of LI. Does anyone know why is not working correctly inside a function? ff = factor(covariate) nLev <- nlevels(ff) cov <-
2010 Jun 09
1
Subset columns by prefix
Hello R listserve, I would appreciate someone's help with this problem. Consider the following toy dataset: x <- read.table(textConnection("worldclim.1 worldclim.2 cru.1 cru.2 indv.1 7 8 32 658 indv.2 7 7 39 422"), header = TRUE) How could I create a subset of the data based on the column prefix? For instance, let's say I wanted to subset only the columns with the
2008 May 06
1
split and subset
Dear list: I ask for your help in a simple problem in which I'm not figuring out the solution My data looks like: dat<- data.frame(date=c("12/12/1980", "03/11/1994", "15/11/1999", "31/10/2000", "20/03/2007", "05/01/2001"), var1=c("A", "A", "B", "D", "C", "A"),
2008 Nov 10
1
Remove empty levels in subset
Hi, when I use use subset in a data.frame, all empty levels are maintained in the new table. > test <- data.frame(a=as.factor(rep(c("f1","f2","f3"),10)),b=rep(c(1,2,3),10)) > summary(test) a b f1:10 Min. :1 f2:10 1st Qu.:1 f3:10 Median :2 Mean :2 3rd Qu.:3 Max. :3 > test2 <-
2010 May 02
3
percent by subset
Suppose my data looks like this: Obs, Male, Female, Height 1, T, F, 66 2, F, T, 64 3, T, F, 59 4, T, F, 55 5, F, T, 62 6, T, F, 67 7, T, F, 58 8,
2009 Sep 09
2
How to sum and group data by DATE in data frame
Dear all, Lets say I have a data frame as follows: > Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20')) > Income <- c(73.79, 72.46, 76.32, 72.43, 72.62) > data.frame(Date, Income) Date Income 1 2006-08-23 73.79 2 2006-08-30 72.46 3 2006-09-06 76.32 4 2006-09-13 72.43 5 2006-09-20 72.62 >
2009 Jul 10
2
How to number a subset consecutively from 1 to n?
Hello, I have a data frame of the following form block trial dv 1 1 10 1 1 11 1 1 9 1 2 12 1 2 9 1 3 12 1 3 13 1 3 14 1 3 15 1 4 12 1 4 11 1 4 10 1 4 9 1 4 11 and need to number the rows consecutively in the following manner block trial dv sequ 1 1 10 1 1 1 11 2 1 1 9 3 1 2 12 1 1 2 9 2 1 3 12 1 1 3 13 2 1 3 14 3 1 3 15 4 1 4 12 1 1 4 11 2 1 4 10 3 1 4 9 4 1 4 11 5 Any idea how to solve
2009 Feb 17
3
Combination
Hello, I have a sequence of numbers: seq(1:50) and I would like to have all the possible combinations with this numbers without repeating any combination: 11, 12, 13, ... ,22,23,24,... How can I do it? Best, Dani -- Daniel Valverde Saub? Grup de Biologia Molecular de Llevats Facultat de Veterin?ria de la Universitat Aut?noma de Barcelona Edifici V, Campus UAB 08193 Cerdanyola del Vall?s-
2010 May 13
3
select subset based on another variable
Hi, dear R-helpers, I have a simple question regarding selecting subset of a variable based on another variable. Here is the example: xx=rnorm(10) id=sample(1:10, 10) temp=c(6, 1, 8, 2) Now, all I want is xx's that their id are 6, 1, 8, 2, instead of the position. Any suggestions ? Thank you all your help !! Carrie [[alternative HTML version deleted]]
2008 Mar 24
6
vlookup in R
Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin ____________________________________________________________________________________ [[alternative HTML version deleted]]
2009 Jun 23
3
subset POSIXct
Hi, I have a data frame with two columns: dt and tf. The dt column is datetime and the tf column is a temperature. dt tf 1 2009-06-20 00:53:00 73 2 2009-06-20 01:08:00 73 3 2009-06-20 01:44:00 72 4 2009-06-20 01:53:00 71 5 2009-06-20 02:07:00 72 ... I need a subset of the rows where the minutes are 53. The hour is immaterial. I can not find a wildcard