Re: [R] list assignment syntax?

2012-03-30 Thread jim holtman
All of this is syntactic sugar. Just because a language does not have the sintax that you are used (e.g, Perl) does not make it bad/hard to use. What is the problem if I have to type a couple of extra lines: f <- function(x) list(a = seq_along(x), b=x*3) result <- f(1) r1 <- result$a r2 <- resul

Re: [R] list assignment syntax?

2012-03-30 Thread Jeff Newmiller
I agree that global side effects are a bad idea, but ivo started this by pointing out that it is straightforward to do this in Perl. It might be worth considering adding this capability to R. --- Jeff Newmiller

Re: [R] list assignment syntax?

2012-03-30 Thread Bert Gunter
,,,But assigning to the global environment is a bad idea. You're just asking for trouble -- overwriting without warning something that's already there. May I suggest a rule of thumb: When things are difficult or clumsy to do in R, don't do them. Of course this is not inviolable, but the OP's requ

Re: [R] list assignment syntax?

2012-03-30 Thread Joshua Wiley
An idiom like this would also work. f <- function(a,b) list( data.frame(a+rnorm(20), b), loess( a ~ b) ) lapply(seq_along(out <- f(1:20, 1:20)), function(i) assign(c("c", "d")[i], out[[i]], envir = .GlobalEnv)) It is not elegant if you are doing this regularly, but, I think, functions typically

Re: [R] list assignment syntax?

2012-03-30 Thread ivo welch
thanks, everyone. I should have been clearer (as always). I used the numbers as an example only. I am aware that I can put numbers into vectors and get nice R syntax. my problem is that I usually want to return multiple and/or mixed objects, such as multiple data frames. I should have given as

Re: [R] How to use access results of gregexpr in data frames

2012-03-30 Thread Mauricio Cornejo
Michael, Your suggestion to use sapply solves the problem.Thanks so much for your help Mauricio From: R. Michael Weylandt Cc: "r-help@r-project.org" Sent: Friday, March 30, 2012 8:33 PM Subject: Re: [R] How to use access results of gregexpr in data frames

Re: [R] how to increase speed for function?/time efficiency of below function

2012-03-30 Thread R. Michael Weylandt
I'd suggest you get a copy of the book that code accompanies: it's not a trivial question -- this post may also help: http://tolstoy.newcastle.edu.au/R/help/04/07/0117.html -- once you read that I believe I told you how to fit a general ARIMA model before so you should be good to go. As to your or

Re: [R] getopt does not work as expected!

2012-03-30 Thread Trevor Davis
> Why is commandArgs()[1] = "/usr/lib64/R/bin/exec/R" and not > "getopt_test.R" as described by the help (?getopt)? That used to work but R changed the behavior of the commandArgs() function a couple of years ago, I guess the orginal author of getopt didn't update his example then. This will do t

Re: [R] How to use access results of gregexpr in data frames

2012-03-30 Thread R. Michael Weylandt
I think when you assign to dframe$all there's more going on than you realize: you're actually using a multi-element list as a column of a data frame which is, while possible, perhaps nonstandard. Perhaps you want this: dframe$all <- t(simplify2array(gregexpr("/", dframe[, 1]))) print(dframe) #

Re: [R] lubridate:ymd_hm and coercion of class POSIXct. Smooth way to restore the date format.

2012-03-30 Thread R. Michael Weylandt
Well, it might take some time to work out a lubridate solution that works, but how about good old base R? as.POSIXct(x$datetime) Michael On Fri, Mar 30, 2012 at 10:22 AM, Henrik Pärn wrote: > Dear all, > > I wish to create a POSIXct variable from date and time variables using the > ymd_hm func

Re: [R] list assignment syntax?

2012-03-30 Thread Justin Haynes
You can also take a look at http://stackoverflow.com/questions/7519790/assign-multiple-new-variables-in-a-single-line-in-r which has some additional solutions. On Fri, Mar 30, 2012 at 4:49 PM, Peter Ehlers wrote: > On 2012-03-30 15:40, ivo welch wrote: >> >> Dear R wizards:  is there a clean

