[R] About GAM in R, Need YOUR HELP!

2011-06-20 Thread pigpigmeow
I'm beginner in R! I have a lot of problems on R. I have three questions about GAM 1. What is the function of Gaussian distribution in GAM?(if I choose family is Gaussian) Is it used in the predictand value (Y)? 2. How to plot a graph the gam function? For example:

[R] “foreach” loop : Using all cores in R (especially if we are sending sql queries inside foreach loop)

2011-06-20 Thread Rajesh K
Hi, I intend to use foreach to uitlize all the cores in my CPU. The catch is i need to send a sql query inside the loop. The script is working fine with normal 'for' loop, but it is giving following error when i change it to 'foreach'. The error is : select: Interrupted system call select:

[R] [R-pkgs] ODB : connecting OpenOffice Base with R

2011-06-20 Thread Sylvain Mareschal
The recently released ODB package was developped to manage HSQL databases embedded in .odb files (the default when creating a database with OpenOffice Base) via R. BRIEFLY The goal of this package is to access OpenOffice databases via R, to process data stored in it or to automatize their

Re: [R] how to get the miminum value in the list

2011-06-20 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.06.2011 20:45:04: Hi: It's just an extra step: y - list(list(c(1,5),c(2,3,4)), list(c(1, 3, 4), c(5, 7))) lapply(seq_len(length(y)), function(i) lapply(y[[i]], min)) [[1]] [[1]][[1]] [1] 1 [[1]][[2]] [1] 2 [[2]] [[2]][[1]] [1] 1

Re: [R] save and load in R

2011-06-20 Thread Ivan Calandra
Hi, Check also saveObject() and loadObject() from R.utils: library(R.utils) outfilenames- paste (./file, 1:numFiles, '.Rbin', sep=) for ( i in 1:10) { dataFile = read.table (filenames[i], header=TRUE, sep='\t'); saveObject (dataFile, file = outfilenames[i]) } And then: file1 = loadObject

[R] Replace selected columns of a dataframe with NA

2011-06-20 Thread Chris Beeley
I am using the following command to replace all the missing values and assorted typos in a dataframe with NA: mydata[mydata80]=NA The problem is that the first column contains values which should be more than 80, so really I want to do it just for mydata[,2:length(mydata)] I can't seem to

Re: [R] analysis with the data from mysql database

2011-06-20 Thread Steven Kennedy
Please tell us the package you are using and the specific commands. It is most likely you are retrieving the data into a list or some other structure that hist() doesn't like. On Mon, Jun 20, 2011 at 12:57 PM, amrita gs ammasamri...@gmail.com wrote: Hi everyone,     I have certain values

Re: [R] analysis with the data from mysql database

2011-06-20 Thread Jim Holtman
at least provide a sample of the data. It sounds like you have 'factors' as your data. Do an 'str' of your dataframe that was returned. Sent from my iPad On Jun 19, 2011, at 22:57, amrita gs ammasamri...@gmail.com wrote: Hi everyone, I have certain values retrieved from mysql

[R] Odp: Replace selected columns of a dataframe with NA

2011-06-20 Thread Petr PIKAL
Hi I am using the following command to replace all the missing values and assorted typos in a dataframe with NA: mydata[mydata80]=NA The problem is that the first column contains values which should be more than 80, so really I want to do it just for mydata[,2:length(mydata)] I

Re: [R] Replace selected columns of a dataframe with NA

2011-06-20 Thread Dimitris Rizopoulos
I don't know if you have factors in your data frame, but in any case, you can try the following approach: mydata - data.frame(id = 1:10, x = rnorm(10, 80), z = rnorm(10, 80), w = gl(2, 5)) mydata f - function (x) { if (is.numeric(x)) x[x 80] - NA x } mydata[-1] -

Re: [R] Transfer my package in CRAN

2011-06-20 Thread Uwe Ligges
On 19.06.2011 20:40, fadia bougacha wrote: Hello, I found a problem to transfer my package on the site ftp://cran.rproject.org/incoming/ . Access is not allowed. Write access is allowed (but you cannot read!). Please,could you give me the settings for connecting to your server to

[R] R crashes with 'nlme' and corStruct

2011-06-20 Thread Andreea Borla
Hello, I would like to fit correlation structures with nlme, but R crashes. My data is similar to the growth of orange trees example from Pinheiro and Bates (2000), but data are not equally spaced in time, as the last observation is taken after 6 days ( and not 2 as the others). This is the code

[R] Adding objects to a list

