[R] suggestions for debugging problem with a package

2012-03-12 Thread Daniel Nordlund
I am trying to resolve a problem I am having with running the rattle package on two different Windows 7 x64 systems. It appears to be a problem with my two specific systems, because others on Windows 7 x64 systems aren't complaining about this problem. What I am looking for is a method for try

Re: [R] Two dimensional integration

2012-03-12 Thread baptiste auguie
Hi, Try the cubature package, and maybe play with the tolerance. HTH, b. On 13 March 2012 18:39, Niroshan wrote: > Dear R Members, > > I want to know a fast R function to do multidimensional integration.  I used > the function 'cuhre' in R2cuba library. But it takes painful time to get the > a

[R] Two dimensional integration

2012-03-12 Thread Niroshan
Dear R Members, I want to know a fast R function to do multidimensional integration. I used the function 'cuhre' in R2cuba library. But it takes painful time to get the answer. I would be thankful if anyone could help me out to solve this problem Thanks Niroshan -- View this message in co

Re: [R] PCA Kernel

2012-03-12 Thread Jim Silverton
Hi, I have 6 variables and I want to do a PCA Kernel on the 6 variables. But I want the scores from the from the PCA kernel method. for each subject. Does anyone know how to do this? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-h

Re: [R] Beginner problems forecasting arma model

2012-03-12 Thread David Winsemius
On Mar 12, 2012, at 8:51 PM, Alex Chen wrote: Hello, I am new to the R software and attempting to create a time series model with trend, seasonality, as well as cycles. I have already been able to create a model that incorporates both the trend and seasonality and my approach is to then use th

[R] Beginner problems forecasting arma model

2012-03-12 Thread Alex Chen
Hello, I am new to the R software and attempting to create a time series model with trend, seasonality, as well as cycles. I have already been able to create a model that incorporates both the trend and seasonality and my approach is to then use the fitted results from this model in order to creat

Re: [R] Idea/package to "linearize a curve" along the diagonal?

2012-03-12 Thread David Winsemius
On Mar 12, 2012, at 3:07 PM, Emmanuel Levy wrote: Hi Jeff, Thanks for your reply and the example. I'm not sure if it could be applied to the problem I'm facing though, for two reasons: (i) my understanding is that the inverse will associate a new Y coordinate given an absolute X coordinate.

Re: [R] Speeding up lots of calls to GLM

2012-03-12 Thread Thomas Lumley
On Tue, Mar 13, 2012 at 9:39 AM, Davy wrote: > Thanks for the reply. Sorry to be a pain, but could perhaps explain what you > mean by > "you can center each SNP variable at its mean to make the interaction > term uncorrelated with the main effects". Suppose rs1 and rs2 are your SNPs rs1cent <- r

Re: [R] erasing "[1]"

2012-03-12 Thread jim holtman
Will this work for you: > a <- 3 + 2 > print(a) [1] 5 > cat(a, '\n') 5 On Mon, Mar 12, 2012 at 6:49 PM, mrzung wrote: > hi, > is there any way to erase the term "[1]"? > > for example, > >> a<-3+2 >> a > *[1]*  5 > > the term [1] in front of number 5. > > is there any way? > > -- > View this me

Re: [R] erasing "[1]"

2012-03-12 Thread R. Michael Weylandt
You can write your own print method or do it using cat: cat(a, "\n") Michael On Mon, Mar 12, 2012 at 6:49 PM, mrzung wrote: > hi, > is there any way to erase the term "[1]"? > > for example, > >> a<-3+2 >> a > *[1]*  5 > > the term [1] in front of number 5. > > is there any way? > > -- > View t

[R] erasing "[1]"

2012-03-12 Thread mrzung
hi, is there any way to erase the term "[1]"? for example, > a<-3+2 > a *[1]* 5 the term [1] in front of number 5. is there any way? -- View this message in context: http://r.789695.n4.nabble.com/erasing-1-tp4467628p4467628.html Sent from the R help mailing list archive at Nabble.com. _

[R] Rserve as a proxy

2012-03-12 Thread Ed Siefker
Is there a simple way to use Rserve/RSclient as a proxy to transparently send requests from a local instance of R to a remote instance? It seems like this would by doable by wrapping each call that doesn't refer to a local path inside RSeval. Is this harder than it seems? Does this already exis

[R] How to add/draw a persp3d graph to a plot with an existing surface/graph

2012-03-12 Thread Michael
Dear R users, I have been trying to draw the following 3d graphs: The solid region bounded above by the paraboloid z = 9 - x2 - y2 and below by the unit circle in the xy-plane. I wanted to visualize the solid region bounded by those two graphs. I could draw those two 3d graphs separately, but I c

Re: [R] B-spline/smooth.basis derivative matrices