Re: [R] list assignment syntax?

2012-03-30 Thread Gabor Grothendieck
On Fri, Mar 30, 2012 at 6:40 PM, ivo welch wrote: > Dear R wizards:  is there a clean way to assign to elements in a list? >  what I would like to do, in pseudo R+perl notation is > >  f <- function(a,b) list(a+b,a-b) >  (c,d) <- f(1,2) > > and have c be assigned 1+2 and d be assigned 1-2.  right

Re: [R] list assignment syntax?

2012-03-30 Thread Peter Ehlers
On 2012-03-30 15:40, ivo welch wrote: Dear R wizards: is there a clean way to assign to elements in a list? what I would like to do, in pseudo R+perl notation is f<- function(a,b) list(a+b,a-b) (c,d)<- f(1,2) and have c be assigned 1+2 and d be assigned 1-2. right now, I use the clunky

Re: [R] list assignment syntax?

2012-03-30 Thread Weidong Gu
You don't need temporary variable x c<-f(1,2)[[1]] d<-f(1,2)[[2]] Weidong Gu On Fri, Mar 30, 2012 at 6:40 PM, ivo welch wrote: > Dear R wizards:  is there a clean way to assign to elements in a list? >  what I would like to do, in pseudo R+perl notation is > >  f <- function(a,b) list(a+b,a-b)

Re: [R] ff usage for glm

2012-03-30 Thread Thomas Lumley
On Sat, Mar 31, 2012 at 9:05 AM, Bond, Stephen wrote: > Greetings useRs, > > Can anyone provide an example how to use ff to feed a very large data frame > to glm? > The data.frame cannot be loaded in R using conventional read.csv as it is too > big. > > glm(...,data=ff.file) ?? > I shouldn't th

Re: [R] ff usage for glm

2012-03-30 Thread Benilton Carvalho
you want to check the ff man page (?ff), there is an example described there with biglm. b On 30 March 2012 21:05, Bond, Stephen wrote: > Greetings useRs, > > Can anyone provide an example how to use ff to feed a very large data > frame to glm? > The data.frame cannot be loaded in R using conven

[R] How to use access results of gregexpr in data frames

2012-03-30 Thread Mauricio Cornejo
Hello, I'm trying to figure out how to find the index of the second occurrence of "/" in a string (which happens to represent a date) within a data frame column. I've used the following code successfully to find the first instance of "/". dframe <- data.frame(date=c("5/14/2011", "4/7/2011")) df

Re: [R] Problem loading package 'JGR' using R-2.15.0 (Win32).

2012-03-30 Thread Jeff Newmiller
Not I. You really should read the posting guide, because you are not describing your system or problem in a reproducible way. Some obvious first questions might be "are you using the latest versions of R, was it a binary distribution, is JGR up-to-date, are your other loaded packages up-to-date

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-30 Thread Burak Aydin
Hello Greg, Thanks for your time, Lets say I know Pearson covariance matrix. When I use rmvnorm to simulate 9 variables and then dichotomize/categorize them, I cant retrieve the population covariance matrix. -- View this message in context: http://r.789695.n4.nabble.com/simulate-correlated-binar

[R] list assignment syntax?

