Re: [R] Serial Date

2011-03-15 Thread Raoni Rosa Rodrigues
Hello Mr. Allan and Mr. David! Thanks very much for your time and lessons. Works pretty well, Mr. Allan, specially after Mr. David explanation (and the 2 days-bug correction). Just a curious behavior of data tranformation: the R-transformation date was 2min and 20s late compared with excel

[R] sample size of 2 groups of skewed data

2011-03-15 Thread Lao Meng
Hi all: I have a question on sample size calculation of 2 groups of data. If 2 groups of data are all normal distribution, then I can use the function n.indep.t.test.eq from samplesize package.But if 2 groups of data are all skewed distribution, but not normal distribution,how can I calculate the

Re: [R] data.frame transformation

2011-03-15 Thread andrija djurovic
Thank you Bill for this additional solution. Andrija On Tue, Mar 15, 2011 at 12:16 AM, bill.venab...@csiro.au wrote: It is possible to do it with numeric comparisons, as well, but to make life comfortable you need to turn off the warning system temporarily. df - data.frame(q1 =

Re: [R] Speed up sum of outer products?

2011-03-15 Thread AjayT
Hi Dennis, sorry for the delayed reply and thanks for the article. I digged into it and found that if you have a GPU, the CUBLAS library beats the BLAS/ATLAS implementation in the Matrix package for 'large' problems. Here's what I mean, its = 2500 dim = 1750 X = matrix(rnorm(its*dim),its, dim)

[R] Finding coordinates for maximum of a function

2011-03-15 Thread derek
Hello R, I have data in txt file of n columns like this: x y1 .yn 1 100 2 50 3 10 4 200 5 20 I need to find coordinates for each maxima e.g.: [x,y1],[x,y2]...[x,yn] a=read.table() attach(a) b=y1-x max(b) returns only value of y but no corresponding x value -- View this message in

[R] No Support for plot=F in plclust()

2011-03-15 Thread alanm (Alan Mitchell)
Hello all, I am working on converting a set of S+ functions to R. Can anyone tell me how to extract data from an hclust or dendrogram object in R that is similar to that generated by P1 = plclust(tree, plot=F) Any suggestions would be appreciated. Alan Mitchell, MSc

[R] Question re estimating SE for interquantile regression coefficients

2011-03-15 Thread S Liu
Hi, I am a student new to R.  I would like to estimate the standard error for the difference in interquantile regression coefficients after but do not know how to do so.  For each quantile I estimated the regression coefficent, bootstrapped for the SE and saved the coefficient and then take

[R] Pointwise division of two zoo objects?

2011-03-15 Thread Adam Gustafson
Just trying to create returns from prices, and do something like: returns.z = tail(prices.z,-1)/head(prices.z,-1) - 1 # should be equivalent to returns = exp(diff(log(prices.z))) - 1 Curiously, I get a zoo object back with zeros everywhere and also with the index having one fewer element than

Re: [R] Finding coordinates for maximum of a function

2011-03-15 Thread nblarson
This is where which.max() comes in handy n-length(x) x.c-rep(0,n) for(i in 1:n){ x.c[i]-which.max[y1] } x.c is then a vector of x coordinates for the maximum for columns y1,y2,...,yn -- View this message in context:

[R] Data Frame Variable Names

2011-03-15 Thread Indrajit Chatterjee
Hi, I have created a dataframe (lets call is df) that contains the following variables Dependent1 Dependent2 Dependent3 Independent1 I want to do the following regressions: z- glm( df$Dependent1 ~ df$Independent1) z- glm( df$Dependent2 ~ df$Independent1) z- glm( df$Dependent3 ~

[R] How to make sure R's g++ compiler uses certain C++ flags when making a package

2011-03-15 Thread Solomon Messing
I am trying to use some code from opencv in an r package, using Rcpp to build the package. When I compile the c code on my machine, it works fine. However, when I try to include it in my package, it gives me a bunch of error messages like: error: opencv2/core/operations.hpp: No such file or

Re: [R] AOV() may misslabel random effects.

2011-03-15 Thread Tyler Rinker
Mr. Giles Crane, I am new to R (only a month in). My response is as best as I understand the workings of R (so if I'm wrong more experienced people plese help me out). AOV is not really appropriate for an unbalanced model. This is where you can rely on the lm() function using these steps:

[R] install.packages barfs on dependencies= argument

2011-03-15 Thread Allan Engelhardt
I'm sure I used to be able to do my.dependencies- c(Depends, Imports, LinkingTo, Suggests, Enhances) install.packages(animation, lib = Sys.getenv(R_LIBS_USER), dependecies = my.dependencies) but now I get Error in download.file(url, destfile, method, mode = wb, ...) : unused argument(s)

Re: [R] Data Frame Variable Names

2011-03-15 Thread Gerrit Eichner
Hello, Indrajit, a quick and dirty solution could be to loop over the names of the relevant variables of the data frame (in your case over the first three variables) and use [[ ]] for indexing: for (i in names( df)[ 1:3]) { z - glm( df[[ i]] ~ df$Independent1) print( z) } An output

Re: [R] install.packages barfs on dependencies= argument

2011-03-15 Thread Jim Lemon
On 03/15/2011 06:57 PM, Allan Engelhardt wrote: I'm sure I used to be able to do ... unused argument(s) (dependecies = c(Depends, Imports, LinkingTo, check the spelling. Jim __ R-help@r-project.org mailing list

[R] binary exogenous variable in path analysis in sem or lavaan

2011-03-15 Thread Rob Knell
Hello all I'm trying to run some path analysis in either sem or lavaan (preferably lavaan because I find its interface easier to use). Most of my variables are continuously distributed and fairly well-behaved but I have a single exogenous variable (sex) which is not continuously distributed.

Re: [R] install.packages barfs on dependencies= argument

2011-03-15 Thread Allan Engelhardt
Groan! Thanks. New baby mean no sleep. I'll make some more coffee. Allan On 15/03/11 08:18, Jim Lemon wrote: On 03/15/2011 06:57 PM, Allan Engelhardt wrote: I'm sure I used to be able to do ... unused argument(s) (dependecies = c(Depends, Imports, LinkingTo, check the spelling. Jim

Re: [R] Serial Date

2011-03-15 Thread Allan Engelhardt
On 14/03/11 16:00, David Winsemius wrote: On Mar 14, 2011, at 6:36 AM, Allan Engelhardt wrote: On 14/03/11 02:00, Raoni Rosa Rodrigues wrote: [...] I'm working in a project with a software that register date and time data in serial time format. This format is used by excel, for exemple. In

Re: [R] Pointwise division of two zoo objects?

2011-03-15 Thread Kenn Konstabel
Hi, returns.z = tail(prices.z,-1)/head(prices.z,-1) - 1 # should be equivalent to returns = exp(diff(log(prices.z))) - 1 Curiously, I get a zoo object back with zeros everywhere and also with the index having one fewer element than it should. Does anyone know how to pointwise divide zoo

Re: [R] Finding the name vector

2011-03-15 Thread Allan Engelhardt
On 15/03/11 05:17, Joshua Wiley wrote: Hi Laura, ?is.vector Consider methods::is if you might ever use attributes: x- 1:10 is.vector(x) # [1] TRUE comment(x)- Mine! is.vector(x) # [1] FALSE is(x, vector) # [1] TRUE Allan __ R-help@r-project.org

[R] graph lines don;t appear

2011-03-15 Thread Sara Szeremeta
Hi I am trying to plot two simple graphs with a grid in background. The axis and grid appears in correct position, but the actual data are not there Can somebody provide me a hint what is missing? The code is: pln - read.table(file=PLN.txt, header=TRUE, dec=,) par(mfrow=c(1,2))

Re: [R] Speed up sum of outer products?

2011-03-15 Thread Stefan Evert
Hi Ajay, thanks for this comparison, which prodded me to give CUDA another try on my now somewhat aging MacBook Pro. Hi Dennis, sorry for the delayed reply and thanks for the article. I digged into it and found that if you have a GPU, the CUBLAS library beats the BLAS/ATLAS implementation in

Re: [R] graph lines don;t appear

2011-03-15 Thread Philipp Pagel
On Tue, Mar 15, 2011 at 12:01:45PM +0100, Sara Szeremeta wrote: Hi I am trying to plot two simple graphs with a grid in background. The axis and grid appears in correct position, but the actual data are not there Can somebody provide me a hint what is missing? The code is: pln -

[R] Persistent storage between package invocations

2011-03-15 Thread Hadley Wickham
Hi all, Does anyone have any advice or experience storing package settings between R runs? Can I rely on the user's home directory (e.g. tools::file_path_as_absolute(~)) to be available and writeable across platforms? Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of

[R] model fine, predict gives an error

2011-03-15 Thread Antje Niederlein
Hi there, I try to model some dose response curves (drc-package). In most cases it is fine but now I got some data which produces me the following error: load(drmData.RData) library(drc) drmObj - drm(value ~ concentration, cmpd_respvar, data = drmData, fct = LL.4()) predict(drmObj) Error in

Re: [R] Cox model, model averaging and survival curve

2011-03-15 Thread Terry Therneau
--- included text -- I have done model selection between candidate Cox models, using AICc calculated with penalized log likelihoods. Then model averaging was done to obtain model averaged parameter estimates. Is there a way to plot survival curve from the averaged model, by estimating baseline

Re: [R] color under lm line

2011-03-15 Thread Dieter Menne
Marlin Keith Cox wrote: Thank you, but I need only the area under the llm colored. What if there were two lm lines? For the well-behaved case you could find the range to be colored with range = which(diff(resid(llm)0)!=0) Dieter x=seq(0,5,len=100) y=-(x-5)^2 llm-lm(y~x) range =

[R] precompiled ode with spline input

2011-03-15 Thread Daniel Kaschek
I tried to use lsode with precompiled C code instead of an R function defining the derivatives. No problem so far. However, now I need to implement an ODE that contains spline functions, i.e. the derivatives at given time points depend on the value of a spline function at this time point. What is

[R] ML estimation of a two-sided truncated regression model

2011-03-15 Thread Albrecht Kauffmann
Hi all, I have a question regarding the estimation of a two-sided truncation regression model using maximum likelihood estimation. I want to estimate a linear model where the dependent variable  is greater 0 and upper truncated at 1. Does anyone know a R-package that contains a routine that could

Re: [R] Pointwise division of two zoo objects?

2011-03-15 Thread Gabor Grothendieck
On Mon, Mar 14, 2011 at 10:16 PM, Adam Gustafson am...@uw.edu wrote: Just trying to create returns from prices, and do something like: returns.z = tail(prices.z,-1)/head(prices.z,-1) - 1  # should be equivalent to returns = exp(diff(log(prices.z))) - 1 Curiously, I get a zoo object back with

Re: [R] Finding coordinates for maximum of a function

2011-03-15 Thread derek
It occured to me: x[max(y)] simple isn't it? -- View this message in context: http://r.789695.n4.nabble.com/Finding-coordinates-for-maximum-of-a-function-tp3355369p3356117.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Finding coordinates for maximum of a function

2011-03-15 Thread nblarson
That actually won't work. max(y) will give a value, not a coordinate, so x[max(y)] is definitely not what you want. -- View this message in context: http://r.789695.n4.nabble.com/Finding-coordinates-for-maximum-of-a-function-tp3355369p3356483.html Sent from the R help mailing list archive at

[R] Newbie-ish question on iteratively applying function to dataframe

2011-03-15 Thread Claus O'Rourke
Hi, I am trying to recursively apply a function to a selection of columns in a dataframe. I've had a look around and from what I have read, I should be using some version of the apply function, but I'm really having some headaches with it. Let me be more specific with an example. Say I have a

[R] Changing colour of continuous time-series in ggplot2

2011-03-15 Thread joeP
Hi, This seems like there should be a simple answer, but having spent most of the day trying to find it, I'm becoming less convinced and as such am asking it here. Here's a sub-set of my data (a data.frame in R): myDF time value trial 1 2011-03-01

[R] run a slef-written function

2011-03-15 Thread bra86
How could one get started with a self-written function? I have a function written in .txt format, but can not find the way to import it to the R space. Would be very appreciated for help. -- View this message in context:

[R] (no subject)

2011-03-15 Thread Jonathan P Daily
I was wondering if there is a way to get read in a single keystroke at a time in R as a string, akin to ncurses-style interfaces. I looked into readLines, readChar, etc. using stdin, but these all require the use of an end of line. Has anyone ever had need to do this or have any ideas on how

Re: [R] Serial Date

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 2:17 AM, Raoni Rosa Rodrigues wrote: Hello Mr. Allan and Mr. David! Thanks very much for your time and lessons. Works pretty well, Mr. Allan, specially after Mr. David explanation (and the 2 days-bug correction). Just a curious behavior of data tranformation: the

Re: [R] (no subject)

2011-03-15 Thread Bert Gunter
?strsplit x - ThisIsaString y- strsplit(x,) This gives a list, which you can convert to a vector by unlist(y) Incidentally, you could have found out about strsplit via R's help.search(character string) (or similar) or even googling R string function . Please use R's native Help capabilities

Re: [R] Finding coordinates for maximum of a function

2011-03-15 Thread Bert Gunter
Right. ?which.max is what's needed. -- Bert On Tue, Mar 15, 2011 at 6:00 AM, nblarson nblar...@gmail.com wrote: That actually won't work.  max(y) will give a value, not a coordinate, so x[max(y)] is definitely not what you want. -- View this message in context:

[R] indeterminate for loop

2011-03-15 Thread lm609
Hello, I have written a 'for' loop which on the first run makes nearest neighbour calculations for my dataset 'A' in relation to dataset 'B', then based on these results, some of the rows from A are moved into dataset B, and the calculation is repeated on the remaining rows in A. Therefore a

[R] Table multiple answers variables

2011-03-15 Thread Orvalho Augusto
I have a dataset like this: q25_1 q25_2 q25_3 q25_4 q25_5 q25_6 q25_7 q25_8 q25_9 q25_10 q25_11 q25_12 1 2 2 1 1 2 1 2 1 1 2 1 3 2 2 2 2 1 2 1 2 1 1 2 1 2 3 2 1 1 1 2

Re: [R] Table multiple answers variables

2011-03-15 Thread Henrique Dallazuanna
Try this: data.frame(count = colSums(x == 1), percentage = colSums(x == 1) / nrow(x)) On Tue, Mar 15, 2011 at 11:13 AM, Orvalho Augusto orvaq...@gmail.comwrote: I have a dataset like this: q25_1 q25_2 q25_3 q25_4 q25_5 q25_6 q25_7 q25_8 q25_9 q25_10 q25_11 q25_12 1 2 2 1

Re: [R] Table multiple answers variables

2011-03-15 Thread Dimitris Rizopoulos
try the following: DF - as.data.frame(matrix(sample(2, 120, TRUE), 10, 12)) Results - data.frame( var = names(DF), count = colSums(DF == 1), percentage = colMeans(DF == 1) ) I hope it helps. Best, Dimitris On 3/15/2011 3:13 PM, Orvalho Augusto wrote: I have a dataset like

Re: [R] Serial Date

2011-03-15 Thread Gabor Grothendieck
On Sun, Mar 13, 2011 at 10:00 PM, Raoni Rosa Rodrigues raonir...@yahoo.com.br wrote: Hello R Help, I'm working in a project with a software that register date and time data in serial time format. This format is used by excel, for exemple. In this format, 40597.3911423958 is 2011/2/23

Re: [R] Keyboard Input

2011-03-15 Thread Jonathan P Daily
I apologize for being unclear in my original post. What I am trying to achieve is to capture the stdin() connection and read in a single keystroke - including arrow keys and the like - without having to have to use the return key each time. My goal is to create a small UI for rapidly looking

Re: [R] Serial Date

2011-03-15 Thread Gabor Grothendieck
On Tue, Mar 15, 2011 at 10:24 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sun, Mar 13, 2011 at 10:00 PM, Raoni Rosa Rodrigues raonir...@yahoo.com.br wrote: Hello R Help, I'm working in a project with a software that register date and time data in serial time format. This format

Re: [R] Keyboard Input

2011-03-15 Thread Gabor Grothendieck
On Tue, Mar 15, 2011 at 10:29 AM, Jonathan P Daily jda...@usgs.gov wrote: I apologize for being unclear in my original post. What I am trying to achieve is to capture the stdin() connection and read in a single keystroke - including arrow keys and the like - without having to have to use the

Re: [R] indeterminate for loop

2011-03-15 Thread Jonathan P Daily
?while You don't want a for loop. You need a while loop. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have

Re: [R] Keyboard Input

2011-03-15 Thread Jonathan P Daily
Solved. Thanks. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it.

Re: [R] Table multiple answers variables

2011-03-15 Thread Orvalho Augusto
This is! Thank you everyone. Caveman On Tue, Mar 15, 2011 at 4:24 PM, Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: try the following: DF - as.data.frame(matrix(sample(2, 120, TRUE), 10, 12)) Results - data.frame( var = names(DF), count = colSums(DF == 1), percentage

Re: [R] run a slef-written function

2011-03-15 Thread Sarah Goslee
source(myfunction.R) is the usual approach. You could also just copy your code and paste it into the R console. Sarah On Tue, Mar 15, 2011 at 9:21 AM, bra86 anastasia.krikovts...@tugraz.at wrote: How could one get started with a self-written function? I have a function written in .txt format,

Re: [R] run a slef-written function

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 9:21 AM, bra86 wrote: How could one get started with a self-written function? I have a function written in .txt format, but can not find the way to import it to the R space. Would be very appreciated for help. It would be more typical to use a file extension of .r but

[R] create data set from selection of rows

2011-03-15 Thread e-letter
Readers, For a data set: text1,23,text2,45 text1,23,text3,78 text1,23,text3,56 text1,23,text2,45 The following command was entered: datasubset-data.frame(dataset[,3]==text3) The result of datasubset is TRUE TRUE The required result is text1,23,text3,78 text1,23,text3,56 What is the

Re: [R] Changing colour of continuous time-series in ggplot2

2011-03-15 Thread Hadley Wickham
You need to specify the group aesthetic - that defines how observations are grouped into instances of a geom. Hadley On Tue, Mar 15, 2011 at 8:37 AM, joeP joseph.parr...@bt.com wrote: Hi, This seems like there should be a simple answer, but having spent most of the day trying to find it, I'm

Re: [R] indeterminate for loop

2011-03-15 Thread lm609
Thanks! I've never come across 'while' before and it's perfect. On Mar 15 2011, Jonathan P Daily wrote: ?while You don't want a for loop. You need a while loop. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville

Re: [R] sample size of 2 groups of skewed data

2011-03-15 Thread Kjetil Halvorsen
did you try to fit your data with a skew-normal/skew-t distribution? If that works, you can use simulation. Kjetil On Tue, Mar 15, 2011 at 2:31 AM, Lao Meng laomen...@gmail.com wrote: Hi all: I have a question on sample size calculation of 2 groups of data. If 2 groups of data are all normal

[R] Calculate monthly means

2011-03-15 Thread Carl Nim
I am trying to calculate monthly means by year of phosphates and nitrates from a multi year data set. Can anybody help me out with the most effective way to do this? My data looks like this: Collection_Date   Test.Name  Value 2000-01-24 17:00:00    Phosphate 

Re: [R] JAGS/BUGS on gene expression data

2011-03-15 Thread nblarson
64 Bit R w/JAGS seems to be stalling out as well, I ran a test run of 100 iterations and it's been hanging for 8 hours so that doesn't seem to be the solution. I'll take a look at PYMC. That CppBUGS package looks pretty interesting, I'll keep my eye on it. My C programming book arrives today

Re: [R] regsubsets() [leaps package] - please share some good examples of use

2011-03-15 Thread agent dunham
Does it mean that regsubsets doesn't work with categorical variables? It's because I'm trying the following and I don't know what happens. Any help would be appreciated. varin - data.frame(v1,v2,...,v7, factor1,..., factor4) Dependent variable: height Then: eu.subsets - regsubsets(varinc ,

Re: [R] run a slef-written function

2011-03-15 Thread Scott Chamberlain
you could run source(directory/textfilename.txt) [and then you can use it in R] or paste the function into the console, or highlight and pass the function from the built in R text editor, or highlight and pass the function from your external text editor (notepad++, emacs, textwrangler, etc.)

[R] Polynomial regression problem

2011-03-15 Thread Matthew McKinney
I have just started using R so forgive me if this question is very simple. I have a data set (in a data frame called dm) that looks like this x (Cells)y(males) 1 0 2 2 3 7 4 12 5 12 6 19 7 22 8 23 9 25 10 23 11 23 12 11 13

[R] Does R have a const object?

2011-03-15 Thread xiagao1982
Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! xiagao1982 2011-03-15 [[alternative HTML version deleted]] __

[R] Fill vector more efficient than element by element?

2011-03-15 Thread beatleb
Dear R useRs, I am a newbie. Currently, my script is quick long, therefor I am trying to improve the efficiency of my script. I use often a version of the following code, the script below is just a simple example, but I especially try to improve the last three lines: matrix1-diag(100) a=2

[R] RE : run a slef-written function

2011-03-15 Thread Wolfgang RAFFELSBERGER
?source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wolfgang Raffelsberger, PhD IGBMC, 1 rue Laurent Fries, 67404 Illkirch Strasbourg, France wolfgang.raffelsberger (at) igbmc.fr De : r-help-boun...@r-project.org

Re: [R] create data set from selection of rows

2011-03-15 Thread nblarson
Try using which() Something like data.frame(dataset[which(dataset[,3]==text3),]) e-letter wrote: Readers, For a data set: text1,23,text2,45 text1,23,text3,78 text1,23,text3,56 text1,23,text2,45 The following command was entered: datasubset-data.frame(dataset[,3]==text3) The

[R] Problem with nls.lm function of minpack.lm package.

2011-03-15 Thread Yann Périard Larrivée
Dear R useRs, I have a problem with nls.lm function of minpackl.lm package. I need to fit the Van Genuchten Model to a set of data of Theta and hydraulic conductivity with nls.lm function of minpack.lm package. For the first fit, the parameter estimates keep changing even after 1000

Re: [R] create data set from selection of rows

2011-03-15 Thread Mohamed Lajnef
Hi, Le 15/03/11 16:09, e-letter a écrit : Readers, For a data set: text1,23,text2,45 text1,23,text3,78 text1,23,text3,56 text1,23,text2,45 The following command was entered: datasubset-data.frame(dataset[,3]==text3) datasubset-subset(dataset,dataset[,3]==text3) The result of

Re: [R] create data set from selection of rows

2011-03-15 Thread Francisco Gochez
Hi, What you are after is: datasubset - dataset[ dataset[,3] == text3, ] Equivalently, you can use: datasubset - subset(dataset, subset = dataset[,3] == text3) HTH, Francisco On Tue, Mar 15, 2011 at 3:09 PM, e-letter inp...@gmail.com wrote: Readers, For a data set: text1,23,text2,45

Re: [R] Newbie-ish question on iteratively applying function to dataframe

2011-03-15 Thread Ista Zahn
Hi Claus, On Tue, Mar 15, 2011 at 9:33 AM, Claus O'Rourke claus.orou...@gmail.com wrote: Hi, I am trying to recursively apply a function to a selection of columns in a dataframe. I've had a look around and from what I have read, I should be using some version of the apply function, but I'm

[R] How to read only specified columns from a data file

2011-03-15 Thread Luis Ridao
R-help, I'm trying to read a data file with plenty of columns. I just need the first 5 but it doe not work by doing something like: mycols - rep(NULL, 430) ; mycols[c(1:4)] - NA read.table(myfile, skip=2, colClasses=mycols) Any suggestions? Thanks in advance

Re: [R] Persistent storage between package invocations

2011-03-15 Thread Prof Brian Ripley
On Tue, 15 Mar 2011, Hadley Wickham wrote: Hi all, Does anyone have any advice or experience storing package settings between R runs? Can I rely on the user's home directory (e.g. tools::file_path_as_absolute(~)) to be available and writeable across platforms? No. First, please use

Re: [R] color under lm line

2011-03-15 Thread Eik Vettorazzi
Hi Keith, how about this: fit-function(x,coefs) x*coefs[2]+coefs[1] plot(1:10,1:10,type=n) x-par(usr)[1:2] cf1-c(a=3,b=.5) #eg coefs from a lm-object cf2-c(a=1,b=.9) #another line, coloring only intersection polygon(c(x,rev(x)),c(fit(x,cf1),fit(rev(x),cf2)),col=red) setting one of the coef

[R] fitting a distribution to a ecdf plot

2011-03-15 Thread Lathouri, Maria
Dear all, I need to plot an cumulative distribution plot of a variable and then to fit a distribution to that, probably a weibull or lognormal. I have plotted the ecdf as plot(ecdf(x)) but I haven't managed to fit the distribution. I have as well attached the data. I would appreciate if you

Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 12:00 PM, Lathouri, Maria wrote: Dear all, I need to plot an cumulative distribution plot of a variable and then to fit a distribution to that, probably a weibull or lognormal. I have plotted the ecdf as plot(ecdf(x)) but I haven't managed to fit the distribution. I

Re: [R] JAGS/BUGS on gene expression data

2011-03-15 Thread Mark Leeds
hi: you also may want to look at the admit package. it does metropolis hastings using a weighted mixture of t-distributions so you just need to write a function for the likelihood you're trying to get the parameters for. I don't know about it's speed or efficiency for large data sets but you could

Re: [R] Calculate monthly means

2011-03-15 Thread Daniel Kaschek
On Tue, 2011-03-15 at 07:24 -0700, Carl Nim wrote: I am trying to calculate monthly means by year of phosphates and nitrates from a multi year data set. Can anybody help me out with the most effective way to do this? My data looks like this: Collection_Date Test.Name Value 2000-01-24

Re: [R] Problem with nls.lm function of minpack.lm package.

2011-03-15 Thread Ravi Varadhan
One things you should do, as Kate suggested, is to check whether the Jacobian functiions are correctly code. You can do this with numDeriv package: require(numDeriv) ?jacobian Compare the jacobian from numDeriv with your jacobian for a few reasonable parameter vectors. Ravi.

Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread Lathouri, Maria
Actually I have already done a search on that but it was not much of a help. That is why I posted it in the r-help in case it was much more helpful. Thank you. Kind regards Maria From: David Winsemius [dwinsem...@comcast.net] Sent: 15 March 2011 16:19

Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 12:23 PM, Lathouri, Maria wrote: Actually I have already done a search on that but it was not much of a help. That is why I posted it in the r-help in case it was much more helpful. There is a tutorial by Ricci with the exact title I suggested looking for. At the

Re: [R] fitting a distribution to a ecdf plot

2011-03-15 Thread Carlos Ortega
Hi, One easy way to do that is by using the nls (nonlinear least square) library. Basically you will test with that if your distribution can be adjusted to the distribution you say it matches (Weibull?) through the adjustment of some parameters. The base package includes the nls library, but

Re: [R] (no subject)

2011-03-15 Thread rex.dwyer
Hi Jon, I read your question differently. Is the answer? - Rex ch=scan(stdin(),what=character(0),n=1) 1: f Read 1 item ch [1] f -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Tuesday, March 15, 2011 10:09

Re: [R] How to read only specified columns from a data file

2011-03-15 Thread rex.dwyer
I think you need to read an introduction to R. For starters, read.table returns its results as a value, which you are not saving. The probable answer to your question: Read the whole file with read.table, and select columns you need, e.g.: tab - read.table(myfile, skip=2)[,1:5] -Original

Re: [R] How to read only specified columns from a data file

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 1:11 PM, rex.dw...@syngenta.com wrote: I think you need to read an introduction to R. For starters, read.table returns its results as a value, which you are not saving. The probable answer to your question: Read the whole file with read.table, and select columns you

Re: [R] Calculate monthly means

2011-03-15 Thread KATSCHKE, ADRIAN CIV DFAS
You could use the by() function after a little data manipulation. The first line will create a field just of the date portion of your datetime field. Then you can use the by() function to use the indices you desire to calculate the mean. mSamp$cDT -

Re: [R] Does R have a const object?

2011-03-15 Thread Uwe Ligges
On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! Although there is almost never a No in R, the best short answer is: No. Best, Uwe

Re: [R] Does R have a const object?

2011-03-15 Thread Duncan Murdoch
On 15/03/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! Although there is almost never a No in

Re: [R] Persistent storage between package invocations

2011-03-15 Thread Henrik Bengtsson
It would be nice to have a standard directory where R can write things this way. A semi-standard directory is given by Sys.getenv(R_LIBS_USER), which defaults to ~/R/.../. Maybe ~/R/ could serve as that convention? That way we (various developers etc) would also not clutter up users home

Re: [R] Does R have a const object?

2011-03-15 Thread Martin Morgan
On 03/15/2011 11:34 AM, Duncan Murdoch wrote: On 15/03/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally.

Re: [R] Does R have a const object?

2011-03-15 Thread Gabor Grothendieck
On Tue, Mar 15, 2011 at 10:53 AM, xiagao1982 xiagao1...@gmail.com wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! LockBinding will prevent a variable from being

[R] Help on 'object(s) are masked from 'package:base

2011-03-15 Thread YAddo
Dear All: I am a newbie to R. I am trying to use the lmsqreg.fit pack, although I have installed(I think) it I am not able to invoke it when write the code for it. Here's what I got when I installed it. package 'lmsqreg' successfully unpacked and MD5 sums checked And here is what I got

[R] Reporting odds ratios or risk ratios from GLM

2011-03-15 Thread lafadnes
I am a new R user (am using it through the Rcmdr package) and have struggled to find out how to report OR and RR directly when running GLM models (not only reporting coefficients.) Example of the syntax that I have used: GLM.2 - glm(diarsev ~ treatmentarm +childage +breastfed,

Re: [R] Does R have a const object?

2011-03-15 Thread Uwe Ligges
On 15.03.2011 19:35, Martin Morgan wrote: On 03/15/2011 11:34 AM, Duncan Murdoch wrote: On 15/03/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to

Re: [R] Reporting odds ratios or risk ratios from GLM

2011-03-15 Thread Aaron Mackey
OR - exp(coef(GLM.2)[-1]) OR.ci - exp(confint(GLM.2)[-1,]) -Aaron On Tue, Mar 15, 2011 at 1:25 PM, lafadnes ubu...@fadnes.net wrote: I am a new R user (am using it through the Rcmdr package) and have struggled to find out how to report OR and RR directly when running GLM models (not only

Re: [R] Reporting odds ratios or risk ratios from GLM

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 1:25 PM, lafadnes wrote: I am a new R user (am using it through the Rcmdr package) and have struggled to find out how to report OR and RR directly when running GLM models (not only reporting coefficients.) Example of the syntax that I have used: GLM.2 - glm(diarsev ~

Re: [R] Help on 'object(s) are masked from 'package:base

2011-03-15 Thread David Winsemius
On Mar 15, 2011, at 1:03 PM, YAddo wrote: Dear All: I am a newbie to R. I am trying to use the lmsqreg.fit pack, although I have installed(I think) it I am not able to invoke it when write the code for it. Here's what I got when I installed it. package 'lmsqreg' successfully unpacked

[R] Bug in lattice auto.key argument

2011-03-15 Thread JLucke
The Lattice auto.key argument has a bug in R.12.2. R version 2.12.2 (2011-02-25) Platform: i386-pc-mingw32/i386 (32-bit) other attached packages: [1] lattice_0.19-17 loaded via a namespace (and not attached): [1] grid_2.12.2 If I set up my plot parameters as require(lattice)

[R] Matching two vectors

2011-03-15 Thread Vincy Pyne
Dear R helpers Suppose I have a vector as vect_1 = c(AAA, AA, A, BBB, BB, B, CCC) vect_1_id = c(1:length(vect_1)) Through some process I obtain vect_2_id = c(2, 3, 7), then I need a new vector say vect_2 which will give me vect2 = (AA, A, CCC)  i.e. I need the subset of vect_1 as per

Re: [R] Matching two vectors

2011-03-15 Thread Sarah Goslee
vect_1[vect_2_id] and perhaps a readthrough of some of the very nice intro to R materials available online. Sarah On Tue, Mar 15, 2011 at 3:41 PM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers Suppose I have a vector as vect_1 = c(AAA, AA, A, BBB, BB, B, CCC) vect_1_id =

[R] Element by element mean of a list of matrices

2011-03-15 Thread hihi
Hi All, is there any effiective and dense/compact method to calculate the mean of a list of - of course coincident - matrices on an element by element basis? The resulting matrix' [i, j]-th element is the mean of the list's matrices' [i, j]-th elements respectively... Iterating by for statement

Re: [R] Element by element mean of a list of matrices

2011-03-15 Thread Claudia Beleites
Peter, as the matrices in the list have the same shape, you can unlist them into an array and then use rowMeans. HTH Claudia Am 15.03.2011 21:17, schrieb hihi: Hi All, is there any effiective and dense/compact method to calculate the mean of a list of - of course coincident - matrices on

  1   2   >