Re: [R] How can I access an element of a string?

2012-07-26 Thread Henrik Singmann
Dear Miao, substr() ius waht you want. substr("ABCD", 2,2) [1] "B" Cheers, Henrik jpm miao schrieb: Dear Daniel and Jorge, Thank you very much and it does help. If I have a string "ABCD", how can I access the second element of the string "B"? Thanks, Miao 2012/7/27 Daniel Nordlund

Re: [R] Working with Numbers generated from Regression Output

2012-07-26 Thread Jeff Newmiller
Stop posting HTML. What you see is NOT what we see. As regards to your problems... you need to learn how to get data into and out of R, so please read the R Input/Output document supplied with R. The most foolproof way is to write the data to a CSV file and read it from there into a spreadsheet

[R] Working with quantmod chartSeries and plot.zoo

2012-07-26 Thread OTB
Hi all, I'm a newbie to R and it has been very helpful to use your website. Unfortunately I've been struggling with my code now for two days so I wanted to ask few questions. I've been trying to create nice graphs to put into a pdf sheet but I'm having little problems with all the packages I've be

Re: [R] Working with Numbers generated from Regression Output

2012-07-26 Thread Krunal Nanavati
Hi Jean, Thank you very much for getting back to me. I tried the solutions that you have provided. First I tried the …coef(result) statement….and I got the below output >coef(result) (Intercept)X Volume -30.40275264 0.57786290 0.02594024 Then, I simply selecte

[R] Eleaps in package subselect crashes when using include arguement

2012-07-26 Thread Nathan Stephens
I'm using eleaps to build a forward selection algorithm iteratively, but the program unexpectedly crashes. In fact, it completely closes my session in RStudio. The first 39 steps work fine, but on the 40th step, it unexpectedly stops with no errors. I've isolated the error to the code snippit below

Re: [R] Passing arguments to SQL Query in R

2012-07-26 Thread guruappa
Thanks a ton, much appreciated. On 26-Jul-2012, at 8:35 PM, John Kane [via R] wrote: > Let me count the ways... > > R supplies a number of different ways. Here is sample using basic R and some > other packages. Youprobably will need to install the packages ( > ?install.packages) to run any

Re: [R] Passing arguments to SQL Query in R

2012-07-26 Thread guruappa
Thanks a ton, much appreciated... On 26-Jul-2012, at 7:56 PM, Michael Weylandt [via R] wrote: > On Thu, Jul 26, 2012 at 3:59 AM, guruappa <[hidden email]> wrote: > > > Hello all, > > > > I am a newbie at R, with some experience in PERL. > > > > I have a database table that contains the follo

[R] How can I access an element of a string?

2012-07-26 Thread jpm miao
Dear Daniel and Jorge, Thank you very much and it does help. If I have a string "ABCD", how can I access the second element of the string "B"? Thanks, Miao 2012/7/27 Daniel Nordlund > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.or

Re: [R] add leading zeros

2012-07-26 Thread Jorge I Velez
Hi Josh, Check ?formatC and ?sprintf for some options. Regards, Jorge.- Sent from my phone. Please excuse my brevity and misspelling. On Jul 27, 2012, at 12:49 AM, LCOG1 wrote: > Hi all, > Trying to use an apply to add leading zeros to a set of values in a > given vector. I only want to ad

Re: [R] Counting frequency within each range

2012-07-26 Thread Chintanu
Thank you, all ! That's very helpful. Kind regards, Chintanu = On Fri, Jul 27, 2012 at 12:57 PM, arun wrote: > Hi, > > Try this:a<-c(4,5,23,34,43,54,56,65,67,324,435,453,456,567,657) > a1<-melt(table(cut(a,breaks=c(0,10,20,30,60,120,240,480,960 > a2<-d

[R] lmer t value for 3 levels of fixed factor

