Re: [R] Accessing List within a List in a for Loop

2012-11-30 Thread David Winsemius
Two things (at least) to consider if you post again. 1) This is a mailing list and Nabble is a cruel deception. It deludes you into thinking you are communicating effectively with your audience. 2) Much better to look at the results of str(object) than to use print(object) On Nov 28, 201

[R] Determine most rows in a matrix

2012-11-30 Thread djkrofch
Greetings I have a set of coefficients that describe a model. The coefficients are generated via a loop for multiple days throughout the year. A sample of the data is below: Day Amax Alpha Rd [1,] 154 6.561734 0.002099071 -0.143377888 [2,] 156 6.100190 0.002326559 -0.058174

Re: [R] Reading .gsheet within R

2012-11-30 Thread Henrik Bengtsson
On Fri, Nov 30, 2012 at 9:43 AM, Luca Meyer wrote: > Hello R-experts, > > I would like to know if there is a solution to read files with extension > .gsheet directly into R - see http://www.fileinfo.com/extension/gsheet for > more info on this file format. AFAIK, those files (*.gsheet, *.gdoc,

Re: [R] protentially serious R error

2012-11-30 Thread Ben Bolker
Cutting and pasting from the R posting guide -- I think this advice has special force when responding to FAQ 7.31 questions (I've seen several within the last few days, and at least two were answered by three different people: When responding to a very simple question, use the following algorithm

Re: [R] (no subject)

2012-11-30 Thread William Dunlap
>> subplot(pie(sec,col=color1,labels=" ",radius=0.05,border=NA,cex=0.8), >> x-3,y=15) Did you mean x=3 instead of x-3? Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: bibek sharma [mailto:mbhpat...@gmail.com] > Sent: Friday, November 30, 2012 4:48 PM

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread Duncan Murdoch
On 12-11-30 7:15 PM, Worik R wrote: How? This is a script I am running under ess on Emacs I've never used ESS. You'll need to ask someone on the ESS list. Duncan Murdoch (Useful information optuion(error=recover) cheers Worik On Sat, Dec 1, 2012 at 12:34 PM, Duncan Murdoch mailto:murdo

Re: [R] what's this character?

2012-11-30 Thread Shi, Tao
Thank you, Jim, Peter, and John, for your help!   Turns out it is a "non-break space".  No idea how it got there (the file is from somebody else).  Thanks to Excel, I guess. Tao > > From: John >To: r-help@r-project.org >Cc: "Shi, Tao" >Sent: Wednesday, Nov

Re: [R] (no subject)

2012-11-30 Thread William Dunlap
Please be more specific. How did it not work? Did my example not work? Was there an error message or the wrong picture? Did you install and load the TeachingDemo's package so subplot() was in scope? Did the pie chart drawn by subplot() look different (aside its placement and size) from the one

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread Worik R
How? This is a script I am running under ess on Emacs (Useful information optuion(error=recover) cheers Worik On Sat, Dec 1, 2012 at 12:34 PM, Duncan Murdoch wrote: > On 12-11-30 4:22 PM, Worik R wrote: > >> Is it possible to get a line number with an error report? >> > > Yes, if the error oc

Re: [R] protentially serious R error

2012-11-30 Thread arun
HI, Use either ?round() or ?signif()  rnorm(signif(20*(1-0.8))) #[1]  1.58079490 -0.03595492 -0.11561782  0.12951975  rnorm(signif(20*0.2)) #[1]  1.70722614  0.40898103 -2.94663960 -0.09284011 A.K. - Original Message - From: liuxf To: r-help@r-project.org Cc: Sent: Friday, November 30

[R] NA return to NLM routine

2012-11-30 Thread Mac Gaulin
Hello, I am trying to understand a small quirk I came across in R. The following code results in an error: k <- c(2, 1, 1, 5, 5) f <- c(1, 1, 1, 3, 2) loglikelihood <- function(theta,k,f){ if( theta<1 && theta>0 ) return(-1*sum(log(choose(k,f))+f*log(theta)+(k-f)*log(1-theta))) re

Re: [R] Reading .gsheet within R

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 2:12 PM, Rui Barradas wrote: > Hello, > > Package sos does a good job at finding things available for R. That should be amended to read ... finding things that are in the help pages. > > library(sos) > findFn('gsheet') > found 0 matches > x has zero rows; nothing to displ

Re: [R] qbinom

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 1:05 PM, jaybell wrote: > sorry, I repost the question again Why? This was already answered. > > a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) > b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) > cor(a,b)= -1 > > pa=qbinom(a, 1, 0.5) > pb=qbinom(b, 1, 0.5) > cor(

Re: [R] Workarounds to Rd file name conflict when extending a S4 method of some other package

2012-11-30 Thread Duncan Murdoch
On 12-11-30 5:38 PM, Janko Thyson wrote: Dear list, // IN SHORT // What are possible workarounds to "consolidate" documentation for S4 methods that are scattered across different packages (generic and some custom methods in one package, additional custom methods in another package) in a *single*

Re: [R] how to separate stuck row elements?

2012-11-30 Thread Jaime Otero Villar
Thanks everyone for the nice recepies to read such data!! Jaime __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minima

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread Duncan Murdoch
On 12-11-30 4:22 PM, Worik R wrote: Is it possible to get a line number with an error report? Yes, if the error occurs in code that has line number information. You get line number info by default if you use source(). If the error is deeply buried in code that doesn't have the info (as it may

Re: [R] quantreg installation and conflicts with R 2.15.2

2012-11-30 Thread Duncan Murdoch
On 12-11-30 3:16 PM, Brian S Cade wrote: I recently lost the partitions on my hard drive (second time in 6 months) so I had to have our IT folks image all my files over to a new drive. I completely reinstalled R (now 2.15.2) and all my libraries to my computer (Dell Latitude running Windows 7).

Re: [R] protentially serious R error

2012-11-30 Thread Ted Harding
[See in-line below] On 30-Nov-2012 21:05:23 liuxf wrote: > Hi guy, > I have recently encountered a problem while I was just trying to generate > some random numbers with the function "rnorm", the problem is shown below: >case 1 >> rnorm(20*0.2) > [1] -1.2765922 -0.5732654 -1.2

Re: [R] protentially serious R error

2012-11-30 Thread Sarah Goslee
Potentially serious? Only to you: this looks like R FAQ 7.31 striking again. Here's a hint: identical(20*(1-0.8), 4) and another rnorm(round(20*(1-0.8))) Sarah On Fri, Nov 30, 2012 at 4:05 PM, liuxf wrote: > Hi guy, > I have recently encountered a problem while I was just trying to generat

[R] Training, Validation and Test Sets and LDA with MASS package

2012-11-30 Thread Roberto
Hi all, please, can someone give me an example of LDA with MASS package with training, validation and test sets? I never used it, so I need and example to avoid to make errors. Thank you very much. Best, Roberto -- View this message in context: http://r.789695.n4.nabble.com/Training-Validati

[R] Fw: quantreg installation and conflicts with R 2.15.2

2012-11-30 Thread Brian S Cade
Just noticed that I get a similar error about object 'kronecker' in "Matrix" package when trying to load "lme4". So this is a more pervasive problem. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email:

Re: [R] subgroup-based quantiles

2012-11-30 Thread R Kozarski
Dear Arun and Rui, thank you for replying, your commands are very helpful. Before you replied, Ive solved the issue with the following approach (for quartiles): myFun <- function(x, GENDER) { x.male <- cut(x, labels=c(1:4), breaks=quantile(split(x,GENDER) $ '1', seq(0,1,.25), na.rm=TRUE),incl

Re: [R] How to add widgets of gWidgets to widgets of rgtk2 ???

2012-11-30 Thread jverzaniNWBKZ
For this it would be best to insert an intermediate group container, as its add method allows you to add the RGtk2 widgets. Something like: library(gWidgets) options(guiToolkit="RGtk2") library(RGtk2) w <- gwindow() lyt <- glayout(cont=w) lyt[1,1] <- (g <- ggroup(cont=lyt)) widget <- gtkButton("

[R] quantreg installation and conflicts with R 2.15.2

2012-11-30 Thread Brian S Cade
I recently lost the partitions on my hard drive (second time in 6 months) so I had to have our IT folks image all my files over to a new drive. I completely reinstalled R (now 2.15.2) and all my libraries to my computer (Dell Latitude running Windows 7). A few of my previous workspaces (creat

Re: [R] qbinom

2012-11-30 Thread jaybell
sorry, I repost the question again a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) cor(a,b)= -1 pa=qbinom(a, 1, 0.5) pb=qbinom(b, 1, 0.5) cor(pa,pb)=-0.8 but when pa=qbinom(a,10,0.5) pb=qbinom(b,10,0.5) cor(pa,pb) becomes -1 again --

[R] protentially serious R error

2012-11-30 Thread liuxf
Hi guy, I have recently encountered a problem while I was just trying to generate some random numbers with the function "rnorm", the problem is shown below: case 1 > rnorm(20*0.2) [1] -1.2765922 -0.5732654 -1.2246126 -0.4734006 case 2### *> rnorm(20*(1-0.8)) [1]

[R] Workarounds to Rd file name conflict when extending a S4 method of some other package

2012-11-30 Thread Janko Thyson
Dear list, // IN SHORT // What are possible workarounds to "consolidate" documentation for S4 methods that are scattered across different packages (generic and some custom methods in one package, additional custom methods in another package) in a *single* Rd help file while using package 'roxy

Re: [R] Reading .gsheet within R

2012-11-30 Thread Marc Schwartz
Hi, I don't know if the information is still current, but there were some discussions a while back pertaining to reading Google Docs documents in R. There is a blog post here from David Smith that might be helpful: http://blog.revolutionanalytics.com/2009/09/how-to-use-a-google-spreadsheet-a

Re: [R] (no subject)

2012-11-30 Thread William Dunlap
Try subplot() from the TeachingDemos package. E.g., > plot(c(1,2,3), c(1,3,2), xlim=c(0,5), ylim=c(0,10)) > subplot(pie(1:5), x=4, y=6) > abline(h=6, v=4) > subplot(pie(1:5), x=1, y=8, size=c(0.5, 0.5)) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message-

Re: [R] Reading .gsheet within R

2012-11-30 Thread Rui Barradas
Hello, Package sos does a good job at finding things available for R. library(sos) findFn('gsheet') found 0 matches x has zero rows; nothing to display. Warning message: In findFn("gsheet") : HIT not found in HTML; processing one page only. So I guess there's nothing yet. Hope this helps,

[R] (no subject)

2012-11-30 Thread bibek sharma
Hello R usuer, The code given below superimposes a pie diagram on another plot containing some points. However, I would like to center the pie diagram on the xy location on the plot, but not on the center. is there any way to re-center pic diagram. Any suggestion or better alternative are highly a

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 1:22 PM, Worik R wrote: > Is it possible to get a line number with an error report? > > I have a long script and an error: > > Error in `[.xts`(x, xsubset) : subscript out of bounds > > > It would be very helpful, and save a lot of time, if there was some > indication in t

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread jim holtman
One thing that I do when I have a long script is to put "progress" report messages. These have some comments so I can chart the progress and also print out the current CPU and memory usage so I can also isolate where potential problems might be. This will help narrow down the section of code wher

[R] Line numbers with errors and warnings?

2012-11-30 Thread Worik R
Is it possible to get a line number with an error report? I have a long script and an error: Error in `[.xts`(x, xsubset) : subscript out of bounds It would be very helpful, and save a lot of time, if there was some indication in the error message which line the error was. I can find it using

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Frank Harrell
It will be crucial to know the details of the test statistic and P-value calculations from SPSS. It's also running anova on both the bootcov and the original fits to see if SPSS is ignoring the bootstrap when computing the covariance matrix. Frank Eric Claus wrote > Hi Frank, > My apologies for n

Re: [R] Choleski decomposition

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 10:34 AM, jaybell wrote: > m <- matrix(nrow=5, ncol=5) > m <- ifelse(row(m)==col(m), 1, 0.2) > c <- chol(m)# Choleski decomposition > u <- matrix(rnorm(2000*5), ncol=5) > uc <- u %*% c > cr <- pnorm(uc) > cr <- qbinom(cr,1,0.5) >

[R] Choleski decomposition

2012-11-30 Thread jaybell
m <- matrix(nrow=5, ncol=5) m <- ifelse(row(m)==col(m), 1, 0.2) c <- chol(m)# Choleski decomposition u <- matrix(rnorm(2000*5), ncol=5) uc <- u %*% c cr <- pnorm(uc) cr <- qbinom(cr,1,0.5) cor(cr) I expected that the cor(cr) to be

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
hello guys! thank u for the help, but u didnt understood what i need. 1st, it is a[i] cuz i want to sum 1 + x[i], for all i's not j. but i've solved it! :) like i said, my code is more complex, but, if you need to integrate several functions in a loop, thats what you should do: w2 = seq(-1,-1/3,l

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Eric Claus
Hi Frank, My apologies for not posting the entire script - I have repasted it below. library(rms) library(foreign) temp=read.spss('coxdata.sav', to.data.frame=T) formula=Surv(months, recidivate) ~ fac1 + fac2 + fac3 + fac4 + fac5 + fac6 + fac7 + fac8 fit=cph(formula, data=temp, x=T, y=T) val.ou

Re: [R] subgroup-based quantiles

2012-11-30 Thread arun
Hi, You could also try ?ave() dat$Age_group<-ave(dat$Age,dat$GENDER,FUN=function(x){cut(x,labels=1:10,breaks=quantile(x,seq(0,1,.1)),include.lowest=TRUE)})  dat #  GENDER Age Age_group #1  2  45 1 #2  1  58    10 #3  1  54 1 #4  2  71    10 #5  2  64 

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread John Kane
I think this does it. require(reshape2) df1 <- melt(DF, id="month") ggplot(df1, aes(x = month, y = value, fill = variable)) + theme_bw() + geom_bar(stat = "identity") + coord_polar() John Kane Kingston ON Canada > -Original Message- > From: henry.helsi...@gmai

Re: [R] xts indexed with Date class

2012-11-30 Thread arun
Hi, You could try this: Sys.setenv(TZ="GMT") a<-as.Date(15423:15426) x<-xts(seq_along(a),a)  print(index(x)) #[1] "2012-03-24" "2012-03-25" "2012-03-26" "2012-03-27"  print(as.numeric(index(x))) #[1] 15423 15424 15425 15426 A.K. - Original Message - From: Giles To: r-help@r-project.org

Re: [R] subgroup-based quantiles

2012-11-30 Thread Rui Barradas
Hello, Arun's code is much better. Rui Barradas Em 30-11-2012 18:50, arun escreveu: Hi, You could also try ?ave() dat$Age_group<-ave(dat$Age,dat$GENDER,FUN=function(x){cut(x,labels=1:10,breaks=quantile(x,seq(0,1,.1)),include.lowest=TRUE)}) dat # GENDER Age Age_group #1 2 45 1 #

Re: [R] qbinom

2012-11-30 Thread Peter Langfelder
On Fri, Nov 30, 2012 at 9:47 AM, jaybell wrote: > a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) > b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) > cor(a,b)= -1 > > a'=qbinom(a, 1, 0.5) > b'=qbinom(b, 1, 0.5) > why cor(a',b') becomes -0.5 ? On my computer the correlation is -0.8. It is not 1

Re: [R] segfault debugging

2012-11-30 Thread Duncan Murdoch
On 30/11/2012 12:02 PM, Donatella Quagli wrote: Hello everybody, I have written a script with two inline cfunctions. The script crashes from time to time with: *** caught segfault *** address 0x10, cause 'memory not mapped' The crashs happen within R code after the cfunctions were execu

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 19:34, Berend Hasselman wrote: > > On 30-11-2012, at 16:08, faeriewhisper wrote: > >> Hi guys! >> I have to compute something and i don't know what i'm doing wrong. my code >> is a bit complex, but imagine that is something like this: >> >> a = c(1,2,3,4) >> ia = length(a)

Re: [R] can't integrate in loop

2012-11-30 Thread Jessica Streicher
Thats not a very precise question. I'll try anyway.. - if you use c, you need to separate the values by commas - i think you mean seq(1,100,0.1), otherwise x only has one value - function sen is not defined - If you call int(1), upper will be 1, not x[i] - why are you making a function and calling

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 16:08, faeriewhisper wrote: > Hi guys! > I have to compute something and i don't know what i'm doing wrong. my code > is a bit complex, but imagine that is something like this: > > a = c(1,2,3,4) > ia = length(a) > > x = seq(1,100,length=0.1) > ib = length(x) > > int1 =

Re: [R] loop function and integrate?

2012-11-30 Thread Rui Barradas
Hello, Your code doesn't run without initializing 'ss' to something. And I've made some changes, but I don't understand what you are trying to do. See comments inline. a = c(1,2,3,4) ia = length(a) x = seq(1, 100, by=0.1) # It was 'length = 0.1' (!) ib = length(x) ss <- numeric(ia) # Ne

Re: [R] repeating matrices in a list

2012-11-30 Thread arun
HI, You could also use: res1<-sapply(1:3,function(x) g,simplify=FALSE) #or res2<-replicate(3,g,simplify=FALSE)  identical(res1,res2) #[1] TRUE A.K. - Original Message - From: Anser Chen To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 12:50 PM Subject: [R] repeating matric

Re: [R] subgroup-based quantiles

2012-11-30 Thread Rui Barradas
Hello, If you want Age quantiles by gender, you have to split the data by gender, apply the same code then recombine the result. fun <- function(x){ Age_group <- cut(x[, "Age"], labels=c(1:10), breaks=quantile(x[, "Age"], seq(0,1,.1)), include.lowest = TRUE) cbind(x, A

[R] qbinom

2012-11-30 Thread jaybell
a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) cor(a,b)= -1 a'=qbinom(a, 1, 0.5) b'=qbinom(b, 1, 0.5) why cor(a',b') becomes -0.5 ? -- View this message in context: http://r.789695.n4.nabble.com/qbinom-tp4651460.html Sent from the R help maili

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Now i've managed to do this: funcs <- list() funcs[] # loop through to define functions for(i in 1:ib-1){ # Make function name funcName <- paste( 'func', i, sep = '' ) # make function func = paste('function(x){sin(x + a[', i,'])))}',sep = '') funcs[[funcName]] = eval(parse(

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Filoche
Thank everyone for the answers. I looked into ggmap but could not find how to plot a map that would like this: http://www.google.ca/trends/explore#q=flu I looked into get_map but it can only be of this type: maptype = c("terrain", "satellite", "roadmap", "hybrid", "toner", "watercolor") Any su

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Filoche
Thank you Michael. I'll try that. Maybe I can find a solution to convert the HTML file into a let's say SVG file. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/googleVis-plot-and-knitr-sweave-tp4651341p4651463.html Sent from the R help mailing list archive at Na

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Dear Dennis, Many thanks! Yes, ggplot2 could be used to illustrate a simple rose chart (category + one type variable) If I have a data frame like this: DF <- data.frame(month = factor(month.abb, levels = month.abb), freq1 = rpois(12, 80),freq2=rpois(12, 80),freq3=rpois(12, 80))

[R] segfault debugging

2012-11-30 Thread Donatella Quagli
Hello everybody, I have written a script with two inline cfunctions. The script crashes from time to time with:    *** caught segfault ***   address 0x10, cause 'memory not mapped' The crashs happen within R code after the cfunctions were executed. Nevertheless I think that the pointers in my c

[R] flip heatmap (pheatmap)

2012-11-30 Thread DebKV
When plotting a heatmap with heatmap.2 the shortest euclidean distance cluster is plotted in the top left corner of the heatmap when plotting the same data with pheatmap the very same cluster is in the bottom right corner

Re: [R] help on "stacking" matrices up

2012-11-30 Thread Andras Farkas
Petr,   thanks for the solution, putting the zeros in there makes it work just how I want it. Also, thanks for picking up on the error in my code below... I did not notice that it only changes the 1st value, and yes, your assumption is right: there is a chance where more values should be changed

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Hi, thanks a lot. The package from your link seems could plot only one type of variable. If I have following three variables:If I have following three variables: a b c 1 3 7 8 2 5 4 1 3 5 1 7 4 3 1 5 5 1 7 3 6 7 1 1 7 1 1 1 8 3 3 2 Do you have any idea how to plot it by using variable color

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread arun
Hi, YOu could also use: set.seed(5) dat1<-data.frame(col1=sample(c(1:4,NA),10,replace=TRUE),col2=runif(10,0,1))  dat1[!complete.cases(dat1),] #  col1  col2 #3   NA 0.3184040 #8   NA 0.8878698 #9   NA 0.5549226 A.K. - Original Message - From: ramoss To: r-help@r-project.org Cc: Sent

[R] Help regarding calendar heatmap

2012-11-30 Thread sharan kumar
Hi, I would like to create calendarheat map with Hours of day on Y axis and Date on X axis. Is there any function to do so? Can someone help me with reference. Thanks Sharan [[alternative HTML version deleted]] __ R-help@r-project.org mailin

[R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) int1 = numeric(ib) b = numeric(ib) for(j in 1:ia) { H = function(x) {

[R] can't integrate in loop

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1 2 3 4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) for(j in 1:ia) { H = function(x) {sen(x) + a[j]} for(i in 1:ib) {

Re: [R] help on "stacking" matrices up

2012-11-30 Thread Andras Farkas
Petr,   sorry, here is a better example that should work:  Dose<-200 Tinf <-0.5 INTERVAL <-3 TIME8 <-matrix(c((0*INTERVAL):(1*INTERVAL))) TIME7 <-matrix(c((0*INTERVAL):(2*INTERVAL))) TIME6 <-matrix(c((0*INTERVAL):(3*INTERVAL))) CDURINF6 <-((Dose/Tinf)*(1/(0.088*76.9)))*(1-exp(-0.088*TIME6)) CAFTINF

[R] what is the cost in cv.glm?

2012-11-30 Thread mael
Hi, I have a question regarding the cv.glm function in the package boot. What is exactly the cost? Is it the threshold value for an estimated value to be classified as either 0 or 1? I have troubles understanding the explanation in R. Lets say I want all estimations >0.65 to be classified as 1s an

Re: [R] repeating matrices in a list

2012-11-30 Thread arun
Hi, Try this: lapply(1:3,function(x) g) A.K. - Original Message - From: Anser Chen To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 12:50 PM Subject: [R] repeating matrices in a list Suppose I have the following  square, non-negative matrices > g=matrix(c(0,2,4,0.25,0,

Re: [R] repeating matrices in a list

2012-11-30 Thread Sarah Goslee
You are so close: rep(list(g), 3) [[1]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60 [[2]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60 [[3]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60 Sa

[R] repeating matrices in a list

2012-11-30 Thread Anser Chen
Suppose I have the following square, non-negative matrices > g=matrix(c(0,2,4,0.25,0,0,0,0.6,0),3,3,byrow=T); I want to create a list where this matrix is repeated multiple times. if I do this brute force (manually), using > env <- list(g,g,g) works fine. Yields [[1]] [,1] [,2] [,3] [1

[R] Reading .gsheet within R

2012-11-30 Thread Luca Meyer
Hello R-experts, I would like to know if there is a solution to read files with extension .gsheet directly into R - see http://www.fileinfo.com/extension/gsheet for more info on this file format. Thank you, Luca Mr. Luca Meyer www.lucameyer.com R 2.15.1 Mac OS X 10.8.2 [[alterna

Re: [R] missed values

2012-11-30 Thread arun
Hi, May be this helps: dat1<-read.table(text=" ---data--- ",header=TRUE,stringsAsFactors=FALSE) library(zoo)  dat1$date<-as.yearmon(dat1$date,format="%Y-%m") lm1<-lm(value~date,dat1) dat2<-data.frame(date=dat1[,1])  dat1$fit<-predict(lm1,newdata=dat2)  dat1<-within(dat1,{newvalue<-

Re: [R] help on "stacking" matrices up

2012-11-30 Thread PIKAL Petr
Hi ifelse shall work just fine. x<-1:10 a<-rnorm(10) b<-rnorm(10)+100 tinf<-5 ifelse(xmailto:motyoc...@yahoo.com] Sent: Friday, November 30, 2012 5:37 PM To: PIKAL Petr; r-help@r-project.org Subject: Re: [R] help on "stacking" matrices up Petr, thanks for the solution, putting the zeros in ther

Re: [R] how to separate stuck row elements?

2012-11-30 Thread arun
Hi, You could also try this: Lines<-"-100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78" Lines1<-readLines(textConnection(Lines))  res1<-unlist(strsplit(gsub("[-]"," -",Lines2)," "))  matrix(as.numeric(res1[res1!=""]),nrow=length(Lines1),byrow=TRUE)     [,1]  [,2] 

Re: [R] For loop

2012-11-30 Thread Jessica Streicher
You could use the duplicated function maybe: mtest id time value [1,] 13 1 [2,] 13 2 [3,] 12 3 [4,] 11 4 [5,] 21 5 [6,] 23 6 [7,] 23 7 [8,] 23 8 duplicated(mtest[,1:2]) [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRU

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Michael Friendly
On 11/29/2012 2:53 PM, Filoche wrote: Dear R users. I'm currently making a report with knitr (RStudio) where I would like to plot a googleVis map. However, the map generated is an HTML file which I don't know how to integrate it in my report. So my question is how to include a map generated wit

[R] Standard errors for predictions of zero-inflated models

2012-11-30 Thread Lee, Laura
Dear all, I am using the zeroinfl() function from the pscl package to develop a zero-inflated Poisson GLM. I would like to calculate the standard errors of predicted values. I've tried code posted in a previous discussion on this topic (https://stat.ethz.ch/pipermail/r-help/2008-December/182806

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread ramoss
I found the answer; Its mymissing <- subset(mydata,is.na(myvar)) -- View this message in context: http://r.789695.n4.nabble.com/subset-data-frame-by-variable-with-missing-value-tp4651439p4651440.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] For loop

2012-11-30 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of bibek sharma > Sent: Friday, November 30, 2012 5:00 PM > To: R-help@r-project.org > Subject: [R] For loop > > Hello user, > I have large data containing subject id, time and

Re: [R] For loop

2012-11-30 Thread arun
Hi, Try this: dat1<-read.table(text=" id    time res 1    2    0.64 1    3    0.78 1    3    6.5 1    3    4.5 1    4    4 1    5    3.4 2    10    5.7 2    11    5.8 2    11    9.3 2    11    3.4 2    12    3.4 2    13    6.7 3    3    5.6 3    3    3.4 3    4    2.3 3    5    5.6 3    12    9

Re: [R] how to separate stuck row elements?

2012-11-30 Thread arun
Hi, Try this: Lines<-"-100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78 " res<-unlist(strsplit(gsub("\\-"," -",Lines),"\n")) res1<-do.call(rbind,lapply(lapply(split(res,seq_along(res)),function(x) unlist(strsplit(x," "))),function(x) as.numeric(x[x!=""])))  res1 #

Re: [R] For loop

2012-11-30 Thread Jessica Streicher
Hello Bikek, please use dput() next time to provide the data, its easier to use that. also: looking at the data provided, how would you want to decide which value of the non-unique times to retain? Just take the first one? They aren't all the same. On 30.11.2012, at 16:59, bibek sharma wrote:

Re: [R] Generating sequences of dates

2012-11-30 Thread Jagat.K.Sheth
?seq.Date > seq(as.Date("2000-01-01"), len=5, by="1 mon") [1] "2000-01-01" "2000-02-01" "2000-03-01" "2000-04-01" "2000-05-01" > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Vasilchenko Aleksander > Sent: Friday, November 30

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Milan Bouchet-Valat
Le vendredi 30 novembre 2012 à 07:27 -0800, ramoss a écrit : > Hello, > > I have a variable in a data frame that contains NA values. I just want to > subset so that I get the obs where that variable is missing. > In SAS I would do: > > data missing; > set test; > if myvalue=' '; > run; > > H

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread PIKAL Petr
Hi see ?is.na x <-sample(c(1:3, NA), 20, replace=T) x [1] 2 NA 2 3 3 3 3 2 3 NA 3 2 1 2 NA 3 3 3 2 2 y<-rnorm(20) y[is.na(x)] [1] 0.1600417 1.3264063 -0.6175832 Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > proj

Re: [R] help on "stacking" matrices up

2012-11-30 Thread PIKAL Petr
Hi Andras Now it works but I suppose you shall simplify or explain it a bit more. CONC7<-c(rep(0,3),CONC7) CONC8<-c(rep(0,6),CONC8) CONC6+CONC7+CONC8 [,1] [1,] 0.00 [2,] 2.330056 [3,] 2.133774 [4,] 1.954027 [5,] 4.119477 [6,] 3.772456 [7,] 3.454667 [8,] 5.493705 [9,] 5.030920 [10,]

[R] For loop

2012-11-30 Thread bibek sharma
Hello user, I have large data containing subject id, time and response where subjects are measured repeatedly. However some time are duplicates. I only want data with unique time points per id. I mean if time is repeated, then take only one. Here is a sample data. id timeres 1 2

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Marc Schwartz
On Nov 30, 2012, at 9:27 AM, ramoss wrote: > Hello, > > I have a variable in a data frame that contains NA values. I just want to > subset so that I get the obs where that variable is missing. > In SAS I would do: > > data missing; > set test; > if myvalue=' '; > run; > > How can I perform t

[R] subset data frame by variable with missing value

2012-11-30 Thread ramoss
Hello, I have a variable in a data frame that contains NA values. I just want to subset so that I get the obs where that variable is missing. In SAS I would do: data missing; set test; if myvalue=' '; run; How can I perform this simple task in R? Thanks in advance for your help. -- View

Re: [R] Changing the base of geom_bar in ggplot

2012-11-30 Thread Jeff Newmiller
I think your request is internally inconsistent: you want units of percent but you want to show the average(I assume you intend "mean")? You can subtract the mean from each value and then divide by the mean, then subtract 1, then multiply by 100. You inherently lose visibility to what the mean

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Frank Harrell
Thanks Eric. It would be good to show your entire script next time as stated in the posting guidance. Regarding matching with SPSS please describe the bootstrapping algorithm used there. In rms I do the unconditional bootstrap, i.e., I sample with replacement from the rows of the raw data. And

Re: [R] how to separate stuck row elements?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 13:55, Jaime Otero Villar wrote: > Hi, > > I was wondering if it's possible to separate elements in multiple rows that > actually should appear in different columns. I have a file where in certain > lines there are elements not separated, and they certainly should appear in

Re: [R] help on "stacking" matrices up

2012-11-30 Thread PIKAL Petr
Hi try to make your example easier and reproducible. I get > CONCF <-matrix(c(CONC1+CONC2+CONC3+CONC4+CONC5+CONC6+CONC7+CONC8)) Error in CONC1 + CONC2 : non-conformable arrays so I cannot understand what shall the final plot look like. Regards Petr > -Original Message- > From: r-hel

Re: [R] Deleting certain observations (and their imprint?)

2012-11-30 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Stodola, Kirk > Sent: Thursday, November 29, 2012 5:32 PM > To: r-help@r-project.org > Subject: [R] Deleting certain observations (and their imprint?) > > I'm manipulating a

Re: [R] how to separate stuck row elements?

2012-11-30 Thread Rui Barradas
Hello, Try the following. x <- scan(text=" -100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78 ", what = "") fun <- function(x){ f <- function(.x){ if(grepl("-[[:digit:]]+", .x)){ g <- gregexpr("-[[:digit:]]+", .x) .y <- as

Re: [R] Generating sequences of dates

2012-11-30 Thread Rui Barradas
Hello, Try the following. Y <- 2000:2001 M <- 1:12 D <- 1 x <- expand.grid(Y, M, D) Dates <- sort(as.Date(apply(x, 1, paste, collapse = "-"))) Hope this helps, Rui Barradas Em 30-11-2012 12:26, Vasilchenko Aleksander escreveu: Hello, I have the starting date in UNIX_TIME LONG number (numb

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Rui Barradas
Hello, Take a look at the graph in http://gallery.r-enthusiasts.com/graph/Rose_diagram,97 Hope this helps, Rui Barradas Em 30-11-2012 12:24, Henry Smith escreveu: > Hello, Everyone. > > Does anyone know how to create a Nightingale’s Rose chart by using R? > Hopefully, the graph could be display

[R] how to separate stuck row elements?

2012-11-30 Thread Jaime Otero Villar
Hi, I was wondering if it's possible to separate elements in multiple rows that actually should appear in different columns. I have a file where in certain lines there are elements not separated, and they certainly should appear in different columns (an example of the file is attached). T

Re: [R] missed values

2012-11-30 Thread arun
HI, Use, ?na.omit() na.omit(data) A.K. - Original Message - From: Vasilchenko Aleksander To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 7:07 AM Subject: [R] missed values Hello I have dataframe 101 2008-07 0.2898966 102 2008-08 0.3101667 103 2008-09 0.3730476 104 2008-1

[R] Generating sequences of dates

2012-11-30 Thread Vasilchenko Aleksander
Hello, I have the starting date in UNIX_TIME LONG number (number of milliseconds since 1970 jan 1st). Is there a way to generete the sequence of dates with monthly interval in POSIXct format like 2000-01-01 2000-02-01 2000-03-01 etc Thanks [[alternative HTML version deleted]] ___

[R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Hello, Everyone. Does anyone know how to create a Nightingale’s Rose chart by using R? Hopefully, the graph could be displayed like this: http://mbostock.github.com/protovis/ex/crimea-rose.html Thanks a lot. Kind regards, Henry [[alternative HTML version deleted]] __

  1   2   >