Re: [R] two question about plot

2011-09-01 Thread Petr PIKAL
Hi > > Re: [R] two question about plot > > The help for boxplot offers suggestions for both those things. You may be > particularly interested in: > >names: group labels which will be printed under each boxplot. Can > be a character vector or an expression (see plotmath). > >

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-01 Thread Ben Bolker
Andra Isan yahoo.com> writes: > > Hi All,  > In order to compare two different logistic regressions, > I think I need to compare them based on their BIC > values, but I am not sure if the smaller BIC would mean a better > model or the reverse is true? > Thanks a lot,Andra Smaller (i.e. lowe

[R] Urgente

2011-09-01 Thread Frank Mill
- This mail is in HTML. Some elements may be ommited in plain text. - Meu nome é Frank P, eu trabalhei com o Banco SNS em Holland.I habe Você contactado por conta de parente falecido com os nossos Banj e que foi deixado sem pretensões. Por favor, me envia um email com um número de telefone e ta

[R] Background fill and border for a legend in dotplot

2011-09-01 Thread markm0705
Dear R help group I've been working on this plot for a while now and now getting around to the minor adjusments. I would like to be able to put a border and background fill around the legend in this plot. I understand the legend 'bty' should do this have this capablity but not sure how the syn

[R] Advice on large data structures

2011-09-01 Thread Worik R
Friends I am starting on a (section of the) project where I need to build a matrix with on the order of 5 million rows and 200 columns I am wondering if I can stay in R. I need to do rollapply type operations on the columns, including some that will be functions of (windows of) two columns. I h

Re: [R] how to return back to go on my cycle while read my files

2011-09-01 Thread Jim Holtman
?try Sent from my iPad On Sep 1, 2011, at 22:46, Jie TANG wrote: > hi ,when i read a lots of files > > for (i in 1:totnum) > { > cop_x_data<-read.table(flnm[i],skip=2) > if(i==1) {cop_data=cop_x_data} > else {cop_data=rbind(cop_data,cop_x_data)} > } > > some of the files are missing . so this

Re: [R] how to return back to go on my cycle while read my files

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 10:46 PM, Jie TANG wrote: hi ,when i read a lots of files for (i in 1:totnum) { cop_x_data<-read.table(flnm[i],skip=2) if(i==1) {cop_data=cop_x_data} else {cop_data=rbind(cop_data,cop_x_data)} } some of the files are missing . so this loop can not go on .I wonder how can

[R] how to return back to go on my cycle while read my files

2011-09-01 Thread Jie TANG
hi ,when i read a lots of files for (i in 1:totnum) { cop_x_data<-read.table(flnm[i],skip=2) if(i==1) {cop_data=cop_x_data} else {cop_data=rbind(cop_data,cop_x_data)} } some of the files are missing . so this loop can not go on .I wonder how can I go on the loop cycle while reading the files jus

Re: [R] Alternatives to integrate?

2011-09-01 Thread R. Michael Weylandt
Actually, it's very easy to integrate a function of two variables in a single variable for a given value of the other variable. Using your example: MySum <- function(x,y) { ans = x + y return(ans) } Note a things about how I wrote this. One, I broke the function out and used curly brac

Re: [R] Alternatives to integrate?

2011-09-01 Thread . .
Thanks for your reply Michael, it seems I have a lot of things to learn yet but for sure, your response is being very helpful in this proccess. I will try to explore every point you said: A doubt I have is, if I define "func <- function(x,y) x + y" how can I integrate it only in "x"? My solution f

Re: [R] Selections in lists

2011-09-01 Thread mdvaan
Thanks David and Jorge for your comments! -- View this message in context: http://r.789695.n4.nabble.com/Selections-in-lists-tp3768562p3784816.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

[R] Selecting and multiplying

2011-09-01 Thread mdvaan
Hi, I have created two objects: object c contains yearly "distances" between cases and object g contains yearly interactions between cases. For each case and every year I would like to calculate the following value: Vit = sum(Dabt * Iait * Ibit) Where Vit is the value of case i in year t, Dabt i

Re: [R] MS-VAR introduction

2011-09-01 Thread housy
Anybody knows where I can find the MSVAR for ox package mentioned above? The websited is not working anymore :( -- View this message in context: http://r.789695.n4.nabble.com/MS-VAR-Introduction-tp896008p3784774.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to retrieve bias-corrected probability from calibrate.rms

2011-09-01 Thread Frank Harrell
I'm not clear on what you would use that for, but you can use approx(original prob from calibrate, calibrated prob from calibrate, xout=vector of original predicted values)$y to get this. Frank yz wrote: > > Thanks Frank > > I got the predicted probability. > > But can I get the bootstrap corre

[R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-01 Thread Andra Isan
Hi All,  In order to compare two different logistic regressions, I think I need to compare them based on their BIC values, but I am not sure if the smaller BIC would mean a better model or the reverse is true? Thanks a lot,Andra [[alternative HTML version deleted]] __

Re: [R] ggplot2 to create a "square" plot

2011-09-01 Thread baptiste auguie
Hi, Are you after this? last_plot() + opts(aspect.ratio=1) Also, see https://github.com/hadley/ggplot2/wiki/Themes for some settings re: plot margins. HTH, baptiste On 1 September 2011 05:18, Alaios wrote: > Dear all, > I am using ggplot with geom_tile to print as an image a matrix  I have.

[R] Kernel Density Estimation in R

2011-09-01 Thread drj571
Hello, I am wanting to run a simulation study in R comparing several different bandwidth selection methods for data simulated from several different distribution types (normal, lognormal, bimodal, etc.) and wanted to know how to calculate the mean integrated square errors for the optimal smoothin

Re: [R] get arguments passed to function inside a function

2011-09-01 Thread Greg Snow
The sys.call or match.call functions may be what you are looking for: > tmpfun <- function(x,y,z,...) { + as.list( sys.call() ) + } > > tmpfun( x=5, w=3, 1:10 ) [[1]] tmpfun $x [1] 5 $w [1] 3 [[4]] 1:10 > tmpfun2 <- function(x,y,z,...) { + as.list( match.call() ) + } > tmpfun2( x=5, w=3, 1:10

Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread ROLL Josh F
Dang Jim this looks to do the trick though I never heard of a data.table, interesting, I will explore more. Thanks you very much. -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, September 01, 2011 11:20 AM To: ROLL Josh F Cc: r-help@r-project.org Subj

Re: [R] Including only a subset of the levels of a factor XXXX

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 2:59 PM, Dan Abner wrote: Hello everyone, I have the following factor: levels(pp_income) [1] "" "1" "2" "3" "4" "5" "6" "7" [9] "8" "9" "Renter" I want to subset so that only values 1:9 are included. I have the following:

Re: [R] Including only a subset of the levels of a factor XXXX

2011-09-01 Thread R. Michael Weylandt
Dropping all occurences of a factor does not drop that level. This actually turns out to be much more useful than it first might appear, but if you really need to get around it, it can be done. Look at this toy example: R> x = factor(c("A","B","C","A","B","C","C")) R> x [1] A B C A B C C Levels:

Re: [R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
Thanks, Don! Appreciated your detailed explanation. On Thu, Sep 1, 2011 at 11:28 AM, MacQueen, Don wrote: > Even though it's not needed, here's a small followup. > > I usually use this > split(x, paste(x$let,x$g)) > > But since >split(x, list(x$let,x$g)) > works, so does > split(x, x

[R] Including only a subset of the levels of a factor XXXX

2011-09-01 Thread Dan Abner
Hello everyone, I have the following factor: levels(pp_income) [1] "" "1" "2" "3" "4" "5" "6" "7" [9] "8" "9" "Renter" I want to subset so that only values 1:9 are included. I have the following: > income<-pp_income[pp_income %in% c(1:9)] > > leve

Re: [R] how to split a data frame by two variables

2011-09-01 Thread MacQueen, Don
Even though it's not needed, here's a small followup. I usually use this split(x, paste(x$let,x$g)) But since split(x, list(x$let,x$g)) works, so does split(x, x[,c('let','g')]) > all.equal( split(x, x[,c('let','g')]) , split(x,list(x$let,x$g))) [1] TRUE As to which is the best, hard t

Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread jim holtman
Is this close to what you are asking for: > require(data.table) > Dt.. <- data.table(Df..) > R <- Dt..[, + list( + sum = sum(Volume) + , weight = sum(Volume * Mph) / sum(Volume) + ) + , by = list(Min5Break, Day, Hour, Dir) + ] > R Min5Break Day Hour Dir

Re: [R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
Thanks for the great helps from David, Jim and Liviu. It solved my problem. Appreciated! On Thu, Sep 1, 2011 at 11:01 AM, David Winsemius wrote: > > On Sep 1, 2011, at 1:53 PM, Changbin Du wrote: > > HI, Dear R community, >> >> I want to split a data frame by using two variables: let and g >> >

Re: [R] two question about plot

2011-09-01 Thread Sarah Goslee
The help for boxplot offers suggestions for both those things. You may be particularly interested in: names: group labels which will be printed under each boxplot. Can be a character vector or an expression (see plotmath). add: logical, if true _add_ boxplot to current plot. Sa

Re: [R] how to split a data frame by two variables

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 1:53 PM, Changbin Du wrote: HI, Dear R community, I want to split a data frame by using two variables: let and g x = data.frame(num = c(10,11,12,43,23,14,52,52,12,23,21,23,32,31,24,45,56,56,76,45), let = letters[1:5], g = 1:2) x num let g 1 10 a 1 2 11 b 2 3

Re: [R] how to split a data frame by two variables

2011-09-01 Thread Liviu Andronic
On Thu, Sep 1, 2011 at 7:53 PM, Changbin Du wrote: > HI, Dear R community, > > I want to split a data frame by using two variables: let and g > It's not clear what you want to do, but investigate the following: > require(plyr) Loading required package: plyr > ddply(x, .(let, g), function(y) mean(

Re: [R] how to split a data frame by two variables

2011-09-01 Thread jim holtman
try this: > split(x, list(x$let, x$g)) $a.1 num let g 1 10 a 1 11 21 a 1 $b.1 num let g 7 52 b 1 17 56 b 1 $c.1 num let g 3 12 c 1 13 32 c 1 $d.1 num let g 9 12 d 1 19 76 d 1 $e.1 num let g 5 23 e 1 15 24 e 1 On Thu, Sep 1, 2011 at 1:53 PM,

Re: [R] Treat an Unquoted Character String as a Data Frame

2011-09-01 Thread Liviu Andronic
On Thu, Sep 1, 2011 at 5:48 PM, Jean V Adams wrote: > Try this > > data <- eval(parse(text=paste(study, level, ".", population, sep=""))) > ..or this: data <- get(paste(study, level, ".", population, sep="")) Liviu > Jean > > - > > dbateman wrote on 08/31/2011 17:44:44: > > I have several d

[R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
HI, Dear R community, I want to split a data frame by using two variables: let and g > x = data.frame(num = c(10,11,12,43,23,14,52,52,12,23,21,23,32,31,24,45,56,56,76,45), let = letters[1:5], g = 1:2) > x num let g 1 10 a 1 2 11 b 2 3 12 c 1 4 43 d 2 5 23 e 1 6 14 a 2 7

Re: [R] Alternatives to integrate?

2011-09-01 Thread R. Michael Weylandt
Leaving aside some other issues that this whole email chain has opened up, I'd guess that your most immediate problem is that you are trying to numerically integrate the PMF of a discrete distribution but you are treating it as a continuous distribution. If you took the time to properly debug (as

Re: [R] iSeries and R

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 10:59 AM, Li, Yan wrote: Hi All, Does anyone has experiences installing R in iSeries? I was unable to find any postings to r-help that mentioned that hardware line in particular. But Linux and (IBM's) AIX are capable of supporting R and both those OSes run on iSeries b

Re: [R] Oh apply functions, how you confuse me

2011-09-01 Thread Patrick Burns
I would suggest using a 'for' loop rather than an apply function. The advantage is that you will probably understand the loop that you write, and it will run in roughly the same amount of time as a complicated call to an apply function that you don't understand. On 01/09/2011 18:11, LCOG1 wrote:

Re: [R] readBin fails to read large files

2011-09-01 Thread Matt Shotwell
On Thu, 2011-09-01 at 17:36 +0100, Prof Brian Ripley wrote: > readBin is intended to read a few items at a time, not 10^9. You are > probably getting 32-bit integer overflow inside your OS, since the > number of bytes you are trying to read in one go exceeds 2GB. > > Don't do that: read say a m

[R] two question about plot

2011-09-01 Thread Jie TANG
1) how to modify the the tickment of x-axis or y-axis. boxplot(data[,1:5]) the tickment in x-axis in V1 V2 V3 V4 V5 ,I want to be some name for example name<-c("1day","2day","3day","4day","5day") 2) how to overlap two plot into one figure? plot(data[1:5]) boxplot(newdata[,1:5]) ? -- TAN

[R] Oh apply functions, how you confuse me

2011-09-01 Thread LCOG1
Hi guys, I have a crap load of data to parse and have enjoyed creating a script that takes this data and creates a number of useful graphics for our area. I am unable to figure out one summary though and its all cause I dont fully understand the apply family of functions. Consider the following:

Re: [R] Automatic Recoding

2011-09-01 Thread William Dunlap
You could also use match() directly instead of going through factors. Any of the following would map your inputs to small integers > match(x, x)-1 [1] 0 1 0 3 0 5 0 7 8 9 > match(x, unique(x))-1 [1] 0 1 0 2 0 3 0 4 5 6 > match(x, sort(unique(x)))-1 [1] 3 4 3 6 3 2 3 0 5 1 Your num

Re: [R] readBin fails to read large files

2011-09-01 Thread Prof Brian Ripley
On Thu, 1 Sep 2011, Prof Brian Ripley wrote: readBin is intended to read a few items at a time, not 10^9. You are probably getting 32-bit integer overflow inside your OS, since the number of bytes you are trying to read in one go exceeds 2GB. Don't do that: read say a million at time. And B

Re: [R] Alternatives to integrate?

2011-09-01 Thread . .
So, please excuse me Michael, you are completely sure. I will try describe I am trying to do, please let me know if I can provide more info. The idea is provide to "func" two probability density functions(PDFs) and obtain another PDF that is a compound of them. In a final analysis this characteriz

Re: [R] readBin fails to read large files

2011-09-01 Thread Prof Brian Ripley
readBin is intended to read a few items at a time, not 10^9. You are probably getting 32-bit integer overflow inside your OS, since the number of bytes you are trying to read in one go exceeds 2GB. Don't do that: read say a million at time. And BTW, if these really are unsigned ints you will

Re: [R] how to plot a series of data in a dataframe?

2011-09-01 Thread Weidong Gu
This can be done using bwplot in lattice library. Also, it is better to organize your data in 'long' format. Look at functions reshape or melt in reshape library. Weidong Gu On Thu, Sep 1, 2011 at 12:10 PM, Jie TANG wrote: > hi > > i have a dataframe with the name "obsdata" >       V1 V2 V3 V4  

Re: [R] how to plot a series of data in a dataframe?

2011-09-01 Thread jim holtman
try this: > x <- read.table('clipboard', header = TRUE) > x V1 V2 V3 V4 V5V6V7V8V9 V10 V11 V12 V13 1 1001 3 24 12 24.7 44.4 70.1 49.3 33.7 3.0 6.8 2.7 NA 2 1001 3 25 0 70.1 49.3 33.7 138.2 152.5 NA 4.2 6.9 17.5 3 1001 3 25 12 33.7 187.7 286.5 386.7N

Re: [R] Automatic Recoding

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 10:54 AM, Thomas Chesney wrote: I have a text file full of numbers (it's a edgelist for a graph) and I would like to recode the numbers as they are way too big to work with. So for instance the following: 6765290986671000198767829 676529098667100867672856227 6765

[R] how to plot a series of data in a dataframe?

2011-09-01 Thread Jie TANG
hi i have a dataframe with the name "obsdata" V1 V2 V3 V4V5V6V7V8 V9 V10 V11 V12 V13 11001 3 24 12 24.7 44.4 70.1 49.3 33.7 3.0 6.8 2.7NA 21001 3 25 0 70.1 49.3 33.7 138.2 152.5NA 4.2 6.9 17.5 31001 3 25 12 33.7 187.7

Re: [R] executing R scripts - viewing results and errors

2011-09-01 Thread Duncan Murdoch
On 01/09/2011 11:29 AM, aelmore wrote: Hi, For the first time, I am trying to call/run an R script from another program, passing parameters and results back and forth. I have been learning a little programming as I have progressed through the various projects I have been working on, but I haven

[R] Automatic Recoding

2011-09-01 Thread Thomas Chesney
I have a text file full of numbers (it's a edgelist for a graph) and I would like to recode the numbers as they are way too big to work with. So for instance the following: 6765290986671000198767829 676529098667100867672856227 67652909866791098726278 67652909866798928373 10928373

Re: [R] cannot correct step size, geweke.diag of coda

2011-09-01 Thread Jean-Christophe BOUËTTÉ
Kindly provide a reproducible example. 2011/9/1 Jim Maas : > Intermittently I'm getting this error from the geweke.diag function of the > coda package.  Would anyone be kind enough to enlighten me as to the > possible source of such an error, or how to debug/locate it? > > Error in { : task 22 fai

Re: [R] readBin fails to read large files

2011-09-01 Thread Geier, Florian
Hi Jim, yes - it definitely is 64 bit. I call it with r64 and .Platform$r_arch [1] "x86_64" It is on a apple snow leopard (10.6.8) with 16 GB of Ram - not windows Florian On 1 Sep 2011, at 16:22, jim holtman wrote: > Are you running a 64-bit version of R? It sounds like your operating > sy

Re: [R] readBin fails to read large files

2011-09-01 Thread Geier, Florian
it's me, Florian (just subscribed to R list, but my messages are still held for approval ) fail means: It executes without an error, allocates the specified length (n=) as zeroes, but does not actually read any data in. florian On 1 Sep 2011, at 16:30, Duncan Murdoch wrote: On 01/09/2011 11:

[R] executing R scripts - viewing results and errors

2011-09-01 Thread aelmore
Hi, For the first time, I am trying to call/run an R script from another program, passing parameters and results back and forth. I have been learning a little programming as I have progressed through the various projects I have been working on, but I haven't had any formal training and am now stu

[R] Hysteresis modeling and simulation

2011-09-01 Thread Bill Harris
Can anyone suggest a package or code for modeling a hysteresis process in R? I'm currently modeling a certain dataset with a GAM using mgcv, something like gam(y~ s(x, by=z) + z, family = Gamma(link=log),data=data) and getting fits with about 9 estimated degrees of freedom in the smooth for eac

Re: [R] Treat an Unquoted Character String as a Data Frame

2011-09-01 Thread Jean V Adams
Try this data <- eval(parse(text=paste(study, level, ".", population, sep=""))) Jean - dbateman wrote on 08/31/2011 17:44:44: I have several datasets that come from different studies (fv02 and fv03), they represent different levels (patients and lesions), and they have different patient

Re: [R] readBin fails to read large files

2011-09-01 Thread Duncan Murdoch
On 01/09/2011 11:13 AM, Benton, Paul wrote: Posting for a friend What does "fails" mean, i.e. what is the error message? (You might want to get Florian online here.) Duncan Murdoch Begin forwarded message: From: "Geier, Florian"mailto:florian.geie...@imperial.ac.uk>> Subject: Fwd: read

Re: [R] how to get the varifying character with two variables?

2011-09-01 Thread Jie TANG
nice. thank you all. R is a great tool and R users are also so kind . 2011/9/1 David Winsemius > > On Sep 1, 2011, at 3:45 AM, Jie TANG wrote: > > thank you. it works. >> but further question is that if we can let the " flnm" to be a >> 2-dimension >> matrix [3,5]? >> since >> mtdno<-paste("da

Re: [R] get arguments passed to function inside a function

2011-09-01 Thread Duncan Murdoch
On 01/09/2011 11:14 AM, Jannis wrote: Dear list, I am wondering whether there is an (easy) way to access all arguments and their values passed to a function inside this function and (for example) store them in a list object? I could imagine using ls() inside this function and then looping th

Re: [R] Converting anova/ancova summary to data frame

2011-09-01 Thread Shane Phillips
Perfect! Thank you! S -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Wednesday, August 31, 2011 4:44 PM To: Shane Phillips Cc: r-help@r-project.org Subject: Re: [R] Converting anova/ancova summary to data frame On 31.08.2011 22:33, Shane Phillips

Re: [R] readBin fails to read large files

2011-09-01 Thread jim holtman
Are you running a 64-bit version of R? It sounds like your operating system is not giving you enough memory. It looks like this is not under Windows in a native mode. On Thu, Sep 1, 2011 at 11:13 AM, Benton, Paul wrote: > Posting for a friend > > Begin forwarded message: > > From: "Geier, Flori

[R] cannot correct step size, geweke.diag of coda

2011-09-01 Thread Jim Maas
Intermittently I'm getting this error from the geweke.diag function of the coda package. Would anyone be kind enough to enlighten me as to the possible source of such an error, or how to debug/locate it? Error in { : task 22 failed - "inner loop 1; cannot correct step size" Thanks a bunch. J

[R] readBin fails to read large files

2011-09-01 Thread Benton, Paul
Posting for a friend Begin forwarded message: From: "Geier, Florian" mailto:florian.geie...@imperial.ac.uk>> Subject: Fwd: readBin fails to read large files Date: September 1, 2011 4:10:53 PM GMT+01:00 To: Begin forwarded message: Date: 1 September 2011 16:01:45 GMT+01:00 Subject: readBin fa

[R] get arguments passed to function inside a function

2011-09-01 Thread Jannis
Dear list, I am wondering whether there is an (easy) way to access all arguments and their values passed to a function inside this function and (for example) store them in a list object? I could imagine using ls() inside this function and then looping through all names and assigning list entr

Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
Hi I do not know sp package therefore I can not help you. Anyway without knowing "what is wrong" and without some reproducible example you hardly get any reasonable answer. It seems to me that your d list especially x and y is not what you expect to be. see str(d) 430071.4887:460006.8067

[R] iSeries and R

2011-09-01 Thread Li, Yan
Hi All, Does anyone has experiences installing R in iSeries? Does R supports iSeries? Any documentation on this topic? Thank you very much! Regards, Yan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.et

Re: [R] Alternatives to integrate?

2011-09-01 Thread R. Michael Weylandt
I'm going to try to put this nicely: What you provided is not a problem with integrate. Instead, you provided a rather unintelligible and badly-written piece of code that (miraculously) seems to work, though it's not well documented so I have no idea if 1.3e-21 is what you want to get. Let's try

[R] qqplot for count data

2011-09-01 Thread Jean-Christophe BOUËTTÉ
Dear list, I just tried to do the same thing, and did not find anything on a weighted qqplot. My weights are actually counts (positive integers). Here is a modification of qqplot, following Duncan Murdoch's suggestion. Any feedback would be welcome! Thanks, Jean-Christophe weighted.qqplot <- func

Re: [R] convert to grid file

2011-09-01 Thread azam jaafari
Thank you   I want to make a map from my spatial data that I can show it in GIS. I used the package sp and   d<- list(x=430071.4887:460006.8067, y =3390040.0591:3420006.2701, z = matrix(mat, 970, 960)) gt<- GridTopology(cellcentre.offset = c(d$x[1], d$y[1]), cellsize=c(diff(d$x[1:2]), diff(d$y[1

Re: [R] Alternatives to integrate?

2011-09-01 Thread . .
Hi Michael, This is the problem: func <- Vectorize(function(x, a, sad, samp="pois", trunc=0, ...) { result <- function(x) { f1 <- function(n) { f <- function() { dcom <- paste("d", sad, sep="") dots <- c(as.name("n"), list(...)) do.call(dcom,

Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
Hi > Thank you Petr > > It work. > > Now I have a matrix 970*960. If I want to convert to spatial grid (each > pixel has x and y coordinate). > How can I do? I do not understand. What do you want to do with your data? Maybe you could consult spatial package or CRAN Task views. One option c

Re: [R] Newer Matrix Factorization Techniques

2011-09-01 Thread Kevin Wright
Bioconductor has the pcaMethods package, with multiple options for PCA, including a robust L1-norm SVD. Kevin Wright On Thu, Sep 1, 2011 at 5:16 AM, Igor Carron wrote: > Hi, > > I am not sure if this should go to r-help or r-dev list. I have looked > at some archives of R libraries but cannot

Re: [R] Help with creating date as POSIXct

2011-09-01 Thread jim holtman
try this: > myDate <- as.POSIXct(day, format = "%y%m%d") > myDate [1] "2011-08-09 EDT" > myDate <- myDate + 0:3600 > str(myDate) POSIXct[1:3601], format: "2011-08-09 00:00:00" "2011-08-09 00:00:01" "2011-08-09 00:00:02" ... > On Thu, Sep 1, 2011 at 7:18 AM, J. Augusiak wrote: > Dear list, > > >

Re: [R] R Help finding Mean

2011-09-01 Thread jim holtman
If you format it a little differently, it is easier to read: bob<-read.csv('shi.csv', header=T) newmean<-matrix(0, test, dim(bob)[2]-6) a<-0 for (i in c(4,8:(dim(bob)[2]))){ a<-a+1 newmean[,a]<-tapply(bob[,i], bob$Exam, mean) } colnames(newmean)<-colnames(bob)[c(4,8:(dim(bob)[2]))] It lo

Re: [R] R Help finding Mean

2011-09-01 Thread B77S
see ?mean Then avoid other peoples code. cenae27 wrote: > > bob<-read.csv('shi.csv', header=T) > > newmean<-matrix(0, test, dim(bob)[2]-6);a<-0; for (i in > c(4,8:(dim(bob)[2]))) > {a<-a+1;newmean[,a]<-tapply(bob[,i], bob$Exam, mean)} > colnames(newmean)<-colnames(bob)[c(4,8:(dim(bob)[2]))] >

Re: [R] Alternatives to integrate?

2011-09-01 Thread R. Michael Weylandt
Mr ". .", MASS::area comes to mind but it may be more helpful if you could say what you are looking for / why integrate is not appropriate it is for whatever you are doing. Strictly speaking, I suppose there are all sorts of "alternatives" to integrate() if you are willing to be really creative a

Re: [R] Alternatives to integrate?

2011-09-01 Thread B77S
package "caTools" see ?trapz . wrote: > > Hi all, > > is there any alternative to the function integrate? > > Any comments are welcome. > > Thanks in advance. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help

[R] Alternatives to integrate?

2011-09-01 Thread . .
Hi all, is there any alternative to the function integrate? Any comments are welcome. Thanks in advance. __ 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/postin

[R] rJava Installation Problems: 'cannot open compressed file 'rJava/DESCRIPTION', probable reason 'No such file or directory''

2011-09-01 Thread R. Michael Weylandt
Good Morning, I'm trying to install the rJava package on a local (work) machine and having some trouble. The following occurred in an RGui session. > sessionInfo() R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=E

Re: [R] Help with creating date as POSIXct

2011-09-01 Thread Luke Miller
This should be due to the fact that "110809 60 0" is not interpreted as a valid time value. You probably want to have time.t <- 0:3599 rather than time.t <- 1:3600 if you want one value for each second in the hour, starting from 00:00:00 and running to 00:59:59. 00:60:00 is not a proper time val

Re: [R] How to retrieve bias-corrected probability from calibrate.rms

2011-09-01 Thread zhu yao
Thanks Frank I got the predicted probability. But can I get the bootstrap corrected probability for individual subject. for instance, I can get predicted probability from predict(fit, type="fitted"). Is there similar one to retrieve the bootstrap corrected probability for individual subject. TH

Re: [R] betareg question - keeping the mean fixed?

2011-09-01 Thread Bettina Gruen
Hi, I have a dataset with proportions that vary around a fixed mean, is it possible to use betareg to look at variance in the dispersion parameter while keeping the mean fixed? I am very new to R but have tried the following: svec<-c(qlogis(mean(data1$scaled)),0,0,0) f<-betareg(scaled~-1 | expt

Re: [R] Weights using Survreg

2011-09-01 Thread Terry Therneau
The survreg function uses case weights. That is, if a subject is given a weight of 2, the result is the same as if there were a second observation (exactly the same). Early in my career data sets that contained only categorical variables were often collapsed in just this way, in order to save on

Re: [R] ggplot2 to create a "square" plot

2011-09-01 Thread Dennis Murphy
Hi: On Wed, Aug 31, 2011 at 11:58 PM, Alaios wrote: > Dear Dennis, > I would like to thank you for your reply. > I also checked the web sites that you gave me, it is hard to find everything > about ggplot2 at one place with concrete examples that help you understand > directly what you are plotti

Re: [R] convert to grid file

2011-09-01 Thread azam jaafari
Thank you Petr   It work.   Now I have a matrix 970*960. If I want to convert to spatial grid (each pixel has x and y coordinate).  How can I do?    Thanks   From: Petr PIKAL To: azam jaafari Cc: R-help Sent: Thursday, September 1, 2011 8:59 AM Subject: Re: [R] convert to grid file Hi > >

Re: [R] Negative Binomial GLM

2011-09-01 Thread Jim Silverton
Hi all, I am using the negative binomila glm in MASS. This is my data alled data1: Reps Treats counts HSM11 0 21 HSM22 0 34 HSM33 0 27 PTM11 1 32 PTM22 1 20 PTM33 1 23 I goal is to do a GLM to extract the p-value

[R] R Help finding Mean

2011-09-01 Thread cenae27
bob<-read.csv('shi.csv', header=T) newmean<-matrix(0, test, dim(bob)[2]-6);a<-0; for (i in c(4,8:(dim(bob)[2]))) {a<-a+1;newmean[,a]<-tapply(bob[,i], bob$Exam, mean)} colnames(newmean)<-colnames(bob)[c(4,8:(dim(bob)[2]))] Could anyone please help me what does the above code does ... I want to fin

Re: [R] how to get the varifying character with two variables?

2011-09-01 Thread David Winsemius
On Sep 1, 2011, at 3:45 AM, Jie TANG wrote: thank you. it works. but further question is that if we can let the " flnm" to be a 2- dimension matrix [3,5]? since mtdno<-paste("data",1:3,sep="") tyno<-paste("obs",1:5,sep="") flnm<-paste(mtdno,tyno,"_err.dat",sep="") flnm would be a 1-dimension

[R] betareg question - keeping the mean fixed?

2011-09-01 Thread betty_d
Hello, I have a dataset with proportions that vary around a fixed mean, is it possible to use betareg to look at variance in the dispersion parameter while keeping the mean fixed? I am very new to R but have tried the following: svec<-c(qlogis(mean(data1$scaled)),0,0,0) f<-betareg(scaled~-1 | exp

[R] Multiple events Cox's model and proportional hazards

2011-09-01 Thread natalie.vanzuydam
Hi, I am using the survival package to perform a Cox's regression analysis on multiple events of myocardial infarctions. I have been using the Andersen and Gill model: coxph(Surv(time1,time2,status)~factor(treatment)+age+sex+cluster(id). I was just wondering if this model should satisfy proport

[R] Help with creating date as POSIXct

2011-09-01 Thread J. Augusiak
Dear list, I want to create a POSIX time vector as follows: day<- as.character("110809") time.t <- 1:3600 t.min <- time.t %/% 60 t.sec <- time.t-t.min*60 DATE <- as.POSIXct(strptime(paste(day,t.min,t.sec),"%y%m%d %M%S")) Tail(DATE) The problem is that the last element (3

Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
Hi > > Hi > > I computed probability in each cell. > I have: > > [99883,] -0.0062412957690 > [99884,] -0.0062412957690 > [99885,] -0.0062412957690 > [99886,] -0.0062412957690 > [99887,] -0.0062412957690 > [99888,] -0.0062412957690 > [99889,] 0.9909126638948 > [99890,] 0.990912663894

[R] Newer Matrix Factorization Techniques

2011-09-01 Thread Igor Carron
Hi, I am not sure if this should go to r-help or r-dev list. I have looked at some archives of R libraries but cannot seem to see a project that focuses on the new matrix factorization techniques that are showing up in the literature. I have made a list of them: https://sites.google.com/site/igor

Re: [R] How to retrieve bias-corrected probability from calibrate.rms

2011-09-01 Thread Frank Harrell
cal <- calibrate(fit, ...); note that cal is a matrix. colnames(cal) will tell you what to pick, in this case cal[,'calibrated.corrected']. Be sure to follow the posting guide. Frank yz wrote: > > Dear R users: > > In Prof. Harrell's library rms, calibrate.rms plot the Bias-corrected > Probab

[R] convert to grid file

2011-09-01 Thread azam jaafari
Hi   I computed probability in each cell. I have:    [99883,] -0.0062412957690  [99884,] -0.0062412957690  [99885,] -0.0062412957690  [99886,] -0.0062412957690  [99887,] -0.0062412957690  [99888,] -0.0062412957690  [99889,]  0.9909126638948  [99890,]  0.9909126638948  [99891,]  0.9909126638948  [99

Re: [R] Measuring CPU time

2011-09-01 Thread jim holtman
Do a little debugging on your code (put print(f1)) and you will see that you keep adding to the length of the expression to be evaluated and the results you see are correct. Learn how to debug your functions. On Thu, Sep 1, 2011 at 8:10 AM, . . wrote: > Why time is increasing for the same operat

Re: [R] Measuring CPU time

2011-09-01 Thread Gabor Grothendieck
On Thu, Sep 1, 2011 at 8:10 AM, . . wrote: > Why time is increasing for the same operation? > > I was expecting +/- the same time for each n. > > Thanks in advance. > > bench <- function(f1, n, ...) { >  t <- 0 >  for(i in 1:n) { >    func <- function(x) x^2 >    expr <- list(...)[1] >    f1 <- c(

Re: [R] vector output loop or function

2011-09-01 Thread Dennis Murphy
Hi: Here's one approach: X1 <- sample(1:4, 10, replace = TRUE, prob = c(0.4, 0.2, 0.2, 0.2)) foo <- function(x) { m <- matrix(NA, nrow = length(x), ncol = length(x)) m[, 1] <- x idx <- seq_len(length(x)) for(j in idx[-1]) { k <- sample(idx, 2) x <- replace(x, k, 5)

Re: [R] Namespace in packages

2011-09-01 Thread Erich Neuwirth
On 9/1/2011 1:04 PM, Eran Eidinger wrote: >> >>> Hello, >>> >>> I wonder how I might create a package that only reveals some of the >>> function >>> in the package to the user. >>> >>> I've tried creating an R package using the following: >>> f<- function(x,y) x+y >>> g<- function(x,y) x-y >>> h<

[R] Measuring CPU time

2011-09-01 Thread . .
Why time is increasing for the same operation? I was expecting +/- the same time for each n. Thanks in advance. bench <- function(f1, n, ...) { t <- 0 for(i in 1:n) { func <- function(x) x^2 expr <- list(...)[1] f1 <- c("system.time(y <- ", gsub("XXX",expr,f1),")[3]") t1 <- e

Re: [R] Namespace in packages

2011-09-01 Thread Duncan Murdoch
On 11-09-01 7:04 AM, Eran Eidinger wrote: Yes, the package works fine without the NAMESPACE file, and all 3 functions are visible. When you include the NAMESPACE file, what does R CMD check tell you? Duncan Murdoch On Thu, Sep 1, 2011 at 2:02 PM, Duncan Murdochwrote: On 11-09-01 2:27 AM,

Re: [R] Namespace in packages

2011-09-01 Thread Eran Eidinger
Yes, the package works fine without the NAMESPACE file, and all 3 functions are visible. On Thu, Sep 1, 2011 at 2:02 PM, Duncan Murdoch wrote: > On 11-09-01 2:27 AM, Eran Eidinger wrote: > >> Hello, >> >> I wonder how I might create a package that only reveals some of the >> function >> in the p

  1   2   >