2012-07-26 Thread Obermeier Andrew
Hello, I just joined this list today, so am worried about proper protocol, but would like to post a question about lme4. In Baayen, Davidson, and Bates (2008), Mixed-effects modeling with crossed random effects for subjects and items, the authors describe steps for a Latin Square Design (p. 40

Re: [R] add leading zeros

2012-07-26 Thread R. Michael Weylandt
Much easier than you think: x <- c(1L, 9000L) sprintf("%05i",x) Best, Michael On Thu, Jul 26, 2012 at 8:08 PM, LCOG1 wrote: > Hi all, > Trying to use an apply to add leading zeros to a set of values in a > given vector. I only want to add enough zeros so that the total number of > charac

Re: [R] Counting frequency within each range

2012-07-26 Thread arun
Hi, Try this:a<-c(4,5,23,34,43,54,56,65,67,324,435,453,456,567,657) a1<-melt(table(cut(a,breaks=c(0,10,20,30,60,120,240,480,960 a2<-data.frame(sapply(a1,function(x) gsub("\\(|\\]","",gsub("\\,","-",x colnames(a2)<-c("numbers","Freq") a2 #  numbers Freq #1    0-10    2 #2   10-20    0 #3  

[R] lme4 t value for 3 levels of fixed factor

2012-07-26 Thread Obermeier Andrew
Hello, I just joined this list today, so am worried about proper protocol, but would like to post a question about lme4. In Baayen, Davidson, and Bates (2008), Mixed-effects modeling with crossed random effects for subjects and items, the authors describe steps for a Latin Square Design (p. 40

[R] cannot load workspace

2012-07-26 Thread Jiajie-Yu
Hi all I was running randomForest with R 2.51.1& RStudio 0.96.316. when i fit a classificassion there is an error "cannot allocate vector of size 113.3 Mb".then I saved workspace as default and quit RStudio. I try open it later, it show the error" Error: cannot allocate vector of size 27

[R] MetaCost (and RandomForest)

2012-07-26 Thread Annelen Brunner
Hello! Is there an implementation of the MetaCost algorithm in R? I found a project here: https://r-forge.r-project.org/scm/viewvc.php/src/mlrCost/metacost.r?root=mlr&view=log But I'm not sure about its status - it seems unfinished to me. My goal is to use MetaCost for cost-sensitive learning of

Re: [R] names function not working at the 2nd place in a program

2012-07-26 Thread arun
HI, I am not getting errors with this:  myvar1<- array(1:3, c(2,4))  myvar2<- array(4:6, c(2,4))  names(myvar1) #NULL names(myvar1)<-as.numeric(1:8) names(myvar1) [1] "1" "2" "3" "4" "5" "6" "7" "8"  names(myvar2)<-names(myvar1) names(myvar2) [1] "1" "2" "3" "4" "5" "6" "7" "8" #But, if you loo

Re: [R] R doesn't recognize R_HOME value

2012-07-26 Thread Kirk Fleming
I wanted to wrap this up, since I feel it's been resolved. R_HOME never did need to over-ridden by me, was not being over-ridden in spite of my attempts, and was never a factor during the long period when 'everything worked'. In fact, my entire ordeal was caused by removing a comment from the rpr

Re: [R] Get XML or JSON data from api into data frame

2012-07-26 Thread Richard Ohrvall
Thank you Erdal and Hadley for your answeres. It now works perfectly. Also, I will look at the github solution, even if I don't have any experience of Ruby. Once again, thank you. Richard 2012/7/26 Hadley Wickham : > On Thu, Jul 26, 2012 at 4:18 AM, Richard Ohrvall > wrote: >> Dear all, >> >> I

[R] add leading zeros

2012-07-26 Thread LCOG1
Hi all, Trying to use an apply to add leading zeros to a set of values in a given vector. I only want to add enough zeros so that the total number of characters is 5, so if I have an element "1" i want "1" or "9000" I want "09000". I tried vec <- 1:1000 sapply(vec, FUN = sprintf(paste

Re: [R] density

2012-07-26 Thread Bert Gunter
Inline. -- Bert On Thu, Jul 26, 2012 at 8:12 PM, li li wrote: > Thank you for the reply. I do have another question. > > I also want to estimate the derivatives of a density function using the > derivatives of kernel density estimator. > > It is easy to write out the estimator, for example, for

Re: [R] How can I access the title of a table read via read.csv?

2012-07-26 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of jpm miao > Sent: Thursday, July 26, 2012 9:12 PM > To: r-help > Subject: [R] How can I access the title of a table read via read.csv? > > Hi, > >I have a table which I can re

Re: [R] How can I access the title of a table read via read.csv?

2012-07-26 Thread Jorge I Velez
Try colnames(fx1)[2] See ?colnames HTH, Jorge.- On Fri, Jul 27, 2012 at 12:12 AM, jpm miao <> wrote: > Hi, > >I have a table which I can read via read.csv: > > fx1<-read.csv(file="A_FX_M.csv", header=TRUE) > > TIME REERNTDJPY GBPHKD > 1 198001 124.26 36.030 237.96 2

[R] How can I access the title of a table read via read.csv?

2012-07-26 Thread jpm miao
Hi, I have a table which I can read via read.csv: fx1<-read.csv(file="A_FX_M.csv", header=TRUE) TIME REERNTDJPY GBPHKD 1 198001 124.26 36.030 237.96 2.263980 4.8366 2 198002 126.59 36.030 244.05 2.290426 4.8765 3 198003 128.33 36.026 248.62 2.206045 4.9960 4 198004 127.

Re: [R] density

2012-07-26 Thread li li
Thank you for the reply. I do have another question. I also want to estimate the derivatives of a density function using the derivatives of kernel density estimator. It is easy to write out the estimator, for example, for Gaussian kernel. The difficulty is finding the appropriate bandwidth. Is th

Re: [R] Linking to C type short?

2012-07-26 Thread Duncan Murdoch
On 12-07-26 9:06 PM, Spencer Graves wrote: On 7/26/2012 4:51 PM, Duncan Murdoch wrote: On 12-07-26 4:22 PM, Spencer Graves wrote: Hello, All: What references exist on how to link to C? I'm familiar with sections 5.2 and 5.6 of the "Writing R Extension" manual plus chapter

Re: [R] code coverter r to C

2012-07-26 Thread R. Michael Weylandt
Various abortive attempts have been tried, but no -- nothing of production quality. [To my knowledge] Michael On Jul 26, 2012, at 3:37 PM, suman kumar wrote: > Hi all, is there a package for converting R code into C code? > Thanks. > Suman > > > > -- > View this message in context: > http

Re: [R] How can I correctly access a string element of a dataframe?

2012-07-26 Thread jpm miao
Thank you very much. Actually I have to delete the quotation mark of the file name in the file "B_M2Q.csv" A_FX_M.csv and then it would work. A similar problem emerges but I can't find a solution. The next step is to read the date. My date in the csv file is in the format "1981-01" I can't read i

Re: [R] RGL

2012-07-26 Thread David Winsemius
On Jul 26, 2012, at 4:46 AM, Guillaume Meurice wrote: Dear all, I was willing to use the library "rgl" to plot some 3D graphics, but unfortunately, I wan't able to instal the library. The error message is below. I would be very grateful if you could give me any clues about how I can so

Re: [R] Counting frequency within each range

2012-07-26 Thread David L Carlson
table(cut(numbers, c(0, 10, 20, 30, . . .), include.lowest=TRUE)) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] Counting frequency within each range

2012-07-26 Thread R. Michael Weylandt
Combine cut() and table() Michael On Jul 26, 2012, at 8:22 PM, Chintanu wrote: > Hi, > > This is a simple problem, but for the life of me I cannot find the answer. > How to determine frequency within given ranges ? > I know that table() gives frequency, for example > > a <- table(numbers) >>

[R] Counting frequency within each range

2012-07-26 Thread Chintanu
Hi, This is a simple problem, but for the life of me I cannot find the answer. How to determine frequency within given ranges ? I know that table() gives frequency, for example a <- table(numbers) > a numbers 4 5 23 34 43 54 56 65 67 324 435 453 456 567 657 2 1 2 2 1 1

Re: [R] Linking to C type short?

2012-07-26 Thread Spencer Graves
On 7/26/2012 4:51 PM, Duncan Murdoch wrote: On 12-07-26 4:22 PM, Spencer Graves wrote: Hello, All: What references exist on how to link to C? I'm familiar with sections 5.2 and 5.6 of the "Writing R Extension" manual plus chapter 6 of Venables and Ripley (2000) S Programming

Re: [R] coxph weirdness

2012-07-26 Thread Peter Langfelder
On Thu, Jul 26, 2012 at 4:19 PM, Thomas Lumley wrote: > YOu need to update the survival package: from its NEWS file > > Changes in version 2.36-14 >A supposedly cosmetic change to coxph in the last release caused > formulas with a "." on the right hand side to fail. Fix this and add a > case

Re: [R] conditional sum two dataframes

2012-07-26 Thread Rui Barradas
Hello, Try the following. m <- unlist(months) v <- unlist(values) aggregate(v ~ m, FUN=sum) tapply(v, m, sum) Hope this helps, Rui Barradas Em 26-07-2012 18:49, jcrosbie escreveu: I have two data frames. One with a matrix of months and the other with a matrix of values. The two dataframes c

Re: [R] Linking to C type short?

2012-07-26 Thread Duncan Murdoch
On 12-07-26 4:22 PM, Spencer Graves wrote: Hello, All: What references exist on how to link to C? I'm familiar with sections 5.2 and 5.6 of the "Writing R Extension" manual plus chapter 6 of Venables and Ripley (2000) S Programming (Springer). From these, I get the following:

Re: [R] RGL

2012-07-26 Thread Duncan Murdoch
On 12-07-26 7:46 AM, Guillaume Meurice wrote: Dear all, I was willing to use the library "rgl" to plot some 3D graphics, but unfortunately, I wan't able to instal the library. The error message is below. I would be very grateful if you could give me any clues about how I can solve this. I d

Re: [R] coxph weirdness

2012-07-26 Thread Thomas Lumley
YOu need to update the survival package: from its NEWS file Changes in version 2.36-14 A supposedly cosmetic change to coxph in the last release caused formulas with a "." on the right hand side to fail. Fix this and add a case with "." to the test suite. -thomas On Thu, Jul 26, 2012 at

Re: [R] precision warning in delaunayn function

2012-07-26 Thread Rolf Turner
Not answering your question but . coord <- as.data.frame(coord) names(coord) <- c("x","y") require(deldir) tryit <- deldir(coord) plot(tryit) yields the attached graph. No problema. cheers, Rolf Turner On 26/07/12 19:26, Jean-Luc Dupouey wrote: Dear

[R] coxph weirdness

2012-07-26 Thread Peter Langfelder
Hi all, I cant' wrap my head around an error from the coxph function (package survival). Here's an example: library(survival) n = 100; set.seed(1); time = rexp(n); event = sample(c(0,1), n, replace = TRUE) covar = data.frame(z = rnorm(n)); model = coxph(Surv(time, event)~ . , data = covar) R g

Re: [R] names function not working at the 2nd place in a program

2012-07-26 Thread Bert Gunter
Actually, better to use the names() extractor. ?names -- Bert Sent from my iPhone -- please excuse typos. On Jul 26, 2012, at 3:08 PM, Rui Barradas wrote: > Hello, > > About the cause of your problem, it's difficult to have an idea without any > code. But maybe it's helpfull to know that 'na

Re: [R] names function not working at the 2nd place in a program

2012-07-26 Thread MacQueen, Don
I rather suspect you don't understand what it means to name an array. Consider this example: > myvar <- 1:4> myvar [1] 1 2 3 4 > names(myvar) NULL > names(myvar) <- letters[1:4] > myvar a b c d 1 2 3 4 > names(myvar) [1] "a" "b" "c" "d" > as.numeric(names(myvar)) [1] NA NA NA NA Warning message:

Re: [R] Sub-Directories

2012-07-26 Thread MacQueen, Don
I would suggest that you think in terms of several different working directories, one for each project and located wherever you want, rather than a "WorkingDirectory" with sub-directories. Then, when you start R, learn how to set its working directory to a project's directory. That will keep your

Re: [R] Query

2012-07-26 Thread David L Carlson
Actually you probably want the full manual. It is here http://cran.r-project.org/doc/manuals/fullrefman.pdf -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From:

Re: [R] names function not working at the 2nd place in a program

2012-07-26 Thread Rui Barradas
Hello, About the cause of your problem, it's difficult to have an idea without any code. But maybe it's helpfull to know that 'names' is an attribute, so you can see its value with attr(x, "names") # just 'names' attribute attributes(x)# values of all attributes Hope this helps, Ru

Re: [R] Plotting LDA results

2012-07-26 Thread David L Carlson
You asked why you could not get two discriminant functions and that question was answered. The number of discriminant functions is one less than the number of groups (assuming you have more variables than groups). Now you are asking a different question. How to plot the discriminant boundary betwee

Re: [R] Solving quadratic equation in R

2012-07-26 Thread Rui Barradas
Hello, Surely one of f <- function(a) a^2 - a - 8.313 curve(f, from=0, to=1) # zeros of f root <- polyroot(c(-8.313, -1, 1)) ifelse(Im(root) == 0, Re(root), root) # minimum of f optimize(f, interval=c(0, 1)) Hope this helps, Rui Barradas Em 26-07-2012 22:13, Nordlund, Dan (DSHS/RDA) escreve

Re: [R] density

2012-07-26 Thread David L Carlson
If you want a recommendation, why not use the one that comes with the manual page for density(): ?density Under bw "The default, "nrd0", has remained the default for historical and compatibility reasons, rather than as a general recommendation, where e.g., "SJ" would rather fit, see also V&R (20

[R] names function not working at the 2nd place in a program

2012-07-26 Thread zz
Hello, I am using names function to name an array. It works first time when I use *as.numeric(names(myVar1)* However, at a place later, when I tried to use a very similar line of code *as.numeric(names(myVar2)*, it always returned 'numeric(0)' (or if I only type 'names(myVar2), it gave me NULL'.

[R] Sub-Directories

2012-07-26 Thread Michael Grant
I've searched hard in texts, email threads, FAQs etc. and cannot find out how to successfully utilize sub-directories below my WorkingDirectory. I can create them, and create R objects within the sub-directories but (a) the objects() command lists ONLY the objects in the WorkingDirectory and no

Re: [R] conditional sum two dataframes

2012-07-26 Thread Bert Gunter
The values need not be a data frame as the number of unique months could be different among the columns, right?. So you're going to have to rethink your data structure. Probably as a list. Once you get that straight,?tapply and friends should make it trivial, if I understand you correctly. -- Ber

[R] code coverter r to C

2012-07-26 Thread suman kumar
Hi all, is there a package for converting R code into C code? Thanks. Suman -- View this message in context: http://r.789695.n4.nabble.com/code-coverter-r-to-C-tp4637999.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-projec

Re: [R] Error Bars ggplot2

2012-07-26 Thread Adam Gabbert
Hi Dennis, Part of my problem could be that I'm unsure how to nest another variable withn spd.f. Perhaps if I give a better explanation of my goal things will make more sense. My intent is to calculate two sets of confidence intervals to show the benefits of a DOE approach versus a Non-DOE appro

Re: [R] Getting warning message

2012-07-26 Thread namit
Hi Arun, Bymistake it kept X instead of Z16. -- View this message in context: http://r.789695.n4.nabble.com/Getting-warning-message-tp4637928p4637983.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Model comparison with bayesglm

2012-07-26 Thread dao06
Dear list I have a data set involving binary responses (successes failures) for which some explanatory variables result in a quasi complete separation problem. To deal with the separation problem I tried to run a glm with "bayesglm" in the arm package. However when I try to compare different bay

[R] conditional sum two dataframes

2012-07-26 Thread jcrosbie
I have two data frames. One with a matrix of months and the other with a matrix of values. The two dataframes correspond to each other. I would like to sum up all the values in by month. What would be an efficient way to do this? a=C(2,3,5,2,3,5) b=c(2,6,3,2,6,3) c=c(2,6,7,2,6,5) months <- dat

Re: [R] Solving quadratic equation in R

2012-07-26 Thread Diviya Smith
On Thu, Jul 26, 2012 at 5:16 PM, Diviya Smith wrote: > Thank you for pointing me to the uniroot function? > > Is there a way to constrain this solution so that it only gives me values > of 'a' between c(0,1)? > > I tried using nlminb and for some reason it always estimates a = 0, even > when I cha

Re: [R] Solving quadratic equation in R

2012-07-26 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Diviya Smith > Sent: Thursday, July 26, 2012 1:50 PM > To: r-help@r-project.org > Subject: Re: [R] Solving quadratic equation in R > > Sorry it is important for me to constrain t

Re: [R] Solving quadratic equation in R

2012-07-26 Thread Diviya Smith
Sorry it is important for me to constrain the value of 'a' between c(0,1) On Thu, Jul 26, 2012 at 4:48 PM, Diviya Smith wrote: > Hi there, > > I would like to solve a simple equation in R > > a^2 - a = 8.313 > > There is no real solution to this problem but I would like to get an > approximate nu

[R] Solving quadratic equation in R

2012-07-26 Thread Diviya Smith
Hi there, I would like to solve a simple equation in R a^2 - a = 8.313 There is no real solution to this problem but I would like to get an approximate numerical solution. Can someone suggest how I can set this up? Thanks in advance, Diviya [[alternative HTML version deleted]] ___

Re: [R] Package 'nlme' linear mixed effects model error "unexpected symbol"

2012-07-26 Thread Steve Taylor
This will work: model2007 <- You can't start an identifier with a digit. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of msherwood Sent: Thursday, 26 July 2012 9:44a To: r-help@r-project.org Subject: [R] Package 'nlme' linear mixed

[R] Linking to C type short?

2012-07-26 Thread Spencer Graves
Hello, All: What references exist on how to link to C? I'm familiar with sections 5.2 and 5.6 of the "Writing R Extension" manual plus chapter 6 of Venables and Ripley (2000) S Programming (Springer). From these, I get the following: R storage mode C type logical i

Re: [R] HELP

2012-07-26 Thread Weidong Gu
Hi, You can try predict.rpart in rpart package for prediction on a test data. ?predict.rpart Weidong On Thu, Jul 26, 2012 at 12:30 PM, Orla Carey wrote: > Hello, > > I am running classification trees fro the purpose of predicting dividends. > I have training and test data sets, but am running t

Re: [R] package memisc: recode examples

2012-07-26 Thread John Kane
"The following object(s) are masked from 'package:A'" is equivalent to "The following object(s) from 'package:A' are masked" and perhaps that might be a more universally understood phrasing. I do find this better but I don't see any real need to change the status quo. It becomes fairly obvious af

Re: [R] Integrate(dnorm) with different mean and standard deviation help

2012-07-26 Thread R. Michael Weylandt
I might suggest: integrate(dnorm, lower = -1.96 + 2 , upper = 1.96 + 2, mean = 2, sd = 1) instead. Incidentally, (and since I find this treatment of ... somewhat opaque) I think anonymous first class functions are much easier: integrate(function(x) dnorm(x, mean = 2, sd = 1), lower = -1.96, upp

Re: [R] HELP

2012-07-26 Thread Bert Gunter
Your post is unacceptable (imho, of course). Read the bottom of this message (re: "posting guide") and re-post properly. -- Bert On Thu, Jul 26, 2012 at 9:30 AM, Orla Carey wrote: > Hello, > > I am running classification trees fro the purpose of predicting dividends. > I have training and test d

Re: [R] Integrate(dnorm) with different mean and standard deviation help

2012-07-26 Thread FJ M
It would be a useful additon to the help page to add integrate(dnorm, lower = -1.96, upper = 1.96, mean = 2, sd = 1) as an example. Thanks, Frank Chicago > Date: Mon, 23 Jul 2012 19:54:45 -0700 > From: ehl...@ucalgary.ca > To: kri...@ymail.com > CC: chicagobrownb...@hotmail.com; r-help@

Re: [R] SSEc and SSEr

2012-07-26 Thread Bert Gunter
Sadly, your commonly held belief is wrong (imho) -- p values/statistical significance are not a legitimate decision criteria for model "appropriateness," especially scientific appropriateness. That requires more careful consideration of a relevant "utility function" (to use Frank Harrell's phrase),

Re: [R] Testing significance of interaction between group and longitudinal change for part of the age range in a mixed linear model

2012-07-26 Thread Bert Gunter
1. Your post is unacceptable (imho, of course). Read the bottom of this message (re: "posting guide") and re-post properly. 2. This is not an R-help question. Re-post on r-sig-mixed-models -- or perhaps on a non-R statistical forum like stats.stackexchange.com, as this appears to have little to do

[R] Using pspline in bic.surv of BMA package

2012-07-26 Thread Hui Xiong
Hi, I'm trying to using pspline in bic.surv{BMA}. # library(BMA) library(survival) data(veteran) test.bic.surv<- bic.surv(Surv(time,status) ~ karno+pspline(age,df=3)+diagtime+prior, data = veteran, factor.type = TRUE) summary(test.bic.surv, conditional=FALSE, digits=2

[R] HELP

2012-07-26 Thread Orla Carey
Hello, I am running classification trees fro the purpose of predicting dividends. I have training and test data sets, but am running to issues when evaluating the prediction accuracy of the tree as it isn't a simple 'predict' formulation as the determinant variable is not a simple set of classifyi

[R] Testing significance of interaction between group and longitudinal change for part of the age range in a mixed linear model

2012-07-26 Thread Angela Brant
Hi all, I've fit a mixed linear model to some longitudinal data. I'm interested in the differences in patterns of decrease in the dependent variable according to group status, and my hypothesis particularly predicts a difference between the groups in trajectory of change at between specific a

Re: [R] Getting warning message

2012-07-26 Thread arun
HI, I posted reply in nabble. One more comment regarding your code.  If your dataset is X.  I wonder how it changed to Z16.  Probably, you have to use X[5,2:5] A.K. - Original Message - From: namit To: r-help@r-project.org Cc: Sent: Thursday, July 26, 2012 9:23 AM Subject: [R] Get

Re: [R] SSEc and SSEr

2012-07-26 Thread suman kumar
You can make different lm objects by adding all predictors and compare them with anova(lm1,lm2,lm3...). See if p value is not significant, the more complex model is not appropriate. Dr Suman Kumar -- View this message in context: http://r.789695.n4.nabble.com/SSEc-and-SSEr-tp4637855p4637963.ht

Re: [R] Parallel computing on Windows (foreach)

2012-07-26 Thread R. Michael Weylandt
It's sad, but not an impossible result with synchronization overhead (though I wouldn't have guessed it would be that bad) -- can you try it on a more reasonable benchmark? Also, that advice might be somewhat out of date -- why not use the tools provided in library(parallel) available for recen

Re: [R] Advice on multi-user server for R

2012-07-26 Thread R. Michael Weylandt
On Thu, Jul 26, 2012 at 7:59 AM, Carrie Wager wrote: > I'm currently developing several tools in R that I'd like to deploy for use > by multiple analysts in my research group. Many of the analysts have no > background in using R (but have plenty of experience with SAS), so part of > my effort will

Re: [R] Error Bars ggplot2

2012-07-26 Thread John Kane
Is this what you mean? dat1 <- data.frame( spd = c("s","f","f","s","f","s","s","s","f","f","s","f"), r = c(4.9,3.2,2.1,.2,3.8,6.4,7.5,1.7,3.4,4.1,2.2,5)) myplot<-ggplot(dat1, aes(spd, r, colour = spd)) + geom_errorbar(aes(ymin=3, ymax=5), width=.1) + geom_point() + coord_flip

Re: [R] Getting warning message

2012-07-26 Thread andrija djurovic
Hi. I don't know how did you create data frame X but if you check str(X) you will see that you have one or more factors inside. Try using stringsAsFactors=FALSE options while creating data frame. Hope this helps. Andrija On Thu, Jul 26, 2012 at 3:23 PM, namit wrote: > Hi Friends, > > > I have

Re: [R] Adding "%" symbol in middle Row

2012-07-26 Thread John Kane
Something as simple as dat1[2,2] <- "3%" where your data is in a data.frame called dat will change 3 to 3% it but it changes everything in that column to character if it was numeric. str(dat1) John Kane Kingston ON Canada > -Original Message- > From: saileshchowd...@gmail.com > S

[R] Getting warning message

2012-07-26 Thread namit
Hi Friends, I have a data frame X, and I want to add “%” & “$” in row 4 and 5 respectively. when I’m trying using below logic, I’m getting warning message. Can anyone help me out on this. X: Summary G Y R T Accts582644 0 1226 AcctCov 230

Re: [R] Working with Numbers generated from Regression Output

2012-07-26 Thread suman kumar
Check str(lmobj). You can see the underlying structure of lm object. It is actually a list. You can access its individual components with $ operator. Bye -- View this message in context: http://r.789695.n4.nabble.com/Working-with-Numbers-generated-from-Regression-Output-tp4637919p4637957.htm

Re: [R] Only one class shown in SVM plot?

2012-07-26 Thread Meffy
Ok, here a simple example. The file http://r.789695.n4.nabble.com/file/n4637924/test.csv test.csv has 400 lines containing 20 columns (1. column is class label, the other 19 are the features). So what I'm doing is / data <- read.csv(file="test.csv", head=F, sep=",") names(data) <- c("Class","V1

[R] snow apparently using only one CPU (on Mac OS X)

2012-07-26 Thread Santiago Beguería Portugués
Hi, I am trying to optimize a complex model calibration using a genetic algorithm. I choose rgenoud package because it allows for easy parallelization through snow package. I am on a Mac Pro with 2 x 2.66 GHz 6-Core Intel Xeon machine, i.e. I have 12 CPUs available. So I set the cluster optio

Re: [R] Adjust the position of main in par(mfrow)

2012-07-26 Thread phillen
thanks! the line command worked well. -- View this message in context: http://r.789695.n4.nabble.com/Adjust-the-position-of-main-in-par-mfrow-tp4637901p4637948.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mail

Re: [R] Variables in a Tabular form. easily saved in a txt file

2012-07-26 Thread arun
HI, I guess this should be the one: dat1<-read.table(text=" Postal Code | Superb City1   |   2134  |  2 City2   |   254    |  5 City3   |   12  |  54433 ",sep="|",header=TRUE) write.table(dat1,"dat7.txt",sep="|",quote=FALSE) #contents of dat7.txt Postal.Code|

[R] how to plot hazard function for coxph model?

2012-07-26 Thread suman kumar
Dear all, I have been trying to plot hazard function in R for survival data, but in vain. Can anybody help me out in plotting hazard function in R? Dr Suman Kumar -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-hazard-function-for-coxph-model-tp4637953.html Sent fro

Re: [R] Get XML or JSON data from api into data frame

2012-07-26 Thread Erdal Karaca
You can try this one... # library(RCurl) library(rjson) ids <- c("tt0110074", "tt0096184", "tt0081568", "tt0448134", "tt0079367") titles <- data.frame() for ( i in 1:length(ids)) { req <- paste("http://www.imdbapi.com/?i=";, ids[i] , "&tomatoes=TRUE", sep="") u <- getURL(req) j <- fromJSON(u

Re: [R] strapply and characters adjacent to the matched pattern

2012-07-26 Thread mdvaan
Thanks Gabor for your invaluable help! I learned a lot. -- View this message in context: http://r.789695.n4.nabble.com/strapply-and-characters-adjacent-to-the-matched-pattern-tp4637673p4637939.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Package 'ordinal' question

2012-07-26 Thread Jiayi Hou
Hi all, I am using R package 'ordinal' to fit a cumulative logit ordinal model with random effects. Does someone know 1) The optimization method used in estimating the parameters from the marginal likelihood? 2) In Adaptive Gauss-Hermite Quadrautre, let f() be the function to be intergrated. The

[R] lda, collinear variables and CV

2012-07-26 Thread Christian Hennig
Dear R-help list, apparently lda from the MASS package can be used in situations with collinear variables. It only produces a warning then but at least it defines a classification rule and produces results. However, I can't find on the help page how exactly it does this. I have a suspicion (

[R] Error Bars ggplot2

2012-07-26 Thread Adam Gabbert
Hello, I'm attempting to plot error bars side by side rather than stacked on top of each other with ggplot2. Here is the sample code I am using: #Code #Data spd<-c("s","f","f","s","f","s","s","s","f","f","s","f") r<-c(4.9,3.2,2.1,.2,3.8,6.4,7.5,1.7,3.4,4.1,2.2,5) #Turn spd into a factor spd.f<

Re: [R] Parallel computing on Windows (foreach)

2012-07-26 Thread deep123
Hello all, My problem is similar to Sergey's. I could not try what Mario suggested, since doMPI is not available for windows. I have tried the Cedrick's commands, i.e. cl.tmp = makeCluster(rep("localhost",2), type="SOCK") registerDoSNOW(cl.tmp) but this is instead increasing the time taken. Fo

[R] SAR structure in linear mixed model in R

2012-07-26 Thread Timo Schmid
Hey, I want to estimate a spatial linear mixed model y=X\beta+Zv+e with e\sim N(0,4) and v\sim N(0,G). G is a covariance matrix of a simultaneously autoregressive model (SAR) and is given by G=\sigma_v^2((I-pW)(I-pW^T))^{-1} where p is a spatial correlation parameter and W is a matrix which desc

[R] hdf4 files

2012-07-26 Thread uday
Hi, I have problem to read hdf4 files in R, I would be very grateful if somebody can tell me how to deal with hdf4 files. I can read hdf5 using "hdf5" and "h5r" packages, but these packages does not work for hdf4 files. I was trying to open some MODIS data files those are in hdf4 format. Th

Re: [R] warning message while plotting taylor diagram

2012-07-26 Thread yssp03
Dear Henrik Thank you so much for the clarification. Best regards waheed On Thu, Jul 26, 2012 at 9:32 PM, Henrik Singmann [via R] < ml-node+s789695n463791...@n4.nabble.com> wrote: > Dear Waheed, > > As you correctly inferred, these are just warnings and dont need to bother > you now. The maint

[R] Advice on multi-user server for R

2012-07-26 Thread Carrie Wager
I'm currently developing several tools in R that I'd like to deploy for use by multiple analysts in my research group. Many of the analysts have no background in using R (but have plenty of experience with SAS), so part of my effort will be in training them to use the new tools. Some of the analyse

Re: [R] Variables in a Tabular form. easily saved in a txt file

2012-07-26 Thread John Kane
It is really not clear what you want without some idea of what the variables and data look like. However if the data is in a couple of vectors you could try something like this postal <- c(2134, 54, 12) superb <- c(2,5,54433) cities <- c("City1", "City2", "City3") hds <- c("Postal.Code",

Re: [R] scale_y_logit not present in ggplot2 0.9?

2012-07-26 Thread John Kane
I think it has been moved to the scales package but I've never used it so I don't know the syntax. John Kane Kingston ON Canada > -Original Message- > From: fjpcaball...@gmail.com > Sent: Thu, 26 Jul 2012 07:41:58 -0400 > To: r-help@r-project.org > Subject: [R] scale_y_logit not present

Re: [R] Working with Numbers generated from Regression Output

2012-07-26 Thread Jean V Adams
You can learn a lot from the help files. Check out the help files for the lm() and summary.lm() functions ?lm ?summary.lm You can extract the beta values in a few different ways. These two will give you just the estimates in a vector: coef(result) result$coef These two will give you the estim

Re: [R] How can I correctly access a string element of a dataframe?

2012-07-26 Thread Bert Gunter
Sorry, got cut off... On Thu, Jul 26, 2012 at 8:07 AM, Bert Gunter wrote: > 1. m2q already is a data frame, so the m2qldf statement that follows > is completely unnecessary. > > 2. Please read ?read.table carefully, and especially the bit about the > stringsAsFactors argument. The problem is that

  1   2   >