2012-03-12 Thread aleksandr shfets
Hello again, Thank you, vito for these functions: I've been able to look at the smoothing spline matrix and its derivatives that I constucted with functions "create.bspline.basis" and "smooth.basis" Understanding from Hastie and Tishbirani that the S(lambda)-- the penalty matrix 25 февраля 201

[R] Fwd: Re[2]: B-spline/smooth.basis derivative matrices

2012-03-12 Thread Vassily Shvets
--- On Mon, 3/12/12, aleksandr shfets wrote: > From: aleksandr shfets > Subject: Fwd: Re[2]: [R] B-spline/smooth.basis derivative matrices > To: "Vassily Shvets" > Received: Monday, March 12, 2012, 5:15 PM > > > > Пересылаемое сообщение > > От кого: aleksandr shfets > Ко

[R] Fwd: Re[2]: B-spline/smooth.basis derivative matrices

2012-03-12 Thread Vassily Shvets
--- On Mon, 3/12/12, aleksandr shfets wrote: > From: aleksandr shfets > Subject: Fwd: Re[2]: [R] B-spline/smooth.basis derivative matrices > To: "Vassily Shvets" > Received: Monday, March 12, 2012, 5:15 PM > > > > Пересылаемое сообщение > > От кого: aleksandr shfets > Ко

Re: [R] Idea/package to "linearize a curve" along the diagonal?

2012-03-12 Thread Jeff Newmiller
You said: > Does this make sense? Not to me. I don't understand either of your points. It may be time for you to provide a concrete example of your own (reproducible R code, or at least specific input and output data). --- J

Re: [R] Speeding up lots of calls to GLM

2012-03-12 Thread Davy
Thanks for the reply. Sorry to be a pain, but could perhaps explain what you mean by "you can center each SNP variable at its mean to make the interaction term uncorrelated with the main effects". I'm coming from a web based programming background so often statistical terminology doesn't click with

Re: [R] Replicating Stata's xtreg clustered SEs in R

2012-03-12 Thread Thomas Lumley
On Mon, Mar 12, 2012 at 5:55 PM, David A. Kim wrote: > Does anyone happen to know what method cluster() for Stata's xtreg > uses to calculate clustered SEs for panel data, and/or how this could > be implemented equivalently in R?  Any help would be much appreciated. The Stata manuals usually say

Re: [R] Speeding up lots of calls to GLM

2012-03-12 Thread Thomas Lumley
On Tue, Mar 13, 2012 at 7:11 AM, Davy wrote: > Dear useRs, > > First off, sorry about the long post. Figured it's better to give context > to get good answers (I hope!). Some time ago I wrote an R function that > will get all pairwise interactions of variables in a data frame. This > worked fine a

Re: [R] Window on a vector

2012-03-12 Thread R. Michael Weylandt
As the error message show, the problem isn't in the subscripting but rather in passing a NA to `:` If you try to implement Dr. Winsemius' method you should be fine. Also, send plain text email. Michael On Mon, Mar 12, 2012 at 11:58 AM, Alaios wrote: > You will find here a reprodusible example,