2011-06-20 Thread mdvaan
#Hi list, #From the code below I get two list objects (n$values and n$vectors): dat - matrix(1:9,3) n-eigen(dat) n # How do I add another object to n that replicates n$vectors and is called n$vectors$test? # Thanks a lot! -- View this message in context:

Re: [R] different results from nls in 2.10.1 and 2.11.1

2011-06-20 Thread Uwe Ligges
Since one is a 32-bit and the other one a 64-bit, and therefore the compiler is also different, you can get different numerical results easily, even with identical versions of R (and most of us do not have outdated R installations around). I just tried your example on 3 different systems with

Re: [R] Adding objects to a list

2011-06-20 Thread Jannis
How about using the available introductory material for such basic questions? This link for example will tell you what to do: http://cran.r-project.org/doc/manuals/R-intro.html#Constructing-and-modifying-lists HTH Jannis --- mdvaan mathijsdev...@gmail.com schrieb am Mo, 20.6.2011: Von:

Re: [R] Adding objects to a list

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 5:00 AM, mdvaan wrote: #Hi list, #From the code below I get two list objects (n$values and n$vectors): One of which is a numeric vector and the other of which is a matrix. dat - matrix(1:9,3) n-eigen(dat) n # How do I add another object to n that replicates n$vectors

Re: [R] Adding objects to a list

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 5:40 AM, Mathijs de Vaan wrote: OK, thanks. n is a list containing two list objects (a numeric vector and a matrix). I want to replicate n$vectors within list n and name it n$vectors$test. Thanks Since you probably already have the mangled object: n$vectors$test -

Re: [R] double integral calculation

2011-06-20 Thread Uwe Ligges
See R packages cubature and R2Cuba. Uwe Ligges On 18.06.2011 08:17, Moohwan Kim wrote: a=[0.1,0.2,0.1,0.3,0.4] b=[0.2,0.3,0.1,0.2,0.5] c=[1,1,1,1,1] log(c+a-x*b) where x=unknown scale variable. int=$$log(c+a-x*b)dadb, where $ denotes integral sign. Actually, how could I calculate the

Re: [R] Adding objects to a list

2011-06-20 Thread Mathijs de Vaan
OK, thanks. n is a list containing two list objects (a numeric vector and a matrix). I want to replicate n$vectors within list n and name it n$vectors$test. Thanks On Mon, Jun 20, 2011 at 11:35 AM, David Winsemius dwinsem...@comcast.netwrote: On Jun 20, 2011, at 5:00 AM, mdvaan wrote: #Hi

Re: [R] [RExcel] please help me to set up RExcel via a remote server

2011-06-20 Thread Erich Neuwirth
statconnDCOM and RExcel have their own mailing list. Please subscribe at rcom.univie.ac.at and post you question there. On Jun 17, 2011, at 7:55 AM, Takatsugu Kobayashi wrote: Hi RUsers, I am currently tying to use RExcel via R installed in my remote server (CentOS 5.5). Could you please

Re: [R] About GAM in R, Need YOUR HELP!

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 1:25 AM, pigpigmeow wrote: I'm beginner in R! I have a lot of problems on R. I have three questions about GAM 1. What is the function of Gaussian distribution in GAM?(if I choose family is Gaussian) Specifies an an error distribution. Is it used in the

[R] non-recursive SVAR model with vars

2011-06-20 Thread Gang Chen
Hi, I have a question about SVAR modeling with the package vars. How does it handle the situation where the A (structural) matrix has a non-recursive structure in the SVAR model? In other words, what kind of algorithm does vars adopt to deal with the unidentifiable issue in a non-recursive model?

[R] Elbow criterion

2011-06-20 Thread Dominik P.H. Kalisch
Hi, I would like to cluster a dataset with the ward algorithm. That works fine. But I can't find a method to plot the structure chart to estimate the elbow crterion for the number of clusters. Can someone tell me how I can do it? Thanks for your help. Dominik

Re: [R] About GAM in R, Need YOUR HELP!

2011-06-20 Thread Christopher W Ryan
If you use the mgcv package for GAMs, I found this book very helpful: Wood, SN Generalized additive models: An introduction with R CRC Press, 2006 ISBN-13: 9781584884743 --Chris Ryan SUNY Upstate Medical University On Mon, Jun 20, 2011 at 1:25 AM, pigpigmeow gloryk...@hotmail.com wrote: I'm

Re: [R] Error of Cross Validation