2012-03-30 Thread ivo welch
Dear R wizards: is there a clean way to assign to elements in a list? what I would like to do, in pseudo R+perl notation is f <- function(a,b) list(a+b,a-b) (c,d) <- f(1,2) and have c be assigned 1+2 and d be assigned 1-2. right now, I use the clunky x <- f(1,2) c <- x[[1]] d <- x[[2]

[R] Problem loading package 'JGR' using R-2.15.0 (Win32).

2012-03-30 Thread Caitlin
Hi all. Upon attempting to load the 'JGR' package, on a Win32 machine (SP3), a pop-up message appeared stating that R had encountered a problem and needs to close. Has anyone else encountered this? Thanks. ~Caitlin [[alternative HTML version deleted]] __

[R] From S to R

2012-03-30 Thread joshua blackwell
Hello everyone, I run S-Plus 8.1 for development and a Tibco Spotfire 3.1 stat server currently to serve my client. We are converting to open source and I was wondering if there is any documentation on converting some S-plus functions over to R. We do some plotting and basic database manipulatio

Re: [R] Changing multiple instances in data.frame

2012-03-30 Thread Trevor Davies
If I could add one comment, the above solution leaves NAs if you are not changing the names of all of the variables (those not present are assigned NA's). The solution for this is of course: df1 <- data.frame(V1=1:3,V2=c(paste(LETTERS[1],LETTERS[1:3],sep='')),stringsAsFactors = FALSE) unique(df1$

Re: [R] avoiding expression evaluation when calling a function

2012-03-30 Thread Benjamin Caldwell
Hey thanks, that worked. So you're right, I'd like to run it for multiple values of i. As it's written, I'm doing it in a for loop, as plotter<-function(i,fram,framvec,obj,form1,form2){ temp.i<-fram[framvec <=(i*.10),] plot(form1, data=temp.i, xlim=c(0,1500), ylim=c(0,35), main=(i*.10)) mod<-lm(

Re: [R] getopt does not work as expected!

2012-03-30 Thread Juergen Rose
Am Mittwoch, den 28.03.2012, 14:08 +0200 schrieb Juergen Rose: > I have the following script (also attached): > ... > Ausführung angehalten > > This behaviour I don't like at all. Why getopt does not distinguish > beetween options starting with alt least one hyphen and normal arguments > starting

Re: [R] Adding text for written comments to bottom of graphs

2012-03-30 Thread baptiste auguie
Hi, I would do the following, library(ggplot2) require(reshape) TestData <- structure(list(profile_key = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3), line = c(1, 1, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1), instance = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2), drug = structure(c(

Re: [R] How to improve, at all, a simple GLM code

2012-03-30 Thread Ben Bolker
On 12-03-30 12:40 PM, Clifton, Abigail J. wrote: > Hi again! > > Thanks very much for the code, it appears to work! Finally, I want > to extract the coefficients and tried coef(g1), which works. > However, there only appear to be intercepts/coefficients for 'V22N' > out of thousands of possibili

[R] ff usage for glm

2012-03-30 Thread Bond, Stephen
Greetings useRs, Can anyone provide an example how to use ff to feed a very large data frame to glm? The data.frame cannot be loaded in R using conventional read.csv as it is too big. glm(...,data=ff.file) ?? Thank you Stephen B __ R-help@r-project.

Re: [R] scalar assignment within a vector within function

2012-03-30 Thread Benjamin Caldwell
Ok, I've modified it as suggested so as to not pass to the global. Thanks for the suggestions, and the link to the interesting reading. On Fri, Mar 30, 2012 at 12:26 PM, William Dunlap wrote: > I think you will be happier in the long run if you use the approach > Peter suggested. Do not use <<-

Re: [R] avoiding expression evaluation when calling a function

2012-03-30 Thread Bert Gunter
Start by reading the Help files,please. ?plot.formula ## and note the data argument So dispense with the unnecessary complex constructions altogether: plot( y~x, data = temp.i) -- Bert On Fri, Mar 30, 2012 at 12:42 PM, Joshua Wiley wrote: > Hi Benjamin, > > See inline > > On Fri, Mar 30, 20

Re: [R] pooling in MICE

2012-03-30 Thread 123
Hi Nicole, Thank you very much for the code. I agree with you that the code in the pdf could work just fine. However, maybe my situation is a little bit different, since I "cbind" three dependent variables. I think this may cause some problems when pooling. I can not use MANOVA function beca

Re: [R] avoiding expression evaluation when calling a function

2012-03-30 Thread Joshua Wiley
Hi Benjamin, See inline On Fri, Mar 30, 2012 at 12:31 PM, Benjamin Caldwell wrote: > Another question on functions - I have something that looks like > > plotter<-function(i){ > temp.i<-rwb[rwb$vector1 <=(i*.10),] >  with(temp.i, plot(vector2, vector3, main=(i*.10),)) > mod<-lm(vector3~vector3-1

[R] avoiding expression evaluation when calling a function

2012-03-30 Thread Benjamin Caldwell
Another question on functions - I have something that looks like plotter<-function(i){ temp.i<-rwb[rwb$vector1 <=(i*.10),] with(temp.i, plot(vector2, vector3, main=(i*.10),)) mod<-lm(vector3~vector3-1,data=temp.i) r2<-summary(mod)$adj.r.squared rsqrd[i]<-r2 legend("bottomright", legend=signif(r2

Re: [R] scalar assignment within a vector within function

2012-03-30 Thread Benjamin Caldwell
Thanks all - ended up going with test<<-test On Thu, Mar 29, 2012 at 4:40 PM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Thu, Mar 29, 2012 at 3:49 PM, Benjamin Caldwell > wrote: > > Hello, > > > > I'm trying to create a vector of r^2 values for using a function which I > > will

[R] Distribution of cluster medoids

2012-03-30 Thread tsippel
When looking at the histogram distribution of medoids from a cluster analysis, clara{cluster}, they are close to normally distributed around zero. The cluster plot, clusplot{cluster}, does not suggest distinct partitions. How should the histogram distribution of medoids be interpreted? Can one s

[R] defining non linear predictors from nls in gam?

2012-03-30 Thread Francisco Mora Ardila
Hi all I´m trying to analize the role of time since abandonement (continuous variable) and biophysical environmental conditions on the recovery of the vegetation trough succession. First, I used non-linear least squares with nls function to model the effect of time on vegetation attributes.

Re: [R] removing NA from multidmension arrays

2012-03-30 Thread Peter Ehlers
On 2012-03-30 10:15, Rui Barradas wrote: Hello, Bcampbell99 wrote Hi: I'm having some difficulty properly subscripting a function to remove complete NA rows from a R array object. Could someone please suggest how best to script this out? Data structure: X is an array with 3 dimensions (re

Re: [R] Help with the lumi R package

2012-03-30 Thread R. Michael Weylandt
Hi Amy, You might repost this question to the Bioconductor mailing list: you'll get more specialized help there. But to answer your questions as best I can see inline: On Fri, Mar 30, 2012 at 12:15 PM, Minyue Wang wrote: > Hi all, > My name is Amy, I am a masters student in Bioinformatics at Nor

Re: [R] removing NA from multidmension arrays

2012-03-30 Thread Rui Barradas
Hello, Bcampbell99 wrote > > Hi: > > I'm having some difficulty properly subscripting a function to remove > complete NA rows from a R array object. Could someone please suggest how > best > to script this out? > > Data structure: > > X is an array with 3 dimensions (replicates, Species, Si

[R] Requirement for Java Resource [REQ:104400]

2012-03-30 Thread Mir Mukarram Ali
[1]Click here to unsubscribe if you no longer wish to receive our emails Dear Partner, Here is our Direct client requirement which can be filled immediately. Kindly respond to this requirement with your consultant resume, contact and current location info to speed up

[R] Rpart-Moran test

2012-03-30 Thread MYRIAM TABASSO
Dear All, if I use rpart to built a regression tree and if I study the spatial autocorrelation of the residuals of regression tree, how I use Moran test (or other test) on these residuals? Moran's Test work on lm object, but I have a rpart object. thanks, Myriam [[alternative HTML version

[R] Help with the lumi R package

2012-03-30 Thread Minyue Wang
Hi all, My name is Amy, I am a masters student in Bioinformatics at North Carolina State University. I am working on a project and I am trying to use the lumi R package for microarray data analysis. I have shown the sample code here and have questions about modifying the sample code for my own data

[R] Requirement for Java Resource [REQ:104400]

2012-03-30 Thread Mir Mukarram Ali
[1]Click here to unsubscribe if you no longer wish to receive our emails Dear Partner, Here is our Direct client requirement which can be filled immediately. Kindly respond to this requirement with your consultant resume, contact and current location info to speed up

Re: [R] SARIMA MODEL QUESTION

2012-03-30 Thread sagarnikam123
how will you decide P,D & Q in sarima() function using code,can u give me code -- View this message in context: http://r.789695.n4.nabble.com/sorting-the-data-tp857402p4519263.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

[R] Help with lumi package R code

2012-03-30 Thread Minyue Wang
Hi all, My name is Amy, I am a masters student in Bioinformatics at North Carolina State University. I am working on a project and I am trying to use the lumi R package for microarray data analysis. I have shown the sample code here and have questions about modifying the sample code for my own data

Re: [R] how to calculate predicted probability of Cox model

2012-03-30 Thread JiangGZ
Thanks for your reply. I'm trying to use "predictProb.coxph()" function in "peperr" package to calculate the predicted probability. Here the particular time, do you mean the total follow-up time for each subject? Because the predict.coxph() function didn't provide a time parameter to inp

Re: [R] error message in logistic regression

2012-03-30 Thread carlb1
I wont lie it is for a home exam yes and i know that i need to do a logistic regression on this data set I have already done one on another data set and i am just asking how to overcome the problem in R. -- View this message in context: http://r.789695.n4.nabble.com/error-message-in-logistic-reg

[R] removing NA from multidmension arrays

2012-03-30 Thread Bcampbell99
Hi: I'm having some difficulty properly subscripting a function to remove complete NA rows from a R array object. Could someone please suggest how best to script this out? Data structure: X is an array with 3 dimensions (replicates, Species, Sites) replicates: 1 to 6 but ragged...not all sites

[R] plot titles for multiple plots

2012-03-30 Thread Jeff Breiwick
Hello, I have 8 plots, set up using par(mfrow=c(4,2)). Centered over each of the 4 rows I want a single title (since each row pertains to the same item but the 2 plots have different x & y labels). Is there a way I can do that without changing the layout? mtext? Thank you. Jeff __

Re: [R] Trying to understand factors

2012-03-30 Thread Julio Sergio
David Winsemius comcast.net> writes: > > > I think you need to understand indexing more than you need to > understand factors. > > incomes [ which(statef == "act") ] > > If you want to understand how to programmatically access levels, then > you only need to follow the "See also" links o

Re: [R] Ignoring version numbers when installing packages...

2012-03-30 Thread Duncan Murdoch
On 30/03/2012 12:47 PM, Jonathan Greenberg wrote: Follow-up: r-forge seems to have some weirdnesses with version numbers, and since this is an incubation site, there are occasions where the version numbers were put in based on whatever the programmer was using at a time (e.g. other versions were

Re: [R] Trying to understand factors

2012-03-30 Thread Julio Sergio
Sarah Goslee gmail.com> writes: > > Hi Julio, > > You can use a factor to index another object just as you'd use any other > index: > > incomes[statef == "act"] > [1] 46 43 > Is there something specific you're trying to accomplish? > > Sarah > Thanks Sarah! I'm just learning R. Thanks agai

Re: [R] Trying to understand factors

2012-03-30 Thread David Winsemius
On Mar 30, 2012, at 12:50 PM, Julio Sergio wrote: I'm trying to figure out about factors, however the on-line documentation is rather sparse. I guess, factors are intended for grouping arrays members into categories, which R names "Levels". And so we have: * state <- c("tas", "sa", "qld

Re: [R] Trying to understand factors

2012-03-30 Thread Sarah Goslee
Hi Julio, You can use a factor to index another object just as you'd use any other index: > incomes[statef == "act"] [1] 46 43 It looks like you're using the R intro guide, but there's a lot of other material available. Try this one for starters: http://www.stat.berkeley.edu/classes/s133/factors.

Re: [R] Memory limits for MDSplot in randomForest package

2012-03-30 Thread Liaw, Andy
Sam, As you've probably seen, all the MDSplot() function does is feed 1 - proximity to the cmdscale() function. Some suggestion and clarification: 1. If all you want is the proximity matrix, you can run randomForest() with keep.forest=FALSE to save memory. You will likely want to run somewhat

[R] Trying to understand factors

2012-03-30 Thread Julio Sergio
I'm trying to figure out about factors, however the on-line documentation is rather sparse. I guess, factors are intended for grouping arrays members into categories, which R names "Levels". And so we have: * state <- c("tas", "sa", "qld", "nsw", "nsw", "nt", "wa", "wa", "

Re: [R] Ignoring version numbers when installing packages...

2012-03-30 Thread Jonathan Greenberg
Follow-up: r-forge seems to have some weirdnesses with version numbers, and since this is an incubation site, there are occasions where the version numbers were put in based on whatever the programmer was using at a time (e.g. other versions were simply not tested, so they erred on the safe side).

Re: [R] Ignoring version numbers when installing packages...

2012-03-30 Thread Duncan Murdoch
On 30/03/2012 12:05 PM, Jonathan Greenberg wrote: R-helpers: I'm trying to install a package from r-forge, and I'm wondering if there is a way to force R to install a package, even if the package "requires" a certain version of R (short of modifying the DESCRIPTION file)? Cheers! You don't gi

[R] RMySQL and german umlaute

2012-03-30 Thread Sven Garbade
Hi list, I have some trouble to setup RMySQL correctly to work with german umlaute: > library(RMySQL) Loading required package: DBI > pg <- dbDriver("MySQL") > con <- dbConnect(pg, username="dummy", host="localhost", password="", dbname="ga1prosp") > dbGetQuery(con, statement="SELECT * FROM Körp

[R] Ignoring version numbers when installing packages...

2012-03-30 Thread Jonathan Greenberg
R-helpers: I'm trying to install a package from r-forge, and I'm wondering if there is a way to force R to install a package, even if the package "requires" a certain version of R (short of modifying the DESCRIPTION file)? Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Departmen

Re: [R] Akaike's Final Prediction Error (FPE)

2012-03-30 Thread Mark Leeds
I don't know FPE is but in the case of the Akiaike Information Criterion, the actual value depends on whether you include constants and multipliers in ( derivation of ) the formula. It doesn't matter in that case because you're only comparing AIC's ( and the lower the better ). Since, I don't what

Re: [R] How to get the most frequent value of the subgroup

2012-03-30 Thread Milan Bouchet-Valat
Le vendredi 30 mars 2012 à 11:39 -0400, David Winsemius a écrit : > On Mar 30, 2012, at 3:38 AM, Milan Bouchet-Valat wrote: > > > Le jeudi 29 mars 2012 à 09:49 -0500, Yongsuhk Jung a écrit : > >> Dear Members of the R-Help, > >> > >> > >> > >> While using a R function - 'aggregate' that you develo

Re: [R] pooling in MICE

2012-03-30 Thread 123
HI Nicole, Homework? No, it is a part of analysis for my paper. Any idea? ya At 2012-03-30 23:32:21,"Nicole Marie Ford" wrote: >ya, > >is this homework? > > >- Original Message - >From: "ya" >To: r-help@r-project.org >Sent: Friday, March 30, 2012 9:04:59 AM >Subject: [R] pool

Re: [R] How to get the most frequent value of the subgroup

2012-03-30 Thread David Winsemius
On Mar 30, 2012, at 3:38 AM, Milan Bouchet-Valat wrote: Le jeudi 29 mars 2012 à 09:49 -0500, Yongsuhk Jung a écrit : Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, aggregate(x, by, FUN, ..., simpl

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-30 Thread Greg Snow
Partly this depends on what you mean by a covariance between categorical variables (and binary) and what is a covariance between a categorical and a continuous variable? On Thu, Mar 29, 2012 at 12:31 PM, Burak Aydin wrote: > Hi, > I d like to simulate 9 variables; 3 binary, 3 categorical and 3 co

Re: [R] error message in logistic regression

2012-03-30 Thread David Winsemius
On Mar 30, 2012, at 8:12 AM, carlb1 wrote: Hi I am trying to do a logistic regression on a small data file yet when i get up to plotting the first set of graphs instead of 4 I only get one graph, and some error messages. Yet it still looks like the program is doing something due to the "bl

[R] Adding text for written comments to bottom of graphs

2012-03-30 Thread Paul Miller
Hello All, Recently developed the code below for graphing patterns of chemotherapy administration. As someone just starting to use R in their work, I managed to figure out some parts of the code but needed help with others. setwd("N:/Regimen Coding/0906/Plots Test") getwd() TestData <- struct

Re: [R] discrepancy between paired t test and glht on lme models

2012-03-30 Thread Greg Snow
I nominate the following paragraph for the fortunes package: "The basic issue appears to be that glht is not smart enough to deal with degrees of freedom so it uses an asymptotic z-test instead of a t-test. Infinite df, basically, and since 4 is a pretty poor approximation of infinity, you get you

[R] lubridate:ymd_hm and coercion of class POSIXct. Smooth way to restore the date format.

2012-03-30 Thread Henrik Pärn
Dear all, I wish to create a POSIXct variable from date and time variables using the ymd_hm function in package lubridate. In some cases data for time is missing, which causes a problem for ymd_hm. I wish to find a smooth way to handle this. # Some example data: x <- data.frame(date = c("2011

[R] pooling in MICE

2012-03-30 Thread ya
Hi everyone, Does anyone here has experience using MICE to impute missing value? I am having problem to pool the imputed dataset for a MANOVA test, could you give me some advice please? Here is my code: > library(mice) > grd3dat=subset(paper2,Control==1&Grade_1==3,select=c(Boy,BVCategoryT1,re

Re: [R] how to increase speed for function?/time efficiency of below function

2012-03-30 Thread sagarnikam123
Yes sir,i m using another's code,i will acknowledge them in my paper publication when my project completes. but can u tell me, how to decide P,D & Q values in sarima() function using code its difficult to decide by visually,i have 4500 such time series -- View this message in context: http://r.

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-30 Thread inkhorn
Okay thanks to your help I figured it out and stuck the code in a function: df.sample.exIDs = function(main.df, sample1.df, n, ID1.name, ID2.name) { main.ID1.notin.ID2 = main.df[!main.df[,ID1.name] %in% sample1.df[,ID2.name],] sample2.df = main.ID1.notin.ID2[sample(nrow(main.ID1.notin.ID2), si

[R] Akaike's Final Prediction Error (FPE)

2012-03-30 Thread jp611
Hello, first of all I have found lots of different versions of the FPE which have given me different results. I was wondering if there was an explicit command in R to compute the FPE of a model. Thank you in advance, Jonny -- View this message in context: http://r.789695.n4.nabble.com/Akaike-s

Re: [R] Simple For Loop Help

2012-03-30 Thread arun.gurubaramurugeshan
Dr. Petris, Thank you so much for your help. I appreciate it. I am still learning R! Thanks Arun -- View this message in context: http://r.789695.n4.nabble.com/Simple-For-Loop-Help-tp4517088p4519056.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Update Packages error

2012-03-30 Thread David L Carlson
You can check to see if you have authorization to update those files by right-clicking on the R shortcut icon (on your desktop or in Windows | All Programs | R | R2.14.1 (your version may be different). In the menu that opens, if there is an option to Run as Administrator (near the top on my system

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-30 Thread David Winsemius
On Mar 30, 2012, at 8:17 AM, inkhorn wrote: Okay, here's some sample code: ID = c(1,2,3,"A1",5,6,"A2",8,9,"A3") fakedata = rnorm(10, 5, .5) main.df = data.frame(ID,fakedata) results for my data frame: main.df ID fakedata 1 1 5.024332 2 2 4.752943 3 3 5.408618 4 A1

Re: [R] how to calculate predicted probability of Cox model

2012-03-30 Thread Terry Therneau
-- begin included message --- Because Cox proportional hazards model didn't give the baseline hazard function, how to calculate the predictive probability for each test sample at a special time point,such as 5-year or 10-year ? In survival package, predict.coxph() function gives three different

Re: [R] How to calculate the Deviance for test data based on a Cox model

2012-03-30 Thread Terry Therneau
wrote: > > > Dear List, > > If I got a Cox model based on training set, then how should I calculate the Cox log partial likelihood for the test data? > Actually I am trying to calculate the deviance on test dataset to evaluate the performance of prediction model, the equation is as follows: D

Re: [R] Multiple line Graphs

2012-03-30 Thread jim holtman
If you read it in as a dataframe, then you can use 'split' to create the subsets by PolyNam and then use 'lapply' to the result of 'split' to plot it: lapply(split(yourDF, yourDF$PolyNam), function(.poly){ plot(.poly$Date, .poly$Total) }) On Fri, Mar 30, 2012 at 5:16 AM, TwistedSkies wrote:

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-30 Thread inkhorn
Okay, here's some sample code: ID = c(1,2,3,"A1",5,6,"A2",8,9,"A3") fakedata = rnorm(10, 5, .5) main.df = data.frame(ID,fakedata) results for my data frame: > main.df ID fakedata 1 1 5.024332 2 2 4.752943 3 3 5.408618 4 A1 5.362838 5 55.158660 6 64.658235 7

[R] Nonlinear regression / Curve fitting with L-infinity norm

2012-03-30 Thread Jack Fruit
Hello everyone, I am looking into time series data compression at the moment. The idea is to fit a curve on a time series of n points so that the maximum deviation on any of the points is not greater than a given threshold. In other words, none of the values that the curve takes at the points

[R] Multiple line Graphs

2012-03-30 Thread TwistedSkies
Hi Guys, I am trying to create 20 indivudual line graphs that will be updated on a weekly bases. I have managed to read in my data from SQL and defined my loop. I am having difficulty in plotting the data and I think it may have something to do with the way my data has been read in and maybe I nee

[R] error message in logistic regression

2012-03-30 Thread carlb1
Hi I am trying to do a logistic regression on a small data file yet when i get up to plotting the first set of graphs instead of 4 I only get one graph, and some error messages. Yet it still looks like the program is doing something due to the "blue wheel" of the mouse. Below is the script copied

Re: [R] Hosmer-Lemeshow 'goodness of fit'

2012-03-30 Thread Michael Dewey
At 19:34 29/03/2012, JimeBoHe wrote: I am a new user in R, so I am sorry if this is a basic question but I am kind of lost here and I really would appreciatte your help. Dear Jimena Comments in-line I have behavioral information of sea lions and I've done a binomial Generalized Linear model

[R] R 2.15.0 is released

2012-03-30 Thread Peter Dalgaard
The build system rolled up R-2.15.0.tar.gz (codename "Easter Beagle") at 9:00 this morning. This is the first release of the 2.15 series and contains several new features and changes; see the list below for details. You can get the source code from http://cran.r-project.org/src/base/R-2/R-2.1

Re: [R] subset problem

2012-03-30 Thread reeyarn
Thank you so much, Peter and Andrija :) On Thu, Mar 29, 2012 at 1:44 PM, peter dalgaard wrote: > %in% is your friend > mysub <- subset(df, type %in% type_list, select=c(name,type)) > or > mysub <- df[df$type %in% type_list, c("name","type")] > The latter is slightly safer if you can't be sure tha

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-30 Thread maxbre
yes elai, that's what I want! thank you for support maxbre -- View this message in context: http://r.789695.n4.nabble.com/xyplot-lattice-fine-control-of-axes-limits-and-thick-marks-with-log-scale-tp4511897p4518205.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] How to get the most frequent value of the subgroup

2012-03-30 Thread Milan Bouchet-Valat
Le jeudi 29 mars 2012 à 09:49 -0500, Yongsuhk Jung a écrit : > Dear Members of the R-Help, > > > > While using a R function - 'aggregate' that you developed, I become to have > a question. > > In that function, > > > > > aggregate(x, by, FUN, ..., simplify = TRUE) > > > > I was wondering

Re: [R] Transferring a dataset from WINXP to Mac - problems with umlauts

2012-03-30 Thread Frank Bloos
Indeed, I meant to transfer a dataframe. The dump method followed by source(encoding = "cp1252") worked fine. Thank you very much. FB Am 28.03.2012 um 14:52 schrieb Prof Brian Ripley: > On 28/03/2012 13:27, David Winsemius wrote: >> On a Mac running with a US locale, when I first type -u (in >>