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

2011-09-01 Thread Jie TANG
hi R user mtdno<-paste("data",1:3,sep="") tyno<-paste("obs",1:5,sep="") flnm<-paste(mtdno,tyno,"_err.dat",sep="") flnm is [1] "data1obs1_err.dat" "data2obs2_err.dat" "data3obs3_err.dat" [4] "data1obs4_err.dat" "data2obs5_err.dat" but actually what i want is data from 1 to 3 and obs from 1 to 5.

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

2011-09-01 Thread Prof Brian Ripley
See ?outer (use paste as the function, as in one of the examples). On Thu, 1 Sep 2011, Jie TANG wrote: hi R user mtdno<-paste("data",1:3,sep="") tyno<-paste("obs",1:5,sep="") flnm<-paste(mtdno,tyno,"_err.dat",sep="") flnm is [1] "data1obs1_err.dat" "data2obs2_err.dat" "data3obs3_err.dat" [4]

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

2011-09-01 Thread Jie TANG
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 with 15 elements? thankyou 2011/9/1 Jorge I Vele

[R] save grid

2011-09-01 Thread azam jaafari
Hi   I have a problem for saving grid file in R. I want to save a grid file as "tif".   I write this: writeGDAL(predict.grid, 'predict.tif')   after running, I don't recieve any error. But when I want to open the 'file.tif', it doesn't open. for example in paint program: I recieve this: Paint

Re: [R] problem with "plm" package

2011-09-01 Thread Liviu Andronic
On Thu, Sep 1, 2011 at 4:25 AM, Ash wrote: > Hi, > > I am trying to complete a very simple panel analysis on some bank data. > > Call: > Formula<-plm(RoE~RoA+CAR+Inc.Dep+Cash.TL+NPL.Loans, data=Banks1, > model="random", index=c("Bank.I.D.","Year")) > summary(Formula) > > I get the following error

Re: [R] missing R.dll file

2011-09-01 Thread Paul Hiemstra
On 09/01/2011 04:30 AM, Erin Hodgess wrote: > Dear R People: > > I was using R with no problems last night. > > Now tonight, when I type in "Rgui", I get an error message that R.dll > is not found and try to re-install. > > Have any of you run into this, please? > > Thanks, > Erin > > Hi Erin, Wi

Re: [R] !!!function to do the knn!!!

2011-09-01 Thread Paul Hiemstra
On 08/31/2011 02:55 PM, David Winsemius wrote: > Thank your for your entry in the Poorly Capitalized and Inadequately > Searched Posting Contest. You will be advised of your ranking in due > course. In the meantime, you may want to consult the recommended > search site for []functions and []Task V

Re: [R] formatting a 6 million row data set; creating a censoring variable

2011-09-01 Thread Matthew Dowle
This is the fastest data.table way I can think of : ans = mydt[,list(mytime=.N),by=list(id,mygroup)] ans[,censor:=0L] ans[J(unique(id)), censor:=1L, mult="last"] id mygroup mytime censor [1,] 1 A 1 1 [2,] 2 B 3 0 [3,] 2 C 3 0 [4,] 2 D

Re: [R] unequal bins in filled.contour

2011-09-01 Thread Dan Carpenter
That's brilliant, thanks Dr Dan Carpenter | Post-doctoral Research Assistant | Soil Biodiversity Group | Entomology Department | Natural History Museum | London | SW7 5BD | 0207 942 5208 | d.carpen...@nhm.ac.uk -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent

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

2011-09-01 Thread zhu yao
Dear R users: In Prof. Harrell's library rms, calibrate.rms plot the Bias-corrected Probability and Apparent Probability. The latter one can be retrieved from class calibrate.default. But how to retrieve the former one. BW *Yao Zhu* *Department of Urology Fudan University Shanghai Cancer Center

Re: [R] Why does loading saved/cached objects add significantly to RAM consumption?

2011-09-01 Thread Janko Thyson
On 30.08.2011 20:33, Henrik Bengtsson wrote: Hi. On Tue, Aug 30, 2011 at 3:59 AM, Janko Thyson wrote: Dear list, I make use of cached objects extensively for time consuming computations and yesterday I happened to notice some very strange behavior in that respect: When I execute a given comp

Re: [R] !!!function to do the knn!!!

2011-09-01 Thread Petr PIKAL
Hi Try to call 112 if you are in Europe. Regards Petr > Re: [R] !!!function to do the knn!!! > > help, help ,help!!! > > -- > View this message in context: http://r.789695.n4.nabble.com/function-to- > do-the-knn-tp3781137p3781738.html > Sent from the R help mailing list archive at Nabble.com.

Re: [R] !!!function to do the knn!!!

2011-09-01 Thread Liviu Andronic
I would nominate the following fortune: On Thu, Sep 1, 2011 at 12:16 PM, Petr PIKAL wrote: > Try to call 112 if you are in Europe. > David Winsemius: Thank your for your entry in the Poorly Capitalized and Inadequately Searched Posting Contest. mark: help, help ,help!!! Petr PIKAL: Try to call

[R] read.xlsx handle NAs

2011-09-01 Thread Johannes Radinger
Hello, I import a xlsx-table with read.xlx which contains NAs in 4 columns. In the excel table these 4 columns contain floats/integers and the word NA. But when I am importing the NAs are recognized as strings rather than as missing values. How can I set that if a cell contains the word NA tha

Re: [R] save grid

2011-09-01 Thread Paul Hiemstra
On 09/01/2011 08:34 AM, azam jaafari wrote: > Hi > > I have a problem for saving grid file in R. I want to save a grid file as > "tif". If you want to save a picture (bitmap) of your data, use e.g. the tif() function in such a way: tiff("predict.tif") plot(predict.grid) dev.off() Below you

Re: [R] Namespace in packages

2011-09-01 Thread Duncan Murdoch
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 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<- function(x,y) f(x,y)*g(x,y) package.sk

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

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,

[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 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<

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] 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] 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

[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] 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] 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] 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] 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

[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] 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

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] 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] 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

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] 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] 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] 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] 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] 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

[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

[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

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

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] 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] 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] 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] 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] 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] 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 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

[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] 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] 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] 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] 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

[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] 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

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

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] 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] 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] 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] 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

[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

[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

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:

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] 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

[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] 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] 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] 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

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] 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] 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
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] 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

[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:

[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

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

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] 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] 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

[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] 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

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] 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 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] 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 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] 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 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

[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 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

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] 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] 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] 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

[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

  1   2   >