2011-06-20 Thread zhu yao
error in pre[sam[[j]], i] - predict(fit, data = dat[sam[[j]], ]) : * Yao Zhu* *Department of Urology Fudan University Shanghai Cancer Center Shanghai, China* 2011/6/20 Jim Holtman jholt...@gmail.com what was the error? Sent from my iPad On Jun 20, 2011, at 1:34, zhu yao

[R] Can I disable Cairo?

2011-06-20 Thread Mario Valle
On Linux 2.13 by default links cairo, so png() uses it for rendering. One of my users has performance problem, so ask if it possible to temporary disable cairo during png() rendering so it reverts to grGraphics. My workaround for now is to configure R without cairo, but this affects all users

[R] Solutions to exercises in Introductory Statistics with R OR Intro. to R Book Suggestions with Solutions Available

2011-06-20 Thread Ben Ganzfried
Hi-- I'm trying to teach myself R using Peter Dalgaard's Introductory Statistics with R. Does anyone know if there are solutions available for the exercises? I'm really just hoping to learn by going through exercises and checking myself, so alternatively, does anyone know of an introductory

Re: [R] Error of Cross Validation

2011-06-20 Thread jim holtman
You real error was this: Error in pre[sam[[j]], i] - predict(fit, data = dat[sam[[j]], ]) : number of items to replace is not a multiple of replacement length Take a look at the statement and you will see that 'predict' is returning 100 values and you are trying to store it into only 10 rows

Re: [R] Asymmetrical Confidence Interval

2011-06-20 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Dear Patrick, I do agree with you that it is a very simple problem. Actually, I do have the following SAS program written to compute the asymmetrical confidence interval. As a new user of R, I just wanted to see the corresponding codes in R if they already exist. Thanks, Pradip *SAS

[R] Average skyline plot from newick trees stored

2011-06-20 Thread Andra Tolbus
Dear all, Does anyone know how can one loop through the newick phylogenetic trees stored in a nexus file and generate an average skyline plot with coalescent intervals? I have managed to generate the plot with one tree, but is it possible to create that consensus/average plot in R?

Re: [R] Asymmetrical Confidence Interval

2011-06-20 Thread David Winsemius
Learn to search the Archives (or at least one of the forms of the Archives) http://search.r-project.org/cgi-bin/namazu.cgi?query=confidence+interval+logit+proportionmax=100result=normalsort=scoreidxname=functionsidxname=Rhelp08idxname=Rhelp10idxname=Rhelp02 (That is constructed with an URL I

Re: [R] profile plot in R

2011-06-20 Thread Vickie S
Hi thanks for the help. Here is the error message i got. I could not figure out what goes wrong here. == require(ggplots2) sampledata=data.frame(c(1.002, 1.76, 0.67, 0.99), c(1.38,1.0,0.5, 0.78), c(1.003,0.57,0.99, 0.58),c(0.76,1.23, 1.45, .78), c(1.43, 1.34, 1.0, 0.9))

[R] help: X11-fonts and X-locale related complaints from plot() function

2011-06-20 Thread Hong Yu
I wish for help for the following issue with GNU R. I have on my Ubuntu-Linux-10.04-LTS built R-2.13.0 from source these days. After I launched the R interactive console, the plot() etc. graphics functions reported the following errors: -- could not find any X11 fonts -- locale not supported

Re: [R] different results from nls in 2.10.1 and 2.11.1

2011-06-20 Thread Mike Marchywka
Date: Mon, 20 Jun 2011 11:25:54 +0200 From: lig...@statistik.tu-dortmund.de To: p.e.b...@dunelm.org.uk CC: r-help@r-project.org; pb...@astro.uni-bonn.de Subject: Re: [R] different results from nls in 2.10.1 and 2.11.1 Since one is a 32-bit and the other one a 64-bit, and therefore the

Re: [R] Model Formulae Evaluation

2011-06-20 Thread albeam
Please allow me to clarify my original question. What I really need to be able to do it is to take arbitrary functions and evaluate them for arbitrary parameter values. I'm doing the optimization myself, so I need to be able to take a user's function and evaluate them at the current parameter

[R] X11-fonts and X-locale related complaints from plot() function

2011-06-20 Thread Hong Yu
I wish for help for the following issue with GNU R. I have on my Ubuntu-Linux-10.04-LTS built R-2.13.0 from source these days. After I launched the R interactive console, the plot() etc. graphics functions reported the following errors: -- could not find any X11 fonts -- locale not supported

[R] fonts and locale complaints from plot

