Displaying 20 results from an estimated 13000 matches similar to: "Removing rows with earlier dates"
2011 Mar 12
2
Merge data under conditions
Dear All,
Debuting in R, I'm facing a problem.
I have 2 vectors, say 'a' et 'b', and I'd like to merge them according to
the proximity of their variable 'time'.
How to do to keep elements which satisfy (for example) 'a$time-b$time<0.5'?
For example :
> a
time x
1 1.0 4
2 2.2 5
3 5.2 6
> b
time y
1 0 1
2 1 3
3 2 5
4 4 7
5
2013 Mar 06
2
Fwd: How to conditionally remove dataframe rows?
Hi,
I have a data frame with two columns. I need to remove duplicated rows in
first column, but I need to do it conditionally to values of the second
column.
Example:
Point_counts Psi_Sp
1 A 0
2 A 1
3 B 1
4 B 2
5 B 0
2010 May 12
2
sorting rows of dataframe
Hello:
I have a dataframe, where the first column in a month:
Month CATCHMENT_ med min max
1 Apr Alknda01 71.68080 11.9406600 196.2753
2 Apr Alknda02 69.44580 12.1065600 196.2753
3 Apr ArialKhan 39.89310 5.8598700 175.4433
4 Apr Arjun01 4.79652 0.0093336 55.7136
5 Apr Arjun02 4.79652 0.0093336 55.7136
6 Apr Arun01 52.42320 0.1571928
2011 Aug 31
1
formatting a 6 million row data set; creating a censoring variable
List,
Consider the following data.
gender mygroup id
1 F A 1
2 F B 2
3 F B 2
4 F B 2
5 F C 2
6 F C 2
7 F C 2
8 F D 2
9 F D 2
10 F D 2
11 F D 2
12 F D 2
13 F D 2
14 M A 3
15 M A 3
16 M A 3
17
2009 Nov 16
5
Writing a data frame in an excel file
Hello, I am having trouble by using the write.table function to write a data
frame of 4 columns and 7530 rows. I don?t know if I should just use a
sep="\n" and change the .xls file into a .csv file. Thanks in advance
-----
Anna Lippel
new in R so be careful I should be asking a loooooooot of questions!:teeth:
--
View this message in context:
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
2010 Apr 27
4
Selecting rows based on contents of string
Hi there,
I have a data frame with a column named "Flags", whose contents are strings
containing any of the following characters, multiple characters allowed:
A,B,C,D,E,F,G.
Here is the head:
GeocodeID PlaceID CountyCode CBSACode StateProvCode PropertyTypeGroupID
Flags
1 0 0 0 0
AK 1 ABC
2
2011 Jan 31
2
From data frame to list object
Dear all, let say I have following data frame:
> data.frame(x=rnorm(18), y=rep(c("a", "b", "c"), each=6))
x y
1 -1.072152537 a
2 0.382985265 a
3 0.058877377 a
4 -0.006911939 a
5 -2.355269051 a
6 -0.303095553 a
7 0.484038422 b
8 0.733928931 b
9 -1.136014346 b
10 0.503552090 b
11 1.708609658 b
12 -0.294599403 b
13
2010 Jan 13
4
a question about deleting rows
I have a file like this:
id n1 n2 n3 n4 n5 n6
1 3 4 7 8 10 2
2 4 1 2 4 3 10
3 7 0 0 0 0 8
4 10 1 0 0 2 3
5 11 1 0 0 0 5
what I want to do is: only if n2=0 and n3=0 and n4=0 and n5=0 then delete
the row. how can I do that?
thank you,
karena
--
View this message
2011 Jan 31
2
Missing at random
R users:
Thanks in advance
How to generate missing at random (MAR)?
assaedi76@yahoo.com
Thanks
[[alternative HTML version deleted]]
2011 Jul 15
3
summarized data set - how to use an "occurs" field
I have a data set with 22 fields and several thousand records in which
one field (count) indicates the number of times that each specific
combination of the other 21 fields occurred in a bigger and largely
unavailable data set.
So each record is unique in its combination of field values and has a
field that identifies how many multiples of this record actually
occurred.
Without resorting to
2012 Mar 18
3
Extracting numbers from a character variable of different types
Hello,
I have a file which contains a column with age, which is represented in the
two following patterns
1. "007/A" or ''007/a" or ''7 /a" ..... In this case A or a means year and I
would like to extract only the numeric values eg 7 in the above case if this
pattern exits in a line of file.
2. "004/M" or "004/m" where M or m means month
2013 Mar 11
2
how to convert a data.frame to tree structure object such as dendrogram
I have a data.frame object like:
> data.frame(x=c('A','A','B','B'), y=c('Ab','Ac','Ba','Bd'))
x y
1 A Ab
2 A Ac
3 B Ba
4 B Bd
how could I create a tree structure object like this:
|---Ab
A---|
_| |---Ac
|
| |---Ba
B---|
|---Bb
Thanks,
Zech
[[alternative HTML version deleted]]
2010 Jan 27
3
Function for describing segements in sequential data
Dear R-users,
Say that I have a sequence of zeroes and ones:
x <- c(1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0)
The sequences of ones represent segments and I want to report the starting and endpoints of these segments. For example, in 'x', the first segment starts at location 1 and ends at 3, and the second segment starts at location 8 and ends at location 10. Is there an efficient
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
2003 May 09
1
windows data editor changes dimensions displayed data frames
dear R-tists,
i am experiencing a problem with the data editor in the windows version of
R 1.6.1 envoked with the command 'fix'.
the data editor changes the size of large data frames.
a simple example illustrates this:
-------------------------------------------------------
> dfrm <- data.frame(no=c(1:100000))
> length(dfrm[,1])
[1] 100000
> fix(dfrm)
>
2011 Feb 21
1
How to delete rows with specific values on all columns (variables)?
Hi,
I need to filter my data:
I think its easy but i'm stuck so i'll appreciate some help:
I have a data frame with 14 variables and 6 million rows. About half of this
rows have a value of "0" in 12 variables (the other two variables always
have values). How can I delete the rows in which all 12 variables have the
value of "0".
example (from my data, variable 14 is
2011 Jul 01
4
Access only part of last dimension of table/matrix
I would like to do some operations inside a function using only one
value for the last dimension of a table/matrix:
tabfn <- function (dfrm, facvec, YN ="event"){
return( Etbl <- do.call(table, dfrm[ , c(facvec,
"event") ]) )
# just want Etbl[,,,"TRUE"] or Etbl[,, "TRUE"] or
Etbl[,"TRUE"]
}
2005 Dec 01
1
Kalman Smoothing - time-variant parameters (sspir)
Dear R-brains,
I'm rather new to state-space models and would benefit from the extra
confidence in using the excellent package sspir.
In a one-factor model, If I am trying to do a simple regression where
I assume the intercept is constant and the 'Beta' is changing, how do
I do that? How do i Initialize the filter (i.e. what is appropriate to
set m0, and C0 for the example below)?
2012 May 16
2
Splus equivalent of reshape in R
Hello R/Splus users..
I am posting in R discussion group in hope of wider response compared to
what I received from Splus user groups....
Was wondering if there is any function available in Splus 8.2 that is
equivalent to "reshape" of R?
Below is a sample dataset. Size [both rows and columns) of the dataset may
vary
X1 Y1 Y2 Y3
0.25 40 38 22
0.5 44 41