search for: testdate

Displaying 20 results from an estimated 32 matches for "testdate".

Did you mean: testdata
2012 Jan 24
6
Checking for invalid dates: Code works but needs improvement
...tes #### ########################################## #### Test Data #### connection <- textConnection(" 1 11/23/21931 05/23/2009 un/17/2011 2 06/20/1940 02/30/2010 03/17/2011 3 06/17/1935 12/20/2008 07/un/2011 4 05/31/1937 01/18/2007 04/30/2011 5 06/31/1933 05/16/2009 11/20/un ") TestDates <- data.frame(scan(connection, list(Patient=0, birthDT="", diagnosisDT="", metastaticDT=""))) close(connection) TestDates class(TestDates$birthDT) class(TestDates$diagnosisDT) class(TestDates$metastaticDT) #### List of Date Variables #### DateNames <- c...
2012 Jan 26
0
R-help Digest, Vol 107, Issue 25
...nt-Type: text/plain; charset=us-ascii Hello, Point 3 is very simple, instead of 'print' use 'cat'. Unlike 'print' it allows for several arguments and (very) simple formating. { cat("Error: Invalid date values in", DateNames[[i]], "\n", TestDates[DateNames][[i]][TestDates$Invalid==1], "\n") } Rui Barradas Message: 53 Date: Tue, 24 Jan 2012 08:54:49 -0800 (PST) From: Paul Miller <pjmiller_57 at yahoo.com> To: r-help at r-project.org Subject: [R] Checking for invalid dates: Code works but needs improvement Message-ID:...
2008 Sep 24
4
rowSums()
Say I have the following data: testDat <- data.frame(A = c(1,NA,3), B = c(NA, NA, 3)) > testDat A B 1 1 NA 2 NA NA 3 3 3 rowsums() with na.rm=TRUE generates the following, which is not desired: > rowSums(testDat[, c('A', 'B')], na.rm=T) [1] 1 0 6 rowsums() with na.rm=F generates the following, which is also not desired: > rowSums(testDat[, c('A',
2009 Dec 10
2
different randomForest performance for same data
Hello, I came across a problem when building a randomForest model. Maybe someone can help me. I have a training- and a testdataset with a discrete response and ten predictors (numeric and factor variables). The two datasets are similar in terms of number of predictor, name of variables and datatype of variables (factor, numeric) except that only one predictor has got 20 levels in the training
2004 Mar 05
3
as.POSIXct problem
Hi all, I'm having difficulty converting a 'dates' object to a POSIXct object: testDATES<-c(35947,35971,36004,36008,36053,36066) testDATES<-chron(dates=testDATES, format = c(dates = "m/d/y"), origin=c(month = 12, day = 30, year = 1899)) >[1] 06/01/98 06/25/98 07/28/98 08/01/98 09/15/98 09/28/98 > as.POSIXct(testDATES) [1] NA NA NA NA NA NA >format(as.POS...
2002 Feb 02
1
chron problem: extracting days and years
Hello r-help, I'm trying to split a character vector of dates of the form "dd-mmm-yy" into component days, months and years. But > library(chron) > testdate<-as.POSIXlt(strptime("17-Sep-98","%d-%b-%y")) > testdate [1] "1998-09-17" > months(testdate) [1] "September" # which is fine, but for days and years I get > days(testdate) NULL > years(testdate) NULL > According to "?days"...
2011 Jan 17
1
Replacing rows in a data frame
R-helpers, Below is a simple example of some output that I am getting while trying to work with a data frame in R 2.12.1 for Mac. ----- > testdat <- data.frame(matrix(ncol=10, nrow=10)) > colnames(testdat) <- c('a','b','c','d','e','f','g','h','i','j') > testdat[seq(1,10,3),] <-
2012 Jan 18
4
R-Help
I am trying to create a frequency distribution and I am a bit confused. Here are the commands I have entered: > data <- read.csv(file="40609_sortedfinal.csv",head=TRUE,sep=",") > NumberOfActionsByStatus = data$STATUS > NumberOfActionsByUser = data$ETS_LOGIN > NumberOfBidOffer = data$BID_OFFER > NumberOfActionsByUser.freq = table(NumberOfActionsByUser) >
2010 Sep 29
2
repeat a function
I have R randomly sampling my array made up of 2 columns of data. Here is my code randomly sampling 5 different rows from my dataset to create a new dataset of 8 rows of data: testdat<-growth[sample(5,8,replace=T),] Now I want to tell R to repeat this function 50 times and give me the output. I have been searching the internet and have been unable to figure this out. Any advice
2011 May 30
1
CLI command 'database deltree' doesn't remove family with space in its name
While playing with DB function in Dialplan, I have added some garbage in AstDB. These are some family names with space in them. See this, demo*CLI> database show /18-05-2011 00:00:0052011175221575/TESTDATE : 2011-05-14 21:33:46 /18-05-2011 00:00:0052011175221575/TEST1 : 410 /18-05-2011 00:00:0052011175221575/TEST2 : 155 /18-05-2011 00:00:0052011182614252/TEST3 : 157 I treid to remove it from CLI through database deltree and database del commands, but no hope. demo*CLI...
2010 Sep 29
2
resampling issue
I am trying to get R to resample my dataset of two columns of age and length data for fish. I got it to work, but it is not resampling every replicate. Instead, it resamples my data once and then repeated it 5 times. Here is my dataset of 9 fish samples with an age and length for each one: Age Length 2 200 5 450 6 600 7 702 8 798 5 453 4 399 1 120 2 202 Here is my code which resamples my
2004 Mar 06
0
Summary: as.POSIXct
...rom both Prof Brian Ripley and Gabor Grothendiec solved my problem. From Prof Ripley: >This is a problem of your OS: your example works on all of mine. > >Can't you change the origin in chron? If not, you should certainly be >able to do > >as.POSIXct(strptime(as.character(testDATES), "%m/%d/%y")) This still resulted in NA's on my system. > >Here's what I think you can do most easily: > >shift <- julian(1,1,1970, origin=c(month = 12, day = 30, year = 1899)) >as.POSIXct(chron(dates=unclass(testDATES) - shift)) But this worked. From Gabo...
2006 Aug 11
1
more on date conversion differences in 2.2.1 vs 2.3.1
...h dates I get different results with 2.2.1 and 2.3.1. From my somewhat naive point point of view, the 2.2.1 behaviour seems more sensible. Running the code below in 2.2.1: V1 2006-08-01 2006-08-01 1 1 With 2.3.1 I get: V1 1154354400 1154440800 1 1 # testdate.R t <- read.csv2('testdate.csv', header=FALSE) t$V1 <- as.POSIXct(t$V1) print(t) x <- xtabs(V2 ~ V1, data=t) print(x) # testdate.csv 2006-8-1;0;1 2006-8-1;1;1 2006-8-2;0;1 2006-8-2;0;0 2006-8-2;1;1
2008 Jul 24
2
Can R fill in missing values?
...sed the merge function by date for the attached two files), where all the missing values are filled with NAs (which is what the all.x=TRUE does). Is there any way to replace those NAs with the value of the latest row that contains a value? For example: > Date<-read.table("Desktop/R/Testdate.txt", head=T, sep="\t") > Data<-read.table("Desktop/R/Testinput.txt", head=T, sep="\t") > Merged<-merge(Date, Data, all.x=TRUE) > Merged Date France Germany 1 3/10/07 2 4 2 3/11/07 NA NA 3 3/12/07 NA NA 4 3/13/07...
2011 Mar 12
1
Column order in stacking/unstacking
Dear R users, I'm having some problems with the stack() and unstack() functions, and wondered if you could help. I have a large data frame (400 rows x 2000 columns), which I need to reduce to a single column of values (and therefore 800000 rows), so that I can use it in other operations (e.g., generating predictions from a GLM object). However, the problem I'm having can be reproduced
2011 Feb 15
3
expected behavior when parsing lines with special characters
Say I have a tab-delimited table I want to read into R. What should I expect to happen if some of the entries contain the character " ' "? I thought it would read the file fine, but that is not what happens. Instead, all the values in between two " ' "s get read into one field, and things are just seriously messed up. Is this a bug, and besides removing the offending
2008 Mar 03
1
Tapply for Group Specific Means and Proportions
...the Behavior categories, 0.xx being the proportion per date-time) I would appreciate it: Date-Time MeanHt PE OS SI ... 28Mar96.0752 6.000000 0.xx 0.xx 0.xx ... 28Mar96.1014 7.000000 0.xx 0.xx 0.xx ... TIA, Bret (R 2.6.1 on I386-pc-mingw32) Texas A&M > Final Sequence testdate testtime Behavior Substrate TreeHt 1 1 28Mar96 0752 PE TW 6 2 2 28Mar96 0752 OS <NA> 6 3 3 28Mar96 0752 PE TW 6 4 4 28Mar96 0752 PE TW 6 5 1 28Mar96 0924...
2011 Apr 13
3
predict()
Hi, I am experimenting with the function predict() in two versions of R and the R extension package "survival". library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x') testfun=function(dat,fm) { predict(coxph(fm,data=dat),type='lp',newdata=dat) } # Under R 2.11.1 and
2011 Apr 13
3
predict()
Hi, I am experimenting with the function predict() in two versions of R and the R extension package "survival". library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x') testfun=function(dat,fm) { predict(coxph(fm,data=dat),type='lp',newdata=dat) } # Under R 2.11.1 and
2008 Jul 23
2
Can't Load Text Files
...o work with) that I am trying to load into R so that I can merge them. They were originally excel files but I used "saved as" to reformat to text. I don't know if it's relevant, but I use a mac. These are the error messages I get: > source("/Users/jiayingmei/Desktop/R/Testdate.txt") Error in eval.with.vis(expr, envir, enclos) : object "Date" not found Error in source("/Users/jiayingmei/Desktop/R/Testinput.txt") : /Users/jiayingmei/Desktop/R/Testinput.txt: unexpected symbol at 1: Date France I'm sure its something simple that is causing...