Displaying 20 results from an estimated 3000 matches similar to: "Comparing two date columns"
2007 Jun 15
1
comparing dates
hello,
i have to dates :
@date_1 = date.new()
@date_2 = date.new()
i want to compare theses two dates
i have tried
@date_1 > @ date_2 but every time it returns me FALSE
is there a solution .?????
thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2010 Dec 10
1
melt causes errors when characters and values are used
Hello,
I am finding that the melt function from the reshape library causes
errors when applied to a data.frame that contains numeric and character
columns. For example,
melt(id.vars="ID",data.frame(ID=1:3,date=c("a","b","c"),value=c(1,4,5)))
ID variable value
1 1 date a
2 2 date b
3 3 date c
4 1 value <NA>
5 2
2010 Mar 12
7
sqldf not joining all the fields
Dear R users,
I have two data frames that were read from text files as follows:
x_data <- read.table("x.txt", header = TRUE, sep = "|", quote = "\"'",
dec = ".",as.is = TRUE,na.strings = "NA",colClasses = NA,
nrows = 3864284,
skip = 0, check.names = TRUE,fill=TRUE,
strip.white = TRUE,
2010 Feb 20
3
Rearranging a data frame for multiple observations
Hi there,
I think I'm struggling with a fairly simple problem but can't seem to solve
it. I have multiple observations for one unique identifier. Ultimately I
want to end up with one line per identifier with multiple observations in
rows. I'm really stuck any help would be really appreciated.
CAO0337134 05/09/95
CAO0337134 27/09/05
CAO0347741 10/10/04
CAO0347741 12/10/04
2011 Mar 09
2
Cleaning date columns
Hi Everyone,
I have the following problem:
data <- structure(list(prochi = c("IND1", "IND1", "IND1",
"IND2", "IND2", "IND2", "IND2", "IND3",
"IND4", "IND5"), date_admission = structure(c(6468,
6470, 7063, 9981, 9983, 14186, 14372, 5129, 9767, 11168), class = "Date")),
.Names =
2010 Sep 06
3
Finding the two most recent dates
Dear R help,
I have the following data frame:
structure(list(prochi = c("ind_1", "ind_1", "ind_1",
"ind_1", "ind_1", "ind_1", "ind_1", "ind_1",
"ind_1", "ind_1"), date_1st_event = structure(c(14784,
14784, 14784, 14784, 14784, 14784, 14784, 14784, 14784, 14784
), class = "Date"),
2010 Mar 03
1
Subset using partial values
Hi everyone,
I would like to subset a data.frame using partial values.
For example I have the following data.frame:
PROCHI Main_condition
1234 411
1235 4110
1236 4111
1237 I20
1238 I201
1239 I202
Now let's say that I use the Subset function. Ordinarily I would use it as
follows Subset(x, Main_condition=="411"|Main_condition=="4110" etc to get
2010 Mar 15
1
inner join sqldf
Hi,
I have two dataframes that have some common columns. I would like to join
them by the common columns prochi and prescribed_date as there are duplicate
prochis but they will be made unique by date. I tried doing an inner join
but that just duplicated the columns whereas I would like the information
from the test_sql_tsf to fill the NAs in the test_sql_psd common columns.
require(sqldf)
2008 Nov 06
2
comparing matrices using max or min
Dear all,
I have 3 matrices with the same dimension, A,B,C and I would like to produce
a matrix D where in each position would retrieve the max(or min) value along
A,B,C taken from the same position.
I guess that apply functions should fit, but for matrices objects I am not
getting it.
thanks in advance,
Diogo André Alagador
[[alternative HTML version deleted]]
2010 Mar 04
1
Date conversion problem
Hi All,
I have a character data.frame that contains character columns and date
columns. I've manage to convert some of my character columns to a date
format using as.Date(x, format="%m/%d/%y").
An example of one of my dates is
PROCHI DtDeath icdcucd date_admission1 date_admission_2
CAO0004563 <NA> <NA> 2005-09-01 <NA>
CAO0073505
2006 Jul 06
3
Comparing two matrices
hi:
I have matrix with dimensions(200 X 20,000). I have
another file, a tab-delim file where first column
variables are row names and second column variables
are column names.
For instance:
> tmat
Apple Orange Mango Grape Star
A 0 0 0 0 0
O 0 0 0 0 0
M 0 0 0 0 0
G 0 0 0 0 0
S 0 0 0 0 0
2011 Oct 05
2
Subsetting a data frame with multiple values and exclusions.
Hi all,
I realise that the convention is to provide a working example of my problem
but the data are of a sensitive nature so I'm not able to do that in this
case.
I need to query a database for multiple search terms:
db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4"), test1 = c(1,
2, 1.3, 3), test2 = c(56L, 27L, 58L, 2L), test3 =
2011 Mar 10
2
within group sequential subtraction
Hi Everyone,
I would like to do sequential subtractions within a group so that I know the
time between separate observations for a group of individuals.
My data:
data <- structure(list(group = c("IND1", "IND1", "IND2",
"IND2", "IND2", "IND3", "IND4", "IND5",
"IND6", "IND6"), date_obs =
2012 Jul 17
1
Stats question: Comparison of the same individuals during two exposure times
Hi,
I'm hoping that someone will be able to help. I would like to compare how
covariates associate with the risk of a binary outcome during two periods.
Period 1 will be non-exposure to a treatment and period 2 will be exposure
to a treatment. The same individuals will be examined in each group but I
want to be able to compare the association of certain covariates between the
two groups to
2008 Apr 27
1
parallel max, min, and median of dataframe columns
Hello, all,
I have a dataframe of three rows and umpteen columns. I want to show the
maximum, minimum, and median with a vertical line and a central dot (I'd
use a boxplot, but with only three data points, that's overkill; I can't
just use points, because of overlap and some of the other data plotted on
the graph).
This works:
> boxplot(data_frame,
2011 Dec 05
1
Subsetting a data frame
Hi R users,
I really need help with subsetting data frames:
I have a large database of medical records and I want to be able to match
patterns from a list of search terms .
I've used this simplified data frame in a previous example:
db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4"), test1 = c(1,
2, 1.3, 3), test2 = c(56L, 27L, 58L,
2005 May 20
2
comparing a vactor of values in IF statement.
Hi,
my vector V<- c(1,0.5,0.06,0.056,0.01,0.04,0.4,0.9,0.82,0.1)
if( V > 0.5) { V <- 1 - V }
I get a warning saying only the first element will be used in comparing (if V > 0.5).
However, my results tell me vis-versa ,it actually compares every element of the vector V with 0.5 and that is waht i want it to do.
Using a for loop is expensive and time consuming since my actual
2003 Jan 31
2
minor error in documentation of pmax in base (PR#2513)
The documentation says, "pmax and pmin take several vectors as
arguments and return a single vector giving the parallel maxima
(or minima) of the vectors."
I discovered that, if you use a matrix or array instead of a
vector, pmax returns a matrix or array, respectively.
This makes pmax and pmin much more useful, and should not be left
to people to discover on their own!
For example:
2012 Oct 30
4
There is pmin and pmax each taking na.rm, how about psum?
Hi,
Please consider the following :
x = c(1,3,NA,5)
y = c(2,NA,4,1)
min(x,y,na.rm=TRUE) # ok
[1] 1
max(x,y,na.rm=TRUE) # ok
[1] 5
sum(x,y,na.rm=TRUE) # ok
[1] 16
pmin(x,y,na.rm=TRUE) # ok
[1] 1 3 4 1
pmax(x,y,na.rm=TRUE) # ok
[1] 2 3 4 5
psum(x,y,na.rm=TRUE)
[1] 3 3 4 6 # expected result
Error: could not find function "psum" # actual result
2008 Jul 04
2
create a zero matrix & fill
Dear R user,
I have written a function which returns max,min and variation of a power
(see below)
Power is a given matrix(1,n)
I call the function
>Variation<-VAR(p,(n-deltat))
Now the problem is when I want plot(Results[1],Results[2]). Not possible!
I become the following error (in english it means: Error in
as.double.default(x) :Object cannot be transformed in double)
>