Re: [R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-12 Thread R. Michael Weylandt
You get the "good" behavior with base + aes(x = cut) + facet_wrap(~ color, ncol = 5) so this seems buggy to me. If someone here doesn't step forward with more insight, I'd forward it to the ggplot list to see if one of the developers there can give an explanation or possibly make the official ca

Re: [R] index values of one matrix to another of a different size

2012-03-12 Thread Ben quant
Joshua, Just confirming quickly that your method using cmpfun and your f function below was fastest using my real data. Again, thank you for your help! Ben On Sat, Mar 10, 2012 at 1:21 PM, Joshua Wiley wrote: > On Sat, Mar 10, 2012 at 12:11 PM, Ben quant wrote: > > Very interesting. You are d

Re: [R] rpanel / list error

2012-03-12 Thread R. Michael Weylandt
My code doesn't give that error so you must have done something differently -- without seeing your code, I can't tell you what though. Also, please cc the list on follow-up if you are seeking further help. I'm not particularly knowledgeable about rpanel and others might be able to give concrete he

[R] Speeding up lots of calls to GLM

2012-03-12 Thread Davy
Dear useRs, First off, sorry about the long post. Figured it's better to give context to get good answers (I hope!). Some time ago I wrote an R function that will get all pairwise interactions of variables in a data frame. This worked fine at the time, but now a colleague would like me to do this

[R] Simulating a VECM process.

2012-03-12 Thread Keith Weintraub
Folks, I have been working on VAR and VECM models and trying to simulate the results. This is easy to do with a VAR model (in the "vars" package) as the covariance matrix is easily extracted. Unfortunately I can't figure out how to do this with a VECM fit. I have used vec2var and created the

Re: [R] Idea/package to "linearize a curve" along the diagonal?

2012-03-12 Thread Emmanuel Levy
Hi Jeff, Thanks for your reply and the example. I'm not sure if it could be applied to the problem I'm facing though, for two reasons: (i) my understanding is that the inverse will associate a new Y coordinate given an absolute X coordinate. However, in the case I'm working on, the transformatio

Re: [R] lapply to change variable names and variable values

2012-03-12 Thread Simon Kiss
Thanks both! That solves ! You've made a very happy newbie! Simon On 2012-03-12, at 2:52 PM, Sarah Goslee wrote: > Hi Simon, > > On Mon, Mar 12, 2012 at 2:37 PM, Simon Kiss wrote: >> Hi: I'm sure this is a very easy problem. I've consulted Data Manipulation >> With R and the R Book and can't fi

Re: [R] lapply to change variable names and variable values

2012-03-12 Thread R. Michael Weylandt
Your function doesn't return the new data frame but rather the new names. Note, e.g. x <- 1:2 names(x) <- letters[1:2] .Last.value # Not x! Try this: .xx<- lapply(.xx, function(x) {colnames(x)<-c('State', 'Year'); x}) or more explicitly .xx<- lapply(.xx, function(x) {colnames(x)<-c('State', '

Re: [R] lapply to change variable names and variable values

2012-03-12 Thread Sarah Goslee
Hi Simon, On Mon, Mar 12, 2012 at 2:37 PM, Simon Kiss wrote: > Hi: I'm sure this is a very easy problem. I've consulted Data Manipulation > With R and the R Book and can't find an answer. > > Sample list of data frames looks as follows: > > .xx<-list(df<-data.frame(Var1=rep('Alabama', 400), Var2

Re: [R] lapply to change variable names and variable values

2012-03-12 Thread Steve Lianoglou
Hi, On Mon, Mar 12, 2012 at 2:37 PM, Simon Kiss wrote: > Hi: I'm sure this is a very easy problem. I've consulted Data Manipulation > With R and the R Book and can't find an answer. > > Sample list of data frames looks as follows: > > .xx<-list(df<-data.frame(Var1=rep('Alabama', 400), Var2=rep(c

[R] lapply to change variable names and variable values

2012-03-12 Thread Simon Kiss
Hi: I'm sure this is a very easy problem. I've consulted Data Manipulation With R and the R Book and can't find an answer. Sample list of data frames looks as follows: .xx<-list(df<-data.frame(Var1=rep('Alabama', 400), Var2=rep(c(2004, 2005, 2006, 2007), 400)), df2<-data.frame(Var1=rep('Tennes

Re: [R] what does "rlm" do if it fails to converge within iteration limits?

2012-03-12 Thread Michael
The problem is: by default shouldn't it use "Huber's"? And it should be convex problem no? so when I do rlm(y~x) which is a single-beta fitting problem, shouldn't it always converge? Thanks! Psi functions are supplied for the Huber, Hampel and Tukey bisquare proposals as

Re: [R] mapply & assign to generate functions

2012-03-12 Thread J Toll
Bill and Brian, Thank you both for the finding my error. force() appears to do the trick. Thanks again, James On Mon, Mar 12, 2012 at 1:09 PM, William Dunlap wrote: > I think that adding a force(i) to your inner function should fix things up. >  > z <- mapply(assign, >  +        c("half", "

Re: [R] mapply & assign to generate functions

2012-03-12 Thread William Dunlap
I think that adding a force(i) to your inner function should fix things up. > z <- mapply(assign, +c("half", "third", "quarter"), +lapply(2:4, function(i) { + force(i) + function(x) divide(x, i)}), +pos = 1) > half(10) [1] 5 > third(

Re: [R] How to create interrupted boxplot

2012-03-12 Thread David Winsemius
On Mar 12, 2012, at 1:19 PM, jianghong deng wrote: Hello, I have created two boxplots with following R code. There is one outlier in B group. The outlier is 33. But the all other data are between 0 to 4. How can I skip y-axis around 5 to 25, and expand 0-4 for this case. Also I want kee

Re: [R] mapply & assign to generate functions

2012-03-12 Thread Brian Diggs
On 3/12/2012 10:47 AM, J Toll wrote: Hi, I have a problem that I'm finding a bit tricky. I'm trying to use mapply and assign to generate curried functions. For example, if I have the function divide divide<- function(x, y) { x / y } And I want the end result to be functionally equivalent

Re: [R] How to create interrupted boxplot

2012-03-12 Thread Helios de Rosario
Jianghong wrote: > Hello, > > I have created two boxplots with following R code. There is one outlier in > B group. > The outlier is 33. But the all other data are between 0 to 4. > > How can I skip y-axis around 5 to 25, and expand 0-4 for this case. Also I > want keep the outlier in my boxplot.

[R] mapply & assign to generate functions

2012-03-12 Thread J Toll
Hi, I have a problem that I'm finding a bit tricky. I'm trying to use mapply and assign to generate curried functions. For example, if I have the function divide divide <- function(x, y) { x / y } And I want the end result to be functionally equivalent to: half <- function(x) divide(x, 2) th

[R] Panel models: Fixed effects & random coefficients in plm

2012-03-12 Thread Millo Giovanni
Hello. Such a procedure is not implemented in 'plm' but you can probably get around to do what you want. One possible way (my preferred one) is to demean the data by both dimensions as you would do for a two-way FE model, and then estimate a random parameters model on the demeaned data. This would

[R] How to create interrupted boxplot

2012-03-12 Thread jianghong deng
Hello, I have created two boxplots with following R code. There is one outlier in B group. The outlier is 33. But the all other data are between 0 to 4. How can I skip y-axis around 5 to 25, and expand 0-4 for this case. Also I want keep the outlier in my boxplot. I want my boxplot look like the

Re: [R] Maximum of remaining elements of vector

2012-03-12 Thread Petr Savicky
On Mon, Mar 12, 2012 at 09:14:43AM -0700, behave14 wrote: > Dear community > > I have the following problem. I'd like to have the maximum of the remaining > elements of a vector. > > ex. > x<-c(1,2,3,4,1,2,3,1,2,1) > > f(x) = c(4,4,4,4,3,3,3,2,2,1) > > where the first element is: max(x[1:leng

Re: [R] Maximum of remaining elements of vector

2012-03-12 Thread David L Carlson
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of behave14 > Sent: Monday, March 12, 2012 11:15 AM > To: r-help@r-project.org > Subject: [R] Maximum of remaining elements of vector > > Dear community > > I have the following pr

Re: [R] barplot and NA

2012-03-12 Thread John D. Muccigrosso
On 12 Mar 2012, at 12:47 , S Ellison wrote: > Yes, to the extent that the default barplot plots the height of the bar so > far as the sum of teh values so far, starting at teh first. For your first > vector, no problem; for your second, the highest value is undefiuned, for the > third, the sum

Re: [R] barplot and NA

2012-03-12 Thread S Ellison
> -Original Message- > Am I wrong that barplot is supposed to just skip NAs, and > continue with the rest of the data in a matrix column? That's > how I read various posts on the subject. > > But that's not what happens for me with R64.app (on a Mac, > obviously). For example: > > d

Re: [R] Get a subset

2012-03-12 Thread Sarah Goslee
You can use gsub() to delete all the characters after the first semicolon by replacing them with "". If you provide the requested reproducible example, I imagine someone will provide you with working code, if reading the help for gsub() isn't enough to get you going. Sarah On Mon, Mar 12, 2012 at

Re: [R] Finding the median

2012-03-12 Thread Kevin E. Thorpe
Also, if it is not homework, why are you reinventing some functionality already in R? R can easily calculate medians for you. Kevin On 03/12/2012 12:35 PM, Sarah Goslee wrote: Did you try what I suggested? If you go to www.rseek.org and search for "odd or even integers" you will get various

[R] I DID IT!

2012-03-12 Thread Nathaniel Saxe
Make A Profit with your own home businesshttp://tiz.co.kr/555cd.php?yppage=a9k2 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

[R] Get a subset

2012-03-12 Thread stella
Hi, I have a list of names (alphanumeric characters) and each row by itself contains a different number of names seperated by a semicolon (";"). There are also rows with no entry. I would like to have the name before the first semicolon in each row, if there is any entry. Does anyone have an idea h

[R] Maximum of remaining elements of vector

2012-03-12 Thread behave14
Dear community I have the following problem. I'd like to have the maximum of the remaining elements of a vector. ex. x<-c(1,2,3,4,1,2,3,1,2,1) f(x) = c(4,4,4,4,3,3,3,2,2,1) where the first element is: max(x[1:length(x]) the second one: max(x[2:length(x)]) the third one: max(x[3:length(x)]) an

Re: [R] Finding the median

2012-03-12 Thread Sarah Goslee
Did you try what I suggested? If you go to www.rseek.org and search for "odd or even integers" you will get various solutions. You could even write your own test by comparing x/2 with round(x/2). Also, it's good form to copy the list on your replies, not just me. Sarah On Mon, Mar 12, 2012 at

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread huang jialin
Mark, It is of great help. Thank you very much. I appreciate it. Sincerely, Jialin Huang On Mon, Mar 12, 2012 at 11:27 AM, Mark Lamias wrote: > cov(A) will compute a covariance matrix of the columns of a matrix A. > > cov(a, b) will compute a covariance of the vectors a and b. > > here are so

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread Mark Lamias
cov(A) will compute a covariance matrix of the columns of a matrix A.   cov(a, b) will compute a covariance of the vectors a and b.   here are some examples:   #create random vectors a=rnorm(10) b=rnorm(10)     > a  [1] -0.3110384 -2.6201009 -1.3078118  1.3384743  2.4032381 -0.7245201  [7]

Re: [R] barplot and NA

2012-03-12 Thread ilai
d2 <- as.matrix(c(2,NA,4)) barplot(d2,beside=T) barplot(c(d2)) barplot(na.omit(d2)) d2[2,] <- 0 barplot(d2) # So barplot is not "stopping" at the first NA (first 2 plots). But what does stacking even mean when you have a missing group in the middle ? you can't expect barplot to know... if yo

Re: [R] Subsetting a data.frame -> Read in with FWF format from .DAT file

2012-03-12 Thread RHelpPlease
Hi Michael, Thanks so much for your detailed reply! I gained a better understanding of the read.fwf function, along with ensuring I better note how these read-in functions convert variables, etc. As well, your tip on removing "format" while converting the PRVDR_NUM variable to numeric (from fac

Re: [R] Finding the median

2012-03-12 Thread Sarah Goslee
Hi, On Mon, Mar 12, 2012 at 12:10 PM, wrote: > I've tried the if function? Its just defining when something is even or odd? R's help system might be useful. www.rseek.org might be useful. You haven't accomplished the second part of my response, and this isn't a homework help list, so you'll ne

Re: [R] Installing RMySQL -- 64-bit Windows 7

2012-03-12 Thread David Winsemius
On Mar 12, 2012, at 12:05 PM, Prof Brian Ripley wrote: On 12/03/2012 15:29, z2.0 wrote: Trying to install RMySQL on 64-bit Windows 7. Using R-2.14.2 with Rtools214 and MySQL Server 5.5. Read through several step-by-steps of RMySQL source installation. Troubleshooting: - Copied libmysql.dll

[R] 2 images on one plot

2012-03-12 Thread Petr PIKAL
Dear all with image I can plot only one set of values in one plot. Do somebody have any insight how to put those 2 matrices into one picture so that in one cell in image picture are both values from mat[1,1] and mat2[1,1]. mat<-matrix(1:4, 2,2) mat2<-matrix(4:1,2,2) x <-1:2 y <-1:2 image(x, y

Re: [R] A question on histogram - area much less than 1

2012-03-12 Thread David L Carlson
You expected the sum to be 1 and it is: > a <- hist(Y1, breaks=seq(0, 350, by=35), col="grey80", freq=FALSE) > a$density*35 [1] 0.27923387 0.14717742 0.09979839 0.08064516 0.06955645 0.06350806 [7] 0.05241935 0.05342742 0.05544355 0.09879032 > sum(a$density*35) [1] 1 Note that the first density

Re: [R] repositories for 2.11 & 2.12

2012-03-12 Thread Uwe Ligges
On 07.03.2012 18:31, Miklós Emri wrote: On 03/07/2012 04:58 PM, Prof Brian Ripley wrote: On 07/03/2012 15:45, Duncan Murdoch wrote: On 12-03-07 7:59 AM, Miklós Emri wrote: Dear experts, I have to install ggplot2 packages for R 2.11 and 2.12 but this is available for 2.14 only. My question:

Re: [R] Installing RMySQL -- 64-bit Windows 7

2012-03-12 Thread Prof Brian Ripley
On 12/03/2012 15:29, z2.0 wrote: Trying to install RMySQL on 64-bit Windows 7. Using R-2.14.2 with Rtools214 and MySQL Server 5.5. Read through several step-by-steps of RMySQL source installation. Troubleshooting: - Copied libmysql.dll to R-2.14.2/bin AND R-2.14.2/bin/i386. - Copied libmys

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread huang jialin
Doran, Thanks for your advice. Sincerely, Jialin Huang On Mon, Mar 12, 2012 at 10:56 AM, Doran, Harold wrote: > Always start with the help page. But, the best way to get help on this > list is to construct some toy data. Even if imperfect, people will work to > help you. Maybe show us some of

Re: [R] Finding the median

2012-03-12 Thread Sarah Goslee
I'd start by using if(). If you can convince the list that this isn't homework, you might get more help. Sarah On Mon, Mar 12, 2012 at 7:15 AM, wrote: > Hi just a quick question in which I must use the "function and return" part > of R. > > If I was asked to define a function called "median"

Re: [R] Window on a vector

2012-03-12 Thread Alaios
You will find here a reprodusible example, and you will also see it "exploding" myData<-seq(1:10) windowList<-list(1,2,3,4) totalLength<- length(myData) windowSize<-30 for (i in 2:length(windowList)) {     myMean<-array()     indexes<-seq(1,totalLength,by=windowSize*windowList[[i]])     for

Re: [R] Draw values from multiple data sets as inputs to a Monte-Carlo function; then apply across entire matrix

2012-03-12 Thread Diann Prosser
Dear all, I have developed a loop but receive an error (error 1 below) because the mcstoc function prohibits arrays. I tried creating an mcnode to represent the data frame, but received Error 2 below (array size not compatible with node dimension). I'm still at a loss on how to apply the Monte-Ca

Re: [R] Window on a vector

2012-03-12 Thread Petr Savicky
On Sat, Mar 10, 2012 at 04:44:00AM -0800, Alaios wrote: > Dear all, > I have a large vector (lets call it myVector) and I want to plot its value > with the logic below > > yaxis<-myVector[1] > yaxis<-c(xaxis,mean(myvector[2:3]) > yaxis<-c(xaxis,mean(myvector[4:8]) > yaxis yaxis > this has to sto

[R] Installing RMySQL -- 64-bit Windows 7

2012-03-12 Thread z2.0
Trying to install RMySQL on 64-bit Windows 7. Using R-2.14.2 with Rtools214 and MySQL Server 5.5. Read through several step-by-steps of RMySQL source installation. Troubleshooting: - Copied libmysql.dll to R-2.14.2/bin AND R-2.14.2/bin/i386. - Copied libmysql.dll and libmysql.lib to MySQL Serv

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread Doran, Harold
Always start with the help page. But, the best way to get help on this list is to construct some toy data. Even if imperfect, people will work to help you. Maybe show us some of your actual data. Of course, if a and b1 are really scalars, I don’t think there is such a thing as the covariance

[R] Finding the median

2012-03-12 Thread elliot.welch
Hi just a quick question in which I must use the "function and return" part of R. If I was asked to define a function called "median" where the function has a single argument x and returns the median value of a vector. How would I go about saying the median = element x in terms of n (say (n + 1

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread huang jialin
Hi, Thanks for your response. I tried to use cov() before, but got NA all over the place. a and b1 are scalars in the example. So that is the problem. I will start over from the formula. Thanks again. Sincerely, Jialin Huang On Mon, Mar 12, 2012 at 10:47 AM, Doran, Harold wrote: > Can you

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread Doran, Harold
Can you provide sample data? This suggests that a and b1, for example, are scalars. If that is what you actually have then you cannot produce a covariance between two scalars. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread R. Michael Weylandt
On Mon, Mar 12, 2012 at 11:42 AM, huang jialin wrote: > Hello, > > I have a vector {a, b1, b2, b3, b4}. What does this mean? Is this a character vector giving names of objects that exist elsewhere in the workspace? Else, how do you tell a/b1/b2 apart in a vector? You probably want ?cov but apply

Re: [R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread Jorge I Velez
?cov HTH, Jorge.- On Mon, Mar 12, 2012 at 11:42 AM, huang jialin <> wrote: > Hello, > > I have a vector {a, b1, b2, b3, b4}. How can I calculate the following > matrix: > > var(a) cov(a, b1) cov(a, b2) cov(a, b3) cov(a, b4) > cov(a, b1) var(b1) cov(a, b2) cov(a, b3) cov(a, b4) > ... > ..

[R] how to calculate a variance and covariance matrix for a vector

2012-03-12 Thread huang jialin
Hello, I have a vector {a, b1, b2, b3, b4}. How can I calculate the following matrix: var(a) cov(a, b1) cov(a, b2) cov(a, b3) cov(a, b4) cov(a, b1) var(b1) cov(a, b2) cov(a, b3) cov(a, b4) ... ... cov(a, b1) cov(a, b2) cov(a, b3) cov(a, b4) var(b4) I would very appreciate your inputs.

Re: [R] Window on a vector

2012-03-12 Thread R. Michael Weylandt
It's not always true that going out of bounds in subscripting gives an error (as you seem to assert in your original post) x <- 1:3 x[4] # No error and note that mean() has a na.rm argument. Perhaps you should construct a *reproducible* example of what you think will go wrong. Michael On Mon,

Re: [R] Window on a vector

2012-03-12 Thread Alaios
Yep I did some mistake while I was typing the example What I want is this one cbind(2^(0:(n-1))) and  the problem is that at the last "window" this is going to explode are there will be less elements than what the window asks for. How should I deal with that? Regards Alex _

Re: [R] (no subject)

2012-03-12 Thread Milan Bouchet-Valat
Le lundi 12 mars 2012 à 14:48 +, aoife doherty a écrit : > Hey guys, > > if i do a correspondance analysis, e.g.: > > table <- structure(c(4, 7, 0.2, 3, .1, 7, 222, 3, 10, 5, 11, >8, 8, 10, 7), .Dim = c(5L, 3L), .Dimnames = list(c("gene1", >"gene2", "gene3", "gene4", "gene5"), c("codo

[R] (no subject)

2012-03-12 Thread aoife doherty
Hey guys, if i do a correspondance analysis, e.g.: table <- structure(c(4, 7, 0.2, 3, .1, 7, 222, 3, 10, 5, 11, 8, 8, 10, 7), .Dim = c(5L, 3L), .Dimnames = list(c("gene1", "gene2", "gene3", "gene4", "gene5"), c("codon1", "codon2", "codon3"))) Library(ca) plot(ca(table)) is there a way

[R] Replicating Stata's xtreg clustered SEs in R

2012-03-12 Thread Millo Giovanni
Hello David. Usually I'd ask for a reproducible example (see the posting guide), but as I routinely check my results against Stata, this time I think I know what happens already. There are two issues here: one is cluster-robust covariance estimation, which in Stata is done through 'vce(cluster )'

Re: [R] extracting data from unstructured (text?) file

2012-03-12 Thread jim holtman
On Sun, Mar 11, 2012 at 9:21 PM, frauke wrote: > Wow Jim, this is much more than I expected. Thank you!! > > It took me a while to figure out what exactly you are doing in that code. > But I think I understand and it definitely runs. May I ask you two follow up > questions? > > First, some of my f

Re: [R] SEM eigen value error 0 X 0 matrix

2012-03-12 Thread John Fox
Dear Jessica, As you can see, it's a little hard to look at your commands because of the lack of newlines, and you also don't give data, so one can't tell which variables are latent and which observed, but I'm going to guess that this is a latent-variable model with factors belonging, autonomy, op

Re: [R] max.print

2012-03-12 Thread Martin Maechler
> Peter Ehlers > on Sat, 10 Mar 2012 11:04:06 -0800 writes: > On 2012-03-10 08:35, sybil kennelly wrote: >> Dear all. >> >> I wanted to read in a 20,000 row X 60 column matrix >> (called "table") into R. >> >> i did this: >> >>> R table<- read.ta

Re: [R] resume on error

2012-03-12 Thread R. Michael Weylandt
Close the device anyways; test for an error as Sarah (and the help pages) describe and use unlink() to delete the resultant (empty) file if the plot call fails. Michael On Mon, Mar 12, 2012 at 8:30 AM, Alaios wrote: > Thanks a lot for the answer.. > As you can see my chain is the following > op

Re: [R] Problems when building a package for Windows 64

2012-03-12 Thread Eduardo Mendes
Ok. On Mon, Mar 12, 2012 at 8:17 AM, Duncan Murdoch wrote: > On 12-03-11 4:30 PM, Eduardo Mendes wrote: > >> Dear Prof. Ripley >> >> Many thanks. rtools 2.15 did the job. >> >> One note if I may - In the rtools site one reads >> >> rtools215.exe - r>2.14.1 to R 2.15.x No >> rtoosl214.exe - r 2.13

Re: [R] resume on error

2012-03-12 Thread Alaios
Thanks a lot for the answer.. As you can see my chain is the following open a pdf device. plot and close the device pdf(file=filename, width=width) try(plot_per_band_ (list(get(varlist[[k]])), i, j,meanPlot=TRUE)) dev.off() I would like if plot fails (so try returns try-error) the file to not b

Re: [R] removing values from a survival curve

2012-03-12 Thread Terry Therneau
On Sat, 2012-03-10 at 12:00 +0100, r-help-requ...@r-project.org wrote: > Hi All, > > s = Surv(outcome.[,1], outcome.[,2]) > survplot= (survfit(s ~ person.list[,1])) > > summary(survplot) > > This prints a summary of all the curves at specified

Re: [R] resume on error

2012-03-12 Thread Sarah Goslee
On Mon, Mar 12, 2012 at 4:39 AM, Alaios wrote: > Thanks a lot. > How I can use try though for plots. There are times where the plot function > will fail > >  pdf(file=filename, width=width) >  try(plot_per_band(list(get(varlist[[k]])), i, j, l, > datalabels=seq(1:length(varlist > dev.off() >

Re: [R] Problems when building a package for Windows 64

2012-03-12 Thread Duncan Murdoch
On 12-03-11 4:30 PM, Eduardo Mendes wrote: Dear Prof. Ripley Many thanks. rtools 2.15 did the job. One note if I may - In the rtools site one reads rtools215.exe - r>2.14.1 to R 2.15.x No rtoosl214.exe - r 2.13.x or R.2.14.x yes which can mislead the reader. 2.14.x could mean 2.14.2 But as

[R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-12 Thread Helios de Rosario
I have encountered a problem with faceted bar plots. I have tried to create something like the example explained in the ggplot2 book (see pp. 126-128): library(ggplot2) mpg4 <- subset(mpg, manufacturer %in% c("audi", "volkswagen", "jeep")) mpg4$manufacturer <- as.character(mpg4$manufacture

Re: [R] xyplot without external box

2012-03-12 Thread Mauricio Zambrano-Bigiarini
2012/3/12 David Winsemius : > > On Mar 12, 2012, at 4:29 AM, Mauricio Zambrano-Bigiarini wrote: > >> 2012/3/9 David Winsemius : >>> >>> >>> On Mar 8, 2012, at 8:02 AM, Mauricio Zambrano-Bigiarini wrote: >>> Dear list members, Within a loop, I need to create an xyplot with only a lege

Re: [R] ggplot2: coord_polar

2012-03-12 Thread Athula Herath
Thank you Jeff, I took the short-cut and updated R to R-2.14.2 and it works too. A. On 12 March 2012 06:43, Jeff Newmiller wrote: > Works for me on Windows XP with R 2.14.1 (not patched). > > You may be too far out on the bleeding edge. Upgrading to 2.14.2 is > probably the best first step. If

Re: [R] xyplot without external box

2012-03-12 Thread Mauricio Zambrano-Bigiarini
2012/3/9 David Winsemius : > > On Mar 8, 2012, at 8:02 AM, Mauricio Zambrano-Bigiarini wrote: > >> Dear list members, >> >> Within a loop, I need to create an xyplot with only a legend, not even >> with the default external box drawn by lattice. >> >> I already managed to remove the axis labels and

Re: [R] xyplot without external box

2012-03-12 Thread Mauricio Zambrano-Bigiarini
2012/3/9 Greg Snow <538...@gmail.com>: > Why do you want to do this?  Lattice was not really designed to put > just part of the graph up, but rather to create the entire graph using > one command. To make a long story short, you are right, I need to do this because my knowledge with trellis graphi

Re: [R] A question on histogram - area much less than 1

2012-03-12 Thread Rolf Turner
On 12/03/12 21:44, jpm miao wrote: Hello, Thanks very much for your kind response. Yes, if I multiply by the width "35", the area should be equal to one. How can I plot the probability bars rather than density bars? That is, I would like the height of the first bar to be 0.279, which i

Re: [R] xyplot without external box

2012-03-12 Thread David Winsemius
On Mar 12, 2012, at 4:29 AM, Mauricio Zambrano-Bigiarini wrote: 2012/3/9 David Winsemius : On Mar 8, 2012, at 8:02 AM, Mauricio Zambrano-Bigiarini wrote: Dear list members, Within a loop, I need to create an xyplot with only a legend, not even with the default external box drawn by latt

Re: [R] A question on histogram - area much less than 1

2012-03-12 Thread jpm miao
Hello, Thanks very much for your kind response. Yes, if I multiply by the width "35", the area should be equal to one. How can I plot the probability bars rather than density bars? That is, I would like the height of the first bar to be 0.279, which is the probability that the variable fall

Re: [R] resume on error

2012-03-12 Thread Alaios
Thanks a lot. How I can use try though for plots. There are times where the plot function will fail  pdf(file=filename, width=width)  try(plot_per_band(list(get(varlist[[k]])), i, j, l, datalabels=seq(1:length(varlist dev.off() the code above does not print anything. B.R Alex __

Re: [R] A question on histogram - area much less than 1

2012-03-12 Thread Rolf Turner
Why do you say that the area is much lower than 1? It is exactly equal to 1. How did you calculate this area? Your code seems extremely convoluted and confused. You could construct your (rather bizarre) vector Y1 much more simply as Y1 <- rep((0.5 + 0:9)*35,c(277,146,99,80,69,63,52,53,55,98))

[R] barplot and NA

2012-03-12 Thread John D. Muccigrosso
Am I wrong that barplot is supposed to just skip NAs, and continue with the rest of the data in a matrix column? That's how I read various posts on the subject. But that's not what happens for me with R64.app (on a Mac, obviously). For example: d0 <- as.matrix(c(2,3,4)) d1 <- as.matrix(c(2,3,N

[R] Replicating Stata's xtreg clustered SEs in R

2012-03-12 Thread David A. Kim
I'm trying to replicate a time-series cross-sectional analysis (countries over years) with SEs clustered by country.  The original analysis was done in Stata 10 with: xtreg [DV] [IVs] fe cluster(country). Using plm() in R (cran.r-project.org/web/packages/plm/index.html), I've replicated the coeffi

  1   2   >