2011-06-20 Thread Hong Yu
I wish for help for the following issue with GNU R. I have on my Ubuntu-Linux-10.04-LTS built R-2.13.0 from source these days. After I launched the R interactive console, the plot() etc. graphics functions reported the following errors: -- could not find any X11 fonts -- locale not supported

Re: [R] Can I disable Cairo?

2011-06-20 Thread Prof Brian Ripley
See the help page! type: character string, one of ‘Xlib’ or ‘quartz’ (some Mac OS X builds) or ‘cairo’. The latter will only be available if the system was compiled with support for cairo - otherwise ‘Xlib’ will be used. The default is set by

Re: [R] Error of Cross Validation

2011-06-20 Thread Dennis Murphy
Hi: I was curious to see how to do this. I generated two versions of the same function - one for 10-fold predictions when the number of observations is an exact multiple of 10, returning a matrix, and another that lets the user define the number of folds and works with lists. The function also

[R] Possible amendment to 'Writing R extensions' [was 'Porting unmaintained packages to post R 2.10.0 era']

2011-06-20 Thread Stephen Ellison
Dear Uwe, If you think the relevant section is not sufficient, it's your turn to provide a short and precise suggestion for a change, preferable a diff against the R-devel sources. That way you may be able to convince an R Core member to work on it. I would be more than happy to rearrange

Re: [R] Model Formulae Evaluation

2011-06-20 Thread Gabor Grothendieck
On Mon, Jun 20, 2011 at 9:08 AM, albeam beam.and...@gmail.com wrote: Please allow me to clarify my original question. What I really need to be able to do it is to take arbitrary functions and evaluate them for arbitrary parameter values. I'm doing the optimization myself, so I need to be able

Re: [R] Model Formulae Evaluation

2011-06-20 Thread peter dalgaard
On Jun 20, 2011, at 15:08 , albeam wrote: Please allow me to clarify my original question. What I really need to be able to do it is to take arbitrary functions and evaluate them for arbitrary parameter values. I'm doing the optimization myself, so I need to be able to take a user's function

Re: [R] Elbow criterion

2011-06-20 Thread Matt Shotwell
On Mon, 2011-06-20 at 13:38 +0200, Dominik P.H. Kalisch wrote: Hi, I would like to cluster a dataset with the ward algorithm. I'm assuming that this refers to the agglomerative partitioning method [1]. That is, the number of clusters is selected according to the data partition that is

Re: [R] For loop by factor.

2011-06-20 Thread Sarah Goslee
Chris, This doesn't cover all possible cases, but does work for your example. It should be enough for you to tweak for your actual data. diffsum - function(x) { # first identify the decreasing values # and the difference between increasing values xdif - x[2:length(x)] -

Re: [R] Accessor functions in lattice graphics

2011-06-20 Thread David Winsemius
Frank Harrell wrote: I know about the current.row, current.column, and panel.number functions that are useful within panel functions written for lattice. Are there easy ways to obtain the names of the conditioning variables (those appearing after |) and their values for the current panel?

Re: [R] Using MCMC sampling to estimate p values with a mixed model

