Re: [R] applying quantile to a list using values of another object as probs

2010-05-17 Thread Lorenzo Cattarino
Hi Jorge It worked! lapply(1:length(mylist), function(i) quantile(mylist[[i]], probs = B[i])) #like yours but without coma after i [[1]] 99.62995% 0.7989808 [[2]] 55.33357% -0.653456 [[3]] 72.30253% -0.4872166 [[4]] 39.69968% -1.138819 [[5]] 29.84813%

Re: [R] Robust SE & Heteroskedasticity-consistent estimation

2010-05-17 Thread Arne Henningsen
On 17 May 2010 22:55, RATIARISON Eric wrote: > It's ok Arne, i've build the MS windows binary. > > And the result is ok (sandwich function runs)with this next modifications in > my user specified functions > But with the following functions (individual one): > > > sc= as.vector( c(log(mean(v)),re

Re: [R] suggestions/improvements for recoding strategy

2010-05-17 Thread Peter Ehlers
Sorry, my attempt wasn't quite good enough. I didn't consider the possibility of a 'negative' value in a character/factor column. To fix that, see inline below. On 2010-05-17 14:32, Peter Ehlers wrote: On 2010-05-17 12:54, Henrique Dallazuanna wrote: Try this: newData<- sapply(numdat, functi

Re: [R] applying quantile to a list using values of another object as probs

2010-05-17 Thread Dan Davison
"Lorenzo Cattarino" writes: > Hi Jim, > > Thanks for your reply. Your codes does work but I was hoping to find a > way to use lapply and avoid the for loop. > > Lorenzo > > > -Original Message- > From: Jim Lemon [mailto:j...@bitwrit.com.au] > Sent: Monday, 17 May 2010 8:27 PM > To: Loren

Re: [R] Variable variables using R ... e.g., looping over data frames with a numeric separator

2010-05-17 Thread Dan Davison
Monte Shaffer writes: > Hello, > > I have programmed in PHP a lot, and wanted to know if anyone figured out > Variable variables using R. > > For example, I have several dataframes of unequal sizes that relate to L > treatments (1, 2, 3, 4, 5,6, L) ... in this case L=7 You should create a list c

Re: [R] Problem with ldply

2010-05-17 Thread cfriedl
Thanks for teaching me something new. :) -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-ldply-tp2219094p2220473.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://sta

[R] Variable variables using R ... e.g., looping over data frames with a numeric separator

2010-05-17 Thread Monte Shaffer
Hello, I have programmed in PHP a lot, and wanted to know if anyone figured out Variable variables using R. For example, I have several dataframes of unequal sizes that relate to L treatments (1, 2, 3, 4, 5,6, L) ... in this case L=7 fData.1 unique.1 fit.nls.1 summary.nls.1 fit.var.1 summary.var

[R] survey package: weights used in svycoxph()

2010-05-17 Thread Vinh Nguyen
Dear R-help, Let me know if I should email r-devel instead of this list. This message is addressed to Professor Lumley or anyone familiar with the survey package. Does svycoxph() implement the method outlined in Binder 1992 as referenced in the help file? That is, are weights incorporated in th

[R] Create counter variable for subsets without a loop

2010-05-17 Thread Thomas Brambor
Hi all, I am looking to create a rank variable based on a continuous variable for subsets of the data. For example, for an R integrated data set about US states this is how a loop could create what I want: ### Example with loop data <- cbind(state.region,as.data.frame(state.x77))[,1:2] # choo

[R] proportion of treatment effect by a surrogate (fitting multivariate survival model)

2010-05-17 Thread Vinh Nguyen
Dear R-help, I would like to compute the variance for the proportion of treatment effect by a surrogate in a survival model (Lin, Fleming, and De Gruttola 1997 in Statistics in Medicine). The paper mentioned that the covariance matrix matches that of the covariance matrix estimator for the margin

Re: [R] applying quantile to a list using values of another object as probs

2010-05-17 Thread Lorenzo Cattarino
Hi Jim, Thanks for your reply. Your codes does work but I was hoping to find a way to use lapply and avoid the for loop. Lorenzo -Original Message- From: Jim Lemon [mailto:j...@bitwrit.com.au] Sent: Monday, 17 May 2010 8:27 PM To: Lorenzo Cattarino Cc: r-help@r-project.org Subject: Re:

Re: [R] reading in all files of a certain type

2010-05-17 Thread Dan Davison
jim holtman writes: > try: > > pattern="*result*\\.csv$" Just for the record, that's not quite correct. The * doesn't behave like in a shell glob. Instead, * says "0 or more copies of the previous character". So the above pattern picks up resul.csv, which I don't think was intended. I don't kno

[R] issues with R Library on a Server

2010-05-17 Thread Daisy Englert Duursma
Hello, I am a bit over my head on this issue. My colleagues and I are running R off of our server. We all have admin rights and prior to yesterday we all had our own libraries. Our main system administrator advised us that we should have a shared library. So, I am trying to do this. I have downl

[R] survey package: weights used in svycoxph()

2010-05-17 Thread Vinh Nguyen
Dear R-help, Let me know if I should email r-devel instead of this list.  This message is addressed to Professor Lumley or anyone familiar with the survey package. Does svycoxph() implement the method outlined in Binder 1992 as referenced in the help file?  That is, are weights incorporated in th

Re: [R] reading in all files of a certain type

2010-05-17 Thread Dimitri Liakhovitski
Thank you very much - it's very helpful! Dimitri On Mon, May 17, 2010 at 9:39 PM, Dan Davison wrote: > Dimitri Liakhovitski writes: > >> Thanks again - and one follow-up question. >> When I do do.call(rbind, lapply(dir(patt = "\\.csv$"), read.csv)) >> What is the right way to speicify (probably

[R] Data preparation for MCMCbinaryChange

2010-05-17 Thread Shige Song
Dear All, Since no one has answered my previous question, let me revise it a little and ask again. My data set contains about 10,000 women born in 60 months. The outcome variable is a binary variable indicating whether one has certain health problems. My hypothesis is that the 60 months in which

Re: [R] reading in all files of a certain type

2010-05-17 Thread Dan Davison
Dimitri Liakhovitski writes: > Thanks again - and one follow-up question. > When I do do.call(rbind, lapply(dir(patt = "\\.csv$"), read.csv)) > What is the right way to speicify (probably under "patt") that I only > need to grab those .csv files that contain a certain string, e.g., > "result"? I

Re: [R] reading in all files of a certain type

2010-05-17 Thread jim holtman
try: pattern="*result*\\.csv$" On Mon, May 17, 2010 at 9:06 PM, Dimitri Liakhovitski wrote: > Thanks again - and one follow-up question. > When I do do.call(rbind, lapply(dir(patt = "\\.csv$"), read.csv)) > What is the right way to speicify (probably under "patt") that I only > need to grab thos

Re: [R] reading in all files of a certain type

2010-05-17 Thread Dimitri Liakhovitski
Thanks again - and one follow-up question. When I do do.call(rbind, lapply(dir(patt = "\\.csv$"), read.csv)) What is the right way to speicify (probably under "patt") that I only need to grab those .csv files that contain a certain string, e.g., "result"? I tried a couple of things, like patt= "\\.

Re: [R] help color coding map in R

2010-05-17 Thread Felix Andrews
Sorry, I was talking nonsense. The actual problem was in your panel function, where you extract the state boundaries, and then draw them using panel.polygon: the order of states from map() is arbitrary, and does not correspond to the color palette that you set up. I suggest using mapplot(). This

[R] Poisson change point model with offset

2010-05-17 Thread Shige Song
Dear All, I am trying to do a Bayesian change point analysis. My dependent variable is a proportion, so the natural choice will be a Poisson model with offset. Now the two options for change point model with R is MCMCpack and bcp, but neither seems to be able to handle such model, am I right? Are

Re: [R] best polynomial approximation

2010-05-17 Thread Ravi Varadhan
Hi, My understanding is that Chebyshev polynomials solve the minimax approximation problem. If this correct, what you need is an algorithm to compute Chebyshev polynomial approximation. I have written an R function to do this. See the attached code that contains the function and an example. Is

Re: [R] compiling an R script

2010-05-17 Thread Jean-Christophe Domenge
Thanks a lot for your help Duncan, message forwarded. Jean-Christophe On Wed, May 12, 2010 at 15:20, Duncan Murdoch wrote: > On 12/05/2010 8:34 AM, Jean-Christophe Domenge wrote: > >> Dear R gurus, >> some guy at my company would like to compile a script written in R. >> In short he would like t

[R] best polynomial approximation

2010-05-17 Thread Patrizio Frederic
Dear R-users, I learned today that there exists an interesting topic in numerical analysis names "best polynomial approximation" (BSA). Given a function f the BSA of degree k, say pk, is the polynomial such that pk=arginf sup(|f-pk|) Although given some regularity condition of f, pk is unique, p

Re: [R] Isn't aggreate.zoo supposed to work with POSIXct (zoo/TTR/xts issue)?

2010-05-17 Thread Achim Zeileis
On Mon, 17 May 2010, ivan popivanov wrote: library(xts) library(TTR) ndx = getYahooData("^NDX") aa = ndx$Close bb = aggregate(aa, as.yearweek, tail, 1) The last operation takes forever, and then the bb dates are messed up. The problem is problem due to the as.yearweek() function which is ne

Re: [R] lme4 + R 2.11.0 + mac unavailable

2010-05-17 Thread David Winsemius
On May 17, 2010, at 5:01 PM, Adam November wrote: I believe I'm working with the newest version of R (2.11.0) and I've tried a few of the most recent versions... No luck yet. Luck has nothing to do with it. What part of ERROR in the CRAN package check for the current version of lme4 with th

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread Jun Shen
Thanks for pointing that out, baptiste. No need to use windows(). Width and height should be specified in pdf(). On Mon, May 17, 2010 at 3:28 PM, baptiste auguie wrote: > No, that's only true for lattice and ggplot2 graphics. The problem > here is with this line, > > windows(width=5, height=5) >

[R] Instrumental variables and quantile regression in R

2010-05-17 Thread Neil Hepburn
Greetings does anyone know of an R package that can do quantile regression with instrumental variables. I've found 'sem' for IV estimation and 'quantreg' for quantile regression but I would like to find something that can do a quantile regression with instrumental variables. Cheers, Neil ==

Re: [R] timing a function

2010-05-17 Thread Alexander Shenkin
You could also put the call to system.time inside the function itself: f = function(x) { system.time({ ... #function's code ret_val = ... }); flush.console(); return ret_val; } i s'pose you'd miss out on the time taken to jump to the function code, return the value, et

[R] pass names from dataframe as arguments

2010-05-17 Thread Joshua Wiley
R users, I am trying to write some functions where names from a dataframe are arguments. I know it is done in functions like lm(), but I haven't been able to figure out how unless I attach the dataframe first or wrap the names in expression() so they are not evaluated immediately. How can I get a

[R] Graphing Titration Curves, how to graph in R

2010-05-17 Thread Amitoj S. Chopra
I am working on a script with R to calculate pKa values. I want to be able then to graph pKa values to Energy, basically two variables which will give me titration curves. It is basically a graph with two variables and help with just graphing it will be just fine. But if anyone is familiar with ti

[R] [R-pkgs] version 4.39 of the caret package

2010-05-17 Thread KuhnA03
Version 4.39 of the caret package was sent to CRAN. caret can be used to tune the parameters of predictive models using resampling, estimate variable importance and visualize the results. There are also various modeling and "helper" functions that can be useful for training models. caret has wrapp

[R] Appending to gzfile does not work in R 2.11.0

2010-05-17 Thread Hana Sevcikova
In R 2.11.0, the following code that appends data using gzfile in 'ab' mode doesn't work anymore (it worked in the previous versions): con <- gzfile('myfile.gz', open='wb') write.table(c(1,2,3), file=con) close(con) con <- gzfile('myfile.gz', open='ab') write.table(c(4,5), file=con) close(con)

Re: [R] Java API to pass commands to R console from Java Program

2010-05-17 Thread NewRUser
Thanks Cedric. I did take a look at RServe, but that doesn't seem to support concurrency in windows environment. As ours is primarily a windows environment, we are looking for some other ways. Is there any way in rJava/JRI to call commands directly from java code? Thank you. On Sat, May 15, 2010

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread Anthony Lopez
one way: x <- rnorm(100) y <- x+rnorm(100) par(mfrow=c(2,2)) # this sets up the graphics window to expect a 2x2 layout plot(x,y) boxplot(x,y,names=c("var1","var2")) hist(x) hist(y) mtext("fourplots on same page",side=3,outer=T,line=-1.5) and you can adjust as needed to put more or less plots o

Re: [R] timing a function

2010-05-17 Thread Gustave Lefou
Thank you Bill, Peter and Barry. 2010/5/17 Barry Rowlingson > On Mon, May 17, 2010 at 6:24 PM, Peter Ehlers wrote: > > > Try > > system.time(y <- f(x)) > > > > and see ?"=". > > > > -Peter Ehlers > > Ah ha. That explains the curly brackets I saw in a posting with > system.time on stack ove

Re: [R] lme4 + R 2.11.0 + mac unavailable

2010-05-17 Thread Adam November
I believe I'm working with the newest version of R (2.11.0) and I've tried a few of the most recent versions... No luck yet. Thanks, -Adam On Mon, May 17, 2010 at 1:51 PM, David Winsemius wrote: > > On May 17, 2010, at 4:44 PM, Adam November wrote: > >> Hi All, >> Just thought I'd bring attention

[R] GAM vs. GAMM, how to model increasing error variance?

2010-05-17 Thread Claudia Penaloza
I fit a GAM to turtle growth data using mgcv: >m1 <- gam(growth~s(mean.size, bs="cr")+s(year,bs="cr",k=7)+s(cohort,bs="cr")+s(age,bs="cr"), data=grow, family=quasi(link="identity")) The errors are skewed (and seem to be correlated with age) (code and plots here: https://docs.google.com/fileview?

Re: [R] lme4 + R 2.11.0 + mac unavailable

2010-05-17 Thread David Winsemius
On May 17, 2010, at 4:44 PM, Adam November wrote: Hi All, Just thought I'd bring attention to the fact that lme4 is failing cran checks on the mac platform, and I can't seem to install it from source on 10.5 or 10.6, either ("ld: library not found for -lgfortran ") . Any help getting this worki

Re: [R] lme4 + R 2.11.0 + mac unavailable

2010-05-17 Thread Adam November
Hi All, Just thought I'd bring attention to the fact that lme4 is failing cran checks on the mac platform, and I can't seem to install it from source on 10.5 or 10.6, either ("ld: library not found for -lgfortran ") . Any help getting this working? Thanks! (sorry for the non-plain-text...) __

[R] lme4 + R 2.11.0 + mac unavailable

2010-05-17 Thread Adam November
Hi All, Just thought I'd bring attention to the fact that lme4 is failing cran checks on the mac platform, and I can't seem to install it from source on 10.5 or 10.6, either ("ld: library not found for -lgfortran ") . Any help getting this working? Thanks! [[alternative HTML version delete

[R] Isn't aggreate.zoo supposed to work with POSIXct (zoo/TTR/xts issue)?

2010-05-17 Thread ivan popivanov
library(xts) library(TTR) ndx = getYahooData("^NDX") aa = ndx$Close bb = aggregate(aa, as.yearweek, tail, 1) The last operation takes forever, and then the bb dates are messed up. The following produces the desired result: time(aa) = as.Date(time(aa)) bb = aggregate(aa, as.yearweek, tail, 1)

Re: [R] suggestions/improvements for recoding strategy

2010-05-17 Thread Peter Ehlers
On 2010-05-17 12:54, Henrique Dallazuanna wrote: Try this: newData<- sapply(numdat, function(x)lapply(strsplit(as.character(x), '-'), function(.x)mean(as.numeric(.x There's a potential problem if numdat contains negative numbers. It would be better to restrict the recoding to character or

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread baptiste auguie
No, that's only true for lattice and ggplot2 graphics. The problem here is with this line, windows(width=5, height=5) which shouldn't be there. HTH, baptiste On 17 May 2010 22:23, Jun Shen wrote: > If you do plotting in a loop, then you need to print it to the device. > > print(plot(xj,y)) >

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread Jun Shen
If you do plotting in a loop, then you need to print it to the device. print(plot(xj,y)) On Mon, May 17, 2010 at 3:02 PM, Shirley Bao wrote: > Thanks! > I got an error message when opening the pdf file: "There was an error > opening this document. This file cannot be opened because it has no pag

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread Shirley Bao
Thanks! I got an error message when opening the pdf file: "There was an error opening this document. This file cannot be opened because it has no pages." Here is what I did in plotting and saving the file: pdf(file="C:/figure.pdf") for (j in 1:numColumns) { windows(width=5, height=5) plot(xj,y)

Re: [R] how to save multiple plots in one PDF file?

2010-05-17 Thread Jun Shen
1.Open pdf device >pdf() 2.Do your plotting as many as you want, you won't see the plots on the screen because they go directly to the pdf() device. 3.Turn off the pdf() >dev.off() Then you can review your plots in the pdf file. For more details see ?pdf Jun On Mon, May 17, 2010 at 2:41 PM, Shirl

[R] how to save multiple plots in one PDF file?

2010-05-17 Thread Shirley Bao
I have created separate plots in multiple graphics windows using the windows() function in R. How do I save all the plots in one PDF file? I tried savePlot("C:/rplot.pdf", type = "pdf"). However, it only saved the plot in the current graphics window. Thank you! [[alternative HTML versio

Re: [R] Display Large Matrix as an Image

2010-05-17 Thread tetonedge
That works great, thanks -- View this message in context: http://r.789695.n4.nabble.com/Display-Large-Matrix-as-an-Image-tp2220139p2220219.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread Nikhil Kaza
My mistake. cars2 should be initalized to have all the extra rows. cars2 <- data.frame(matrix(rep(NA, prod(dim(cars)) + ncol(cars)), nrow(cars)+1)) cars2[2:nrow(cars2),] <- cars In this way, insertion at any row is possible. Nikhil On May 17, 2010, at 2:46 PM, Peter Ehlers wrote: data(

Re: [R] Display Large Matrix as an Image

2010-05-17 Thread baptiste auguie
Hi, try this, m = matrix(runif(2000*2400), nrow=2000) library(grid) grid.raster(m) HTH, baptiste On 17 May 2010 20:35, tetonedge wrote: > > I have a matrix that is 2400x2000 and I would like to display it as an image, > I have tried image(), but due to the size of the matrix the drawing of t

Re: [R] timing a function

2010-05-17 Thread Barry Rowlingson
On Mon, May 17, 2010 at 6:24 PM, Peter Ehlers wrote: > Try >  system.time(y <- f(x)) > > and see ?"=". > >  -Peter Ehlers Ah ha. That explains the curly brackets I saw in a posting with system.time on stack overflow just now: system.time({y=f(x)}) works as expected since the {} pair make a

Re: [R] suggestions/improvements for recoding strategy

2010-05-17 Thread Henrique Dallazuanna
Try this: newData <- sapply(numdat, function(x)lapply(strsplit(as.character(x), '-'), function(.x)mean(as.numeric(.x On Mon, May 17, 2010 at 3:29 PM, Juliet Hannah wrote: > I am recoding some data. Many values that should be 1.5 are recorded > as 1-2. Some example data and my solution is bel

[R] Display Large Matrix as an Image

2010-05-17 Thread tetonedge
I have a matrix that is 2400x2000 and I would like to display it as an image, I have tried image(), but due to the size of the matrix the drawing of the plot is extremely slow. Does anybody know of any fast ways to visualize such a large matrix. Thanks -- View this message in context: http://r.7

[R] suggestions/improvements for recoding strategy

2010-05-17 Thread Juliet Hannah
I am recoding some data. Many values that should be 1.5 are recorded as 1-2. Some example data and my solution is below. I am curious about better approaches or any other suggestions. Thanks! # example input data myData <- read.table(textConnection("id, v1, v2, v3 a,1,2,3 b,1-2,,3-4 c,,3,4"),head

Re: [R] Quantile regression - violation of independence

2010-05-17 Thread Bert Gunter
This is not an R question, though you may receive help from this list. But you would probably do better posting on a statistical list, especially one focused on ecology. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help

[R] Quantile regression - violation of independence

2010-05-17 Thread Valeriano Parravicini
I am trying to perform quantile regression (using quantreg package) and I am particularly interested to know whether the technique requires independence of observations. I am an ecologist and, in particular, I collected data of abundance of a species in 15 location around an island. In each l

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread Nikhil Kaza
Works with warnings for me. but your method is better. Nikhil On May 17, 2010, at 1:35 PM, Peter Ehlers wrote: data(cars) cars2 <- cars cars2[2:nrow(cars)+1,] <- cars2[1:nrow(cars),] cars2[1,] <- NA __ R-help@r-project.org mailing list https://sta

Re: [R] bwplot in loop

2010-05-17 Thread David Winsemius
On May 17, 2010, at 1:36 PM, GL wrote: I have the two loops listed below. The first executes perfectly and creates a series of density plots. The second does not produce any output, however, if I enter the exact bwplot command after the loop executes, I get output for the last value in t

Re: [R] bwplot in loop

2010-05-17 Thread GL
Subsequently saw this in FAQs See FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f -- View this message in context: http://r.789695.n4.nabble.com/bwplot-in-loop-tp2220020p2220034.html Sent from the R help mailing list archive at Nabble.com. __

[R] bwplot in loop

2010-05-17 Thread GL
I have the two loops listed below. The first executes perfectly and creates a series of density plots. The second does not produce any output, however, if I enter the exact bwplot command after the loop executes, I get output for the last value in the list of services. Why am I not getting output

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread Peter Ehlers
On 2010-05-17 11:14, Nikhil Kaza wrote: Does this work? data(cars) cars2 <- cars cars2[2:nrow(cars)+1,] <- cars2[1:nrow(cars),] cars2[1,] <- NA Not for me. Did you try it? -Peter Ehlers Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail

[R] extremely large negative AIC value in lme mode fitting

2010-05-17 Thread Houhou Li
Hi, Everyone, I am trying to fit a ring specific gravity dataset using the linear mixed-effects model (lme function) in R. However, the AIC value is extrememly low (such as -8000) and the loglikehihhod value is extremely big (such as 4000), which seems not correct to me. What could the result i

Re: [R] timing a function

2010-05-17 Thread Peter Ehlers
On 2010-05-17 10:49, Gustave Lefou wrote: Dear all, I have a function f(x). ptm<- proc.time() y=f(x) proc.time() - ptm works fine for me. However it is not possible to write system.time(y=f(x)) and system.time(f(x)) does not store the value of f(x). Should I prefer the 3 lines with

Re: [R] Running gplots package with Windows 7

2010-05-17 Thread Aaron Gusdon
Thank-you for the replies. I believe I figured out what the problem was. When I installed the package on linux it ran smoothly, but I just need to install a lot of accessory packages to make gplots work with Windows. Thanks again, Aaron 2010/5/17 Uwe Ligges > Additionally, please give the

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread Peter Ehlers
On 2010-05-17 9:28, ecvet...@uwaterloo.ca wrote: I have a large data frame 48:2185 with different numbers. I would like to add only one row at the very top of my data frame with 0's or NA's. I don't know which approach to use. Should i create 2 different data frames and merge them? Ive also tried

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread Nikhil Kaza
Does this work? data(cars) cars2 <- cars cars2[2:nrow(cars)+1,] <- cars2[1:nrow(cars),] cars2[1,] <- NA Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail.com On May 17, 2010, at 11:28 AM, ecvet...@uwaterloo.ca wrote: I have a large dat

[R] Re : append new line in existing graph

2010-05-17 Thread Mohan L
Dear All, I am executing my R script from PHP using the shell_exec. $return = shell_exec("/usr/bin/R --slave --args ".$Domain.",".$Gender." < /var/www/html/trends/newTrend.R"); In newTrend.R, I am plotting graph and save in pdf file using the below code. It will create a pdf file with two line.

Re: [R] timing a function

2010-05-17 Thread Gustave Lefou
Dear all, I have a function f(x). > ptm <- proc.time() > y=f(x) > proc.time() - ptm works fine for me. However it is not possible to write > system.time(y=f(x)) and > system.time(f(x)) does not store the value of f(x). Should I prefer the 3 lines with proc.time ? Thank you very much, Gusta

[R] [R-pkgs] Bidirectional piping in windows

2010-05-17 Thread Matt Young
Lot of examples for one way pipes, but I need to create some named pipes from R to another process, especially SQLite. I am look at the R/SQLite packages for help. ANy pointers? ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/

Re: [R] Adding a row at top of dataframe

2010-05-17 Thread jim holtman
Try this: > x <- data.frame(a=1:10, b=1:10) > x a b 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 > # add a row at the top > x <- x[c(1,seq(nrow(x))),] > x a b 11 1 1.1 1 1 22 2 33 3 44 4 55 5 66 6 77 7 8

[R] BRugs under Linux?

2010-05-17 Thread Kevin E. Thorpe
Hello. In this post: http://finzi.psych.upenn.edu/Rhelp10/2010-March/233815.html Uwe Ligges suggests using BRugs rather than R2WinBUGS under windows. He also notes that it is not in the main CRAN repository, but it is in "extras" which is a default repository under windows. I have OpenBUGS

[R] [R-pkgs] bigmemory 4.2.3

2010-05-17 Thread Jay Emerson
The long-promised revision to bigmemory has arrived, with package 4.2.3 now on CRAN. The mutexes (locks) have been extracted and will be available through package synchronicity (on R-Forge, soon to appear on CRAN). Initial versions of packages biganalytics and bigtabulate are on CRAN, and new ver

[R] [R-pkgs] Bayesian change point" package bcp 2.2.0 available

2010-05-17 Thread Jay Emerson
Version 2.2.0 of package bcp is now available.  It replaces the suggests of NetWorkSpaces (previously used for optional parallel MCMC) with the dependency on package foreach, giving greater flexibility and supporting a wider range of parallel backends (see doSNOW, doMC, etc...). For those unfamili

Re: [R] Box-Cox Transformation: Drastic differences when varying added constants

2010-05-17 Thread Bill Pikounis
Hi Holger, I would also highly recommend you look at the ?boxcox and ?logtrans functions in the MASS package. There is also a very illuminating, concise discussion about their use on Pages 170 - 172 of Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. with

[R] Adding a row at top of dataframe

2010-05-17 Thread ecvetano
I have a large data frame 48:2185 with different numbers. I would like to add only one row at the very top of my data frame with 0's or NA's. I don't know which approach to use. Should i create 2 different data frames and merge them? Ive also tried the rbind command with no luck. I would app

[R] Unable to execute lm function within a Rscript launch in the Linux Terminal

2010-05-17 Thread Thomas MORISSEAU
Hello to the list I'm using a Rscript launched via the linux terminal as the title of this mail explains. The following is the code of the Rscript : myRscript.r 1 #!/usr/bin/Rscript 2 3 #Read data 4 data=read.table("/home/morisseau/stage/recherche/gwas/data/CFHLC

Re: [R] Change order of columns in table?

2010-05-17 Thread Gabor Grothendieck
Assuming you really do have a table, > tab <- as.table(c(Friday=119, Monday=173, Saturday=80, + Sunday=96, Thursday=167, Tuesday=193, Wednesday=194)) > tab FridayMonday SaturdaySunday Thursday Tuesday Wednesday 119 1738096 167 193 194 w

[R] [R-pkgs] Rcpp 0.8.0 on CRAN

2010-05-17 Thread Dirk Eddelbuettel
= Summary = Version 0.8.0 of the Rcpp package was released to CRAN today. This release marks another milestone in the ongoing redesign of the package, and underlying C++ library. = Overview = Rcpp is an R package and C++ library that facilitates integration of C++ code in R pac

[R] plm(..., model="within", effect="twoways") is very slow on unablanaced data (was: Re: Regressions with fixed-effect in R)

2010-05-17 Thread Liviu Andronic
Hello Giovanni I made a minor modification to your function, which now allows to compute the within R-sq in Twoways Within models (see below). However I ran into an issue that I have already encountered before: whenever I try to fit Twoways Within models on my unbalanced data, the process is stran

Re: [R] Change order of columns in table?

2010-05-17 Thread Joshua Wiley
Hello, What about something like this? week.table <- data.frame(Friday=119, Monday=173, Saturday=80, Sunday=96, Thursday=167, Tuesday=193, Wednesday=194) ordered <- c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday") week.table <- week.table[,ordered] library(plotrix) pie3D

Re: [R] Robust SE & Heteroskedasticity-consistent estimation

2010-05-17 Thread Arne Henningsen
On 13 May 2010 00:41, RATIARISON Eric wrote: > Hi, here my new version: > I submit you my case: > ( Pseudo likehood for exponential family with offset ) > > loglik <- function(param)  { >   b<-param >   m=as.vector(of+z%*%b) >   ll <- sum(v*m-exp(m))   } > > gradlik <- function(param) { >     b<-p

Re: [R] Change order of columns in table?

2010-05-17 Thread David Winsemius
On May 17, 2010, at 10:31 AM, someone wrote: well, actually the script is run by crone job once in a while and id hate to do things manually... The order of levels of a factor variable variable can be changed with a call along the lines of fac <- factor(fac, levels=c"(Monday", "Tuesda

Re: [R] Change order of columns in table?

2010-05-17 Thread someone
well, actually the script is run by crone job once in a while and id hate to do things manually... -- View this message in context: http://r.789695.n4.nabble.com/Change-order-of-columns-in-table-tp2219536p2219725.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Text positioning in pixel coordinates?

2010-05-17 Thread Oliver
Hello, the positioning of text elements in a graphics is nortmally done via x/y coordin ates of the displayed data. most of the time this is very helpful (and missing in other programs). But when I want to set some text into a graphics always at the same position, this will not be easy... I mi

Re: [R] Change order of columns in table?

2010-05-17 Thread Thomas Stewart
7 data points? What's wrong with with doing it manually? x<-c(173,193,194,167,119,80,96) labs<-c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday") pie3D(x,labels=labs) -tgs On Mon, May 17, 2010 at 8:46 AM, someone wrote: > > I'm an R noob and have a (maybe) stupid questi

[R] R interface for blind users: Summary

2010-05-17 Thread Rainer Scheuchenpflug
Dear R-help, just for the record a summary of responses to my problem: > On 04/05/2010 9:41 AM, Rainer Scheuchenpflug wrote: > a student of mine tries to use the Windows-Rconsole with screen > reading software (she is blind), and cannot access the command line (Menus are ok). - Duncan Murdoch

Re: [R] Loess fit

2010-05-17 Thread Liaw, Andy
I'm just guessing (since as David pointed out, no reproducible example were given), but this perhaps could be the problem: R> x <- 1:10 R> y <- rnorm(x) R> fm <- loess(y ~ x) R> predict(fm, data.frame(x=5:15)) [1] 0.1830450 0.2145826 -0.2158466 -0.3051978 -0.2635318 -0.1013985 [7] NA

Re: [R] Help with RandomForest

2010-05-17 Thread Liaw, Andy
Steve, It sounds to me like you want to use the model to predict data in other maps. If so, you should be using predict(), not getTree(). getTree() shows the classification rules in _one_ of the trees in the forest (default the first tree), which is rarely of interest if you've grown hundreds of

Re: [R] improvement

2010-05-17 Thread Sebastian Kruk
For example if nombreC <- nombreC <- c("Juan", "Carlos", "Ana", "María","Mario") I do not want as a result: name index 1 Juan 1 2 Juan 5 3 Carlos 2 4Ana 3 5 María 4 6 Mario 0 I want: name index 1 Juan 1 2 Juan 5 3 Carlos 2 4Ana 3

Re: [R] Help

2010-05-17 Thread David Winsemius
Please read the Posting Guide. Several of your questions will get answered, including why the attachment did not arrive at any of out mail clients. We are having some difficulty understanding why you say your lecturer "didn't teach us anything about how to use R". It appears from the mang

Re: [R] Help

2010-05-17 Thread Duncan Murdoch
On 17/05/2010 9:07 AM, APOLLOCHEROKEE wrote: > Dear Sir or Madam:Hi,sorry for disturbing you. Currently, I'm a > master student, and my lecturer didn't teach us anything about how to use R. > But the assignment is all about R. So even a very stupid error,I still can't > tell. So please f

Re: [R] packages on R 2.11

2010-05-17 Thread Ivan Calandra
Thank you David! Le 5/17/2010 15:10, David Winsemius a écrit : On May 17, 2010, at 8:07 AM, Ivan Calandra wrote: Dear users, I've noticed some time ago that some of the packages I use (especially doBy) could not run (yet) on R 2.11. So I kept on using R 2.10. But I think it should be fin

[R] Help with RandomForest

2010-05-17 Thread Steve_Friedman
I'm working with the randomForest package and have successfully build a model. I'd like to go one step further however, and use the output from the model to construct a map using the output. My input data are spatial, and I have an independent set of rasterize maps for each of the predictor vari

Re: [R] retrieving last R output

2010-05-17 Thread baptiste auguie
Hi, Try this, saveMyWork <- .Last.value HTH, baptiste On 17 May 2010 15:07, math_daddy wrote: > > Hello. > > I ran a simulation that took a few days to complete, and want to analyze the > results, but have just realized that I (idiotically) did not assign the > output to a variable when I int

Re: [R] retrieving last R output

2010-05-17 Thread Henrique Dallazuanna
See .Last.value On Mon, May 17, 2010 at 10:07 AM, math_daddy wrote: > > Hello. > > I ran a simulation that took a few days to complete, and want to analyze > the > results, but have just realized that I (idiotically) did not assign the > output to a variable when I intitiated the simulation. Is

Re: [R] To correct an error message

2010-05-17 Thread David Winsemius
On May 17, 2010, at 8:22 AM, Moohwan Kim wrote: Dear R Family, I have an error message. I would like to learn how to deal with that. The orginal series is as follows: I just pick up the first 10 observations. [1:10] [1] 0.0065880493 -0.0065880490 -0.0131743570 0.0197745715 0.0065889175

[R] looking for Variable selections models, techniques, methods

2010-05-17 Thread mauede
We still have a long way to go with the data we were given by some drug discovery scientists. The problem is to select the few variables (Collective Variables), from a set of variables sampled during a Molecular Dynamics simulation, which exhibit a consistent and coherent relationship with the

[R] retrieving last R output

2010-05-17 Thread math_daddy
Hello. I ran a simulation that took a few days to complete, and want to analyze the results, but have just realized that I (idiotically) did not assign the output to a variable when I intitiated the simulation. Is there any way to retrieve the last output produced by R so that these last few days

[R] Help

2010-05-17 Thread APOLLOCHEROKEE
Dear Sir or Madam:Hi,sorry for disturbing you. Currently, I'm a master student, and my lecturer didn't teach us anything about how to use R. But the assignment is all about R. So even a very stupid error,I still can't tell. So please forgive my innocence. The following is the requiremen

  1   2   >