similar to: R-help Digest, Vol 107, Issue 25

Displaying 20 results from an estimated 200 matches similar to: "R-help Digest, Vol 107, Issue 25"

2012 Jan 24
6
Checking for invalid dates: Code works but needs improvement
Hello Everyone, Still new to R. Wrote some code that finds and prints invalid dates (see below). This code works but I suspect it's not very good. If someone could show me a better way, I'd greatly appreciate it. Here is some information about what I'm trying to accomplish. My sense is that the R date functions are best at identifying invalid dates when fed character data in their
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) >
2004 Mar 06
0
Summary: as.POSIXct
Suggestions from 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. >
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
2011 Jan 26
2
applying a set of rules to each row
All, I would like to apply a set of rules to each row of the sample data set below. The rule sets are the guidelines for determining an individual's date for retirement eligibility. The rules are found in this document, http://www.opm.gov/feddata/RetirementPaperFinal_v4.pdf. I am only interested in the top two categories for retirement eligibility, the CSRS and FERS plans. The data set has
2011 Jun 17
1
sink() and library() calls cause script to stop when called from php
Hello all, I have a php script that makes a call system(PATH_PROJECT_ROOT . '/sh/combineDays.sh ' . $dateString . " " . PATH_PROJECT_ROOT); and within combineDays.sh I run an R script: R --slave --vanilla --args $testDates $BASEDIR $defaultSearchVersion < $BASEDIR"R/combineDays.R" At the end of this R script, I try to write results to a file, but the
2011 Jun 18
1
Vim-R-Plugin issue : Python interface must be enabled to run Vim-R-Plugin
I am trying to get the Vim-R-Plugin<http://www.vim.org/scripts/script.php?script_id=2628> to work with gvim and R on Windows 7. When I open a .R file in VIM, it complains and says ""Python interface must be enabled to run Vim-R-Plugin." I have installed pywin32 for python 2.7, and added the following 4 lines to my _vimrc per the instructions
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
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',
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 >
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 11
2
Checking dates for entry errors
Hello Everyone, ? I have a question about how best to check dates for?entry errors. I recently discovered that R will read?the incorrectly entered date "11/23/21931" without producing a warning or an?error message at least under some circumstances. ? > as.Date("11/23/21931", format = "%m/%d/%Y") [1] "2193-11-23" > as.Date("21931-11-23")
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 :
2006 Aug 11
1
more on date conversion differences in 2.2.1 vs 2.3.1
With 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)
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
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
2005 Jan 24
0
Follow-up on nls convergence failure with SSfol
A couple of weeks ago there was a question regarding apparent convergence in nls when using the SSfol selfStart model for fitting a first-order pharmacokinetic model. I can't manage to find the original message either in my archive or in the list archives but the data were time conc dose 0.50 5.40 1 0.75 11.10 1 1.00 8.40 1 1.25 13.80 1 1.50 15.50 1
2008 Mar 03
1
Tapply for Group Specific Means and Proportions
UseRs, I am working on a dataset (see small example below) where individuals were followed on a specific date-time combo and multiple repeated measurements were taken (e.g., height in meters, behavior class in 2 letter code). Observation numbers varied between individual (ranging from 1 observation for each date-time combo to >50) I am trying to summarize the data into 1 row per
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