2011-06-20 Thread ps0u5145
Hi, Thank you for the replies. Yes I would say it does resemble a randomized block design in that each person completed 4 out of a possible 16 versions/conditions of the vignette. There was approximately 20 responses in each condition. The commands I have been using are; modela -lmer(DV ~

[R] Activity budgets with multiple proportions as response

2011-06-20 Thread Asa Johannesen
Hi everyone, I've searched the internet and lots of stats books high and low for this one, but nothing seems to be quite what I want. I've got continuous data on four different state activities recorded in seconds, however each continuous session is not equally long, so the data are best

Re: [R] profile plot in R

2011-06-20 Thread Dennis Murphy
Hi: Typically a profile plot is a plot over time for each of n subjects (aka a 'spaghetti plot'). Here's a revision of your code to yield a profile plot in ggplot2, although it's not clear for what the grouping variable is meant. sampledata= matrix(c(1.002, 1.76, 0.67, 0.99, 1.38, 1.0, 0.5,

Re: [R] Model Formulae Evaluation

2011-06-20 Thread Gabor Grothendieck
On Mon, Jun 20, 2011 at 9:46 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, Jun 20, 2011 at 9:08 AM, albeam beam.and...@gmail.com wrote: Please allow me to clarify my original question. What I really need to be able to do it is to take arbitrary functions and evaluate them for

Re: [R] fonts and locale complaints from plot

2011-06-20 Thread Jeff Newmiller
This does not seem like a core R issue... at best it would be relevant on the R Debian special interest group mailing list (https://stat.ethz.ch/mailman/listinfo/r-sig-debian). However, using your system software installation tools to make sure you have installed relevant font packages for X

Re: [R] Accessor functions in lattice graphics

2011-06-20 Thread Bert Gunter
Hi all: Thanks, David. This is a good example of knowledgeable R forensic investigation. I leave it to Frank whether it meets his criteria. However, I would argue that that this is bad practice and quite unwise. In general, these details are implementation dependent and could change. Yes, they

[R] ade4 package

2011-06-20 Thread Oana Tomescu
Dear list, I am using the plot.coinertia function from the ade4 package. Can someone tell me if it is possible to change the label size in the upper, right plot? My RV value is so high that the arrows become shorter than the labels. Thank you for your help. Oana Tomescu -- Dipl.-Ing. Oana

[R] Quick R syntax question

2011-06-20 Thread Ben Ganzfried
Hi -- I had a pretty quick R question since unfortunately I have not been able to find an answer on Google. It shouldn't take much more than a minute to answer. I'm trying to add up the major gleason grade and minor gleason grade for an analysis of patients with prostate cancer. One column has

Re: [R] Accessor functions in lattice graphics

2011-06-20 Thread Frank Harrell
Thanks very much Bert and David. I was looking for an approach that would use objects that are active while the panel function was being executed. Perhaps which.packet is the best way to go, e.g. if using y ~ x | a*b, fetch levels(b)[which.packet()[2]] from the environment in which b is defined.

Re: [R] Quick R syntax question

2011-06-20 Thread Luke Miller
If we assume that your data are in a data frame (which doesn't allow spaces in column names, hence the periods in the call below): df = data.frame(Major.Gleason = c(4,5,2,3), Minor.Gleason = c(3,2,4,3)) You can paste together the contents of the two columns with a plus sign in between using the

Re: [R] Accessor functions in lattice graphics

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 10:49 AM, Bert Gunter wrote: Hi all: Thanks, David. This is a good example of knowledgeable R forensic investigation. I leave it to Frank whether it meets his criteria. However, I would argue that that this is bad practice and quite unwise. In general, these details are

Re: [R] Quick R syntax question

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 11:47 AM, Luke Miller wrote: If we assume that your data are in a data frame (which doesn't allow spaces in column names, hence the periods in the call below): df = data.frame(Major.Gleason = c(4,5,2,3), Minor.Gleason = c(3,2,4,3)) You can paste together the contents

Re: [R] About GAM in R, Need YOUR HELP!

2011-06-20 Thread pigpigmeow
Actually, I 'm using mgcv package. But I learnt basic linear regression in my school, it is really hard for me to handle these problem! by the way, i need to work harder! -- View this message in context: http://r.789695.n4.nabble.com/About-GAM-in-R-Need-YOUR-HELP-tp3610522p3611796.html Sent

Re: [R] Quick R syntax question

2011-06-20 Thread Ben Ganzfried
Thanks! Very glad you pointed me to the paste function, it looks very helpful. I have a quick follow-up after reading through the online tutorial on the paste function: Why do we need quotation marks around Major Gleason and Minor Gleason in: output = paste(df [,'Major.Gleason'], df[

Re: [R] Quick R syntax question

2011-06-20 Thread Luke Miller
The quotes around 'Major.Gleason' and 'Minor.Gleason' are required for accessing data frame columns by name. You could alternately refer to the columns by number if you're sure you know which column is which: output = paste(df[ ,1], df[ ,2], sep = '+') It's just a requirement for accessing

Re: [R] Quick R syntax question

2011-06-20 Thread Bert Gunter
Ben: 1. One doesn't ask questions like this. Syntax is syntax. 2. This has nothing to do with paste; it's the syntax of [ , subscripting/extraction 3. But it does make sense: a - b z - data.frame(a=1:3, b=4:6) z[ ,a] # the a column of z z[ ,a] # the column of z with the value of the object

Re: [R] Quick R syntax question

2011-06-20 Thread Bert Gunter
Sorry, I was unclear. The comment after the second should be: z[ ,a] # the column of z whose name is the value of the object a -- Bert On Mon, Jun 20, 2011 at 9:38 AM, Bert Gunter bgun...@gene.com wrote: Ben: 1. One doesn't ask questions like this. Syntax is syntax. 2. This has nothing

Re: [R] different results from nls in 2.10.1 and 2.11.1

2011-06-20 Thread Prof. John C Nash
Interesting! I get nice convergence in both 32 and 64 bit systems on 2.13.0. I agree the older versions are a bit of a distraction. The inconsistent behaviour on current R is a concern. Maybe Philip, Uwe, and I (and others who might be interested) should take this off line and see what is

[R] Quick Question on RPut

2011-06-20 Thread Filipe Leme Botelho
Hi all, I need to know two quick things regarding RPut function from RExcel. 1/ How to assign colnames and rownames in the command, i.e., something like '=RPut(example; A10:F50; rownames=TRUE; colnames=TRUE)'. 2/ When I use RPut and I have NAs in Excel selection, the entire matrix is coerced

Re: [R] Quick R syntax question

2011-06-20 Thread Ben Ganzfried
Thanks for the clarifications. On Mon, Jun 20, 2011 at 12:40 PM, Bert Gunter gunter.ber...@gene.comwrote: Sorry, I was unclear. The comment after the second should be: z[ ,a] # the column of z whose name is the value of the object a -- Bert On Mon, Jun 20, 2011 at 9:38 AM, Bert Gunter

Re: [R] profile plot in R

2011-06-20 Thread Vickie S
Hi Dennis, It looks like something is wrong about configuration of ggplot dependency with plyr.Since i saw some threads about this particular error message. I tried several times by installing different versions of plyr but it did not work.  sampledata= matrix(c(1.002, 1.76, 0.67,

Re: [R] Accessor functions in lattice graphics

2011-06-20 Thread Deepayan Sarkar
On Mon, Jun 20, 2011 at 9:22 PM, David Winsemius dwinsem...@comcast.net wrote: On Jun 20, 2011, at 10:49 AM, Bert Gunter wrote: Hi all: Thanks, David. This is a good example of knowledgeable R forensic investigation. I leave it to Frank whether it meets his criteria. However, I would

Re: [R] Vim-R-Plugin issue : Python interface must be enabled to run Vim-R-Plugin

2011-06-20 Thread Idris Raja
As a follow up to my own question, the problem was with my version of vim. I needed vim 7.3, was using 7.2. I updated and it works as expected. Just make sure your version of python matches the version of pywin you install if on windows. On Fri, Jun 17, 2011 at 6:51 PM, Idris Raja

[R] Tell R where to look locally for library?

2011-06-20 Thread Idris Raja
I have R library's installed in several places on my windows machine. They are in: 1) C:\Program Files\R\R-2.12.2\library 2) C:\Users\MyUser\Documents\R\win-library\2.12 I can access a library from either location with RStudio, but I can't access a library from 2) when using R from the command

Re: [R] Model Formulae Evaluation

2011-06-20 Thread albeam
Hi everyone, Thank you for the help, I apologize for not providing commented, minimal, self-contained, reproducible code. I was looking for some pointers about how to do this in general, but it would have been helpful for me to post a specific example. Anyway, after the feedback this is the

[R] dynlm question

2011-06-20 Thread Dave Evens
Dear All, I'm trying to use dynlm to fit a time series. I have 3 seasonal terms. Here is an example of the problem. This is my time variable, hourly data: timeSeries - seq(as.POSIXct(2011-01-01 00:00:00), as.POSIXct(2011-12-31 23:00:00), by=hour) My response is: y - rnorm(length(t),

Re: [R] Tell R where to look locally for library?

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 2:38 PM, Idris Raja wrote: I have R library's installed in several places on my windows machine. They are in: 1) C:\Program Files\R\R-2.12.2\library 2) C:\Users\MyUser\Documents\R\win-library\2.12 I can access a library from either location with RStudio, but I can't

Re: [R] Model Formulae Evaluation

2011-06-20 Thread Gabor Grothendieck
On Mon, Jun 20, 2011 at 1:31 PM, albeam beam.and...@gmail.com wrote: Hi everyone, Thank you for the help, I apologize for not providing commented, minimal, self-contained, reproducible code. I was looking for some pointers about how to do this in general, but it would have been helpful for me

[R] for loop and linear models

2011-06-20 Thread ivan
Hi, I have two datasets, x and y. Simplified x and y denote: X Y A B C A B C . . . . . . . . . . . . . . . . . . I want to implement all possible models such as lm(X$A~Y$A), lm(X$B~Y$B), lm(X$C~Y$C)... I have tried the following: fun- function(x,y){ for(i in

Re: [R] profile plot in R

2011-06-20 Thread Brian Diggs
On 6/20/2011 11:25 AM, Vickie S wrote: Hi Dennis, It looks like something is wrong about configuration of ggplot dependency with plyr.Since i saw some threads about this particular error message. I tried several times by installing different versions of plyr but it did not work.

Re: [R] for loop and linear models

2011-06-20 Thread Daniel Malter
Hi, can you put return(models) within the inner braces and report what it does. That might do the trick, since it should return the 'models' for every combination of i and j. HTH, Daniel hazzard wrote: Hi, I have two datasets, x and y. Simplified x and y denote: X Y A B C A B

Re: [R] for loop and linear models

2011-06-20 Thread Daniel Malter
To be more accurate and helpful, try this: fun- function(x,y){ for(i in 1:length(colnames(x))){ for(j in 1:length(colnames(y))){ if(colnames(x)[i]==colnames(y)[j]){ models=list(lm(ts(x[i])~ts(y[j]))) return(models)

Re: [R] searching through two different texts files to find a common variable

2011-06-20 Thread Daniel Malter
You probably want to use the merge() function. imaginary example for data frames named KS and US, where the common identifier variable is named ID merged.data-merge(KS,US,by.x=ID,by.y=ID,all.x=F,all.y=F) Note that this will retain only observations for which there is a common ID in both KS and

Re: [R] for loop and linear models

2011-06-20 Thread William Dunlap
Your suggestion would have it return after fitting the first model, which is not what the OP wants. The basic problem is that models - list(lm(...)) replaces the old value of models with a new length-1 list. You want to add the new fitted model to the list of fitted models. E.g., models

Re: [R] for loop and linear models

2011-06-20 Thread Brian Diggs
On 6/20/2011 12:23 PM, ivan wrote: Hi, I have two datasets, x and y. Simplified x and y denote: X Y A B C A B C . . . . . . . . . . . . . . . . . . I want to implement all possible models such as lm(X$A~Y$A), lm(X$B~Y$B), lm(X$C~Y$C)... I have tried the following: fun- function(x,y){

[R] Vi mode in Linux console - how to stop it ?

2011-06-20 Thread rivercode
Hi, When I am editing a command using default R console in Linux, sometimes it is going into vi mode...not too sure how/why this happening. It then requires me to use vi commands to edit the line, which is very frustrating when I just want to use the delete key instead of x to delete a

[R] General Plotting Commands Help

2011-06-20 Thread Deepfish
I am rather new to R and struggling with the syntax. I am trying to do simple plots and I can't get anything but errors. Specifically, I would like to know how to plot 3D scatterplots and using polar coordinates. So far I've tried installing the scatterplot3D package and have copied and pasted

[R] Can mathematical formula be used in the help file of a R function or package?

2011-06-20 Thread Runlong Tang
Hi everyone, I am writing help files for some R functions in an R package. I am wondering if we can use the Latex mathematical formula when editing those *.Rd files and then obtain a pdf manual with beautiful mathematical formula. I tried it with the default R CMD check command but could not

[R] Stepwise model comparisons for mlogit

2011-06-20 Thread Merlin, Louis
I am trying to perform a backwards stepwise variable selection with an mlogit model. The usual functions, step(), drop1(), and dropterm() do not work for mlogit models. Update() works but I am only able to use it manually, i.e. I have to type in each variable I wish to remove by hand on a

[R] matrix problem

2011-06-20 Thread Costis Ghionnis
Hallo everyone! I have a problem about creating a matrix... Suppose we have a vector y-c(1,1,1,3,2) and a zero matrix, m ,with nrows=length(y) and ncol=4. The matrix would look like this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

[R] RES: for loop and linear models

2011-06-20 Thread Filipe Leme Botelho
---BeginMessage--- Ivan, try this d1 - matrix(rnorm(10),50,50) d2 - matrix(rnorm(10),50,50) regs - lapply(1:ncol(d1), function(i) lm(d1[,i] ~ d2[,i]) HTH, Filipe -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de ivan Enviada em:

Re: [R] General Plotting Commands Help

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 4:52 PM, Deepfish wrote: I am rather new to R and struggling with the syntax. I am trying to do simple plots and I can't get anything but errors. Specifically, I would like to know how to plot 3D scatterplots and using polar coordinates. So far I've tried installing

[R] AUC calculated from Epi package

2011-06-20 Thread array chip
Hi, I have a dataset (see attached) with 2 variables Y is binary, x is a continuous variable. I want to calculate area under the curve (AUC) for the ROC curve, but I got different AUC values using ROC() from Epi package vs. rcorr.cens() from rms package:

[R] importing a file

2011-06-20 Thread Alina Sheyman
I haven't used R in a couple of years, and now am trying something as simple as importing a csv file and am running into problems right away. * mydata - read.csv (Wordata1.csv, sep=) Error in read.table(file = file, header = header, sep = sep, quote = quote, : object 'Wordata1.csv' not found

Re: [R] matrix problem

2011-06-20 Thread Sarah Goslee
How about: y - c(1,1,1,3,2) m - matrix(0, nrow=length(y), ncol=4) m[y==1, ] - matrix(1:4, nrow=sum(y == 1), ncol=4, byrow=TRUE) or, depending on your actual problem y - c(1,1,1,3,2) m - matrix(0, nrow=length(y), ncol=4) m[y == 1,] - col(m[y == 1,]) Sarah On Mon, Jun 20, 2011 at 3:54 PM,

Re: [R] importing a file

2011-06-20 Thread Richard M. Heiberger
You probably left off the quotes for the file name mydata - read.csv (Wordata1.csv, sep=) it is looking for an R variable named Wordata1.csv which contains the name of the file. Since you are giving it the name of the file, it must be in a character-valued constant. On Mon, Jun 20, 2011 at 5:16

Re: [R] importing a file

2011-06-20 Thread Sarah Goslee
R is looking for an R object named Wordata1.csv that contains your file name. Instead you want: mydata - read.csv (Wordata1.csv, sep=) Sarah On Mon, Jun 20, 2011 at 5:16 PM, Alina Sheyman alina...@gmail.com wrote: I haven't used R in a couple of years, and now  am trying something as simple

Re: [R] importing a file

2011-06-20 Thread Alina Sheyman
that was it, thank you!!! On Mon, Jun 20, 2011 at 5:23 PM, Sarah Goslee sarah.gos...@gmail.comwrote: R is looking for an R object named Wordata1.csv that contains your file name. Instead you want: mydata - read.csv (Wordata1.csv, sep=) Sarah On Mon, Jun 20, 2011 at 5:16 PM, Alina

Re: [R] matrix problem

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 3:54 PM, Costis Ghionnis wrote: Hallo everyone! I have a problem about creating a matrix... Suppose we have a vector y-c(1,1,1,3,2) and a zero matrix, m ,with nrows=length(y) and ncol=4. The matrix would look like this: 0 0 0 0 0 0 0 0

Re: [R] General Plotting Commands Help

2011-06-20 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Monday, June 20, 2011 2:07 PM To: Deepfish Cc: r-help@r-project.org Subject: Re: [R] General Plotting Commands Help ... much elided ... Most of the

Re: [R] importing a file

2011-06-20 Thread David Winsemius
On Jun 20, 2011, at 5:16 PM, Alina Sheyman wrote: I haven't used R in a couple of years, and now am trying something as simple as importing a csv file and am running into problems right away. * mydata - read.csv (Wordata1.csv, sep=) Error in read.table(file = file, header = header, sep =

Re: [R] Can mathematical formula be used in the help file of a R function or package?

2011-06-20 Thread Rolf Turner
On 21/06/11 06:52, Runlong Tang wrote: Hi everyone, I am writing help files for some R functions in an R package. I am wondering if we can use the Latex mathematical formula when editing those *.Rd files and then obtain a pdf manual with beautiful mathematical formula. I tried it with the

Re: [R] (no subject)

2011-06-20 Thread Ethan Brown
Hi Ungku, it's really difficult for us to take a huge block of code and understand where an error happened. There's several things that can help us help you: 1) First and foremost, what is the error message or undesired behavior you're experiencing? 2) Second, please pare down the code to the

Re: [R] for loop and linear models

2011-06-20 Thread Dennis Murphy
Hi: (a) What Brian said... (b) Here's one way to generate a list of model objects from which you can extract the pieces you may want. # Generate a fairly minimal, reproducible data set set.seed(345) # makes results below reproducible dd - data.frame(X = rnorm(100), Y = rnorm(100),

Re: [R] profile plot in R

2011-06-20 Thread Vickie S
Hi Dennis and all friends, After upgrading to R 2.11.1, I managed to work this out perfectly. I also added group information here, since I wanted to color code the profiles according to the groups they were assigned to. library(reshape) library(ggplot2) sampledata - matrix(c(1.002, 1.76,

  1   2   >