Re: [R] Installing package in windows 7

2011-01-20 Thread Tal Galili
You probably need to get your users permissions (in win 7) set properly... Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |

[R] adding text to y-axis per row of panels (lattice)

2011-01-20 Thread E Hofstadler
Dear all, Being a newbie to R, I've trawled through many old posts on this list looking for a solution to my problem, but unfortunately couldn't quite figure it out myself. I'd be very grateful if someone here on this list could perhaps help me out. I have a lattice plot with several panels and

[R] subsets

2011-01-20 Thread Den
Dear R people Could you please help. Basically, there are two variables in my data set. Each patient ('id') may have one or more diseases ('diagnosis'). It looks like id diagnosis 1 ah 2 ah 2 ihd 2 im 3 ah 3 stroke 4 ah 4 ihd 4 angina 5

[R] reading in time series

2011-01-20 Thread tluedeke
This is causing me great consternation, and I've spent too much time floundering around on it. My data is in the form of columns in Excel, with the first column being in m/dd/ hh:mm format. The spreadsheet is complicated (headers, merged cells, lines w/o data); so I've tried various ways of

[R] Problems with ecodist

2011-01-20 Thread deyan
Dear Dr.Goslee and anyone may intrested in matrix manipulate, I am using your ecodist to do mantel and partial mantel test, I have locality data and shape variation data, and the two distance matrixs are given as belowings. When I run the analysis, it is always report that the matrix is not

Re: [R] subsets

2011-01-20 Thread Ivan Calandra
Hi! I think you should read the intro to R, as well as ?[ and ?subset. It should help you to understand. Let's say your data is in a data.frame called df: # 1. ah and ihd df_ah_ihd - df[df$diagnosis==ah | df$diagnosis==ihd, ] ## the | is the boolean OR (you want one OR the other). Note the

[R] fix sign of a coefficient in formula

2011-01-20 Thread Peter Schmidtke
Dear R users experts, I'd like to create a model using lm (or glm) under some constraints of how coefficients for each component could look like (sort of a range of coefficients that should be allowed). So let's go for an example : model=lm(age ~ eyecolor + height, data=inputdata) So let's

Re: [R] Installing package in windows 7

2011-01-20 Thread Prof Brian Ripley
On Thu, 20 Jan 2011, Tal Galili wrote: You probably need to get your users permissions (in win 7) set properly... I see no evidence that is the issue That site seems to be offering only source packages. So in Windows you need install.packages(ei,repos=http://r.iq.harvard.edu;,

[R] Using a list as multidimensional indexer

2011-01-20 Thread Nick Sabbe
Hello list. Another 'puzzle' for which I don't have a clean solution. Say I have a multidimensional object, e.g.: Mm-matrix(1:6, nrow=2, dimnames=list(c(a,b), c(g,h,i))) And on the other hand I have a list Ind-list(b,g) This holds, for each dimension, an indexer for that dimension. Now I would

Re: [R] Using a list as multidimensional indexer

2011-01-20 Thread Prof Brian Ripley
On Thu, 20 Jan 2011, Nick Sabbe wrote: Hello list. Another 'puzzle' for which I don't have a clean solution. Say I have a multidimensional object, e.g.: Mm-matrix(1:6, nrow=2, dimnames=list(c(a,b), c(g,h,i))) And on the other hand I have a list Ind-list(b,g) This holds, for each dimension, an

Re: [R] fix sign of a coefficient in formula

2011-01-20 Thread Prof Brian Ripley
Fitting a linear model with constraints is a completely different task from fitting one without -- and it is the fit you want to constrain, not the formula. See CRAN package nnls to fit a linear model with sign constraints. If you have range constraints you can use nls(algorithm=port) since

Re: [R] Using a list as multidimensional indexer

2011-01-20 Thread Nick Sabbe
Hm. I got somewhat further: Ind2-list(Mm,b,g) do.call([,Ind2) Seems to work. However, now I need it one step beyond: in fact, my actual multidimensional object holds one dimension more than my list holds indexes. i.e.: I want the equivalent of Mm[a,]. I tried some variants of

Re: [R] spacing of color key in filled.contour

2011-01-20 Thread Jim Lemon
On 01/20/2011 09:19 AM, claudia tebaldi wrote: Hi all I'm plotting colored contour maps using filled.contour. My levels are very unevenly spaced, with, say, high resolution in the small numbers but ranges that can be an order of magnitude or two larger in absolute value compared to where the

Re: [R] subsets

2011-01-20 Thread Keith Jewell
I don't think Ivan's solution meets the OP's needs. I think you could do it using %in% and the approriate logical operations e.g. aDF - data.frame(id=c(1,2,2,2,3,3,4,4,4,5), diagnosis=c(ah, ah, ihd, im, ah, stroke, ah, ihd, angina, ihd)) aDF[with(aDF,(id %in% id[diagnosis==ah]) (id %in%

Re: [R] subsets

2011-01-20 Thread Henrique Dallazuanna
Try this: lapply(list(c('ah', 'ihd'), 'ah', 'ihd'), function(x)subset(aDF, diagnosis == x)) On Thu, Jan 20, 2011 at 6:53 AM, Den d.kazakiew...@gmail.com wrote: Dear R people Could you please help. Basically, there are two variables in my data set. Each patient ('id') may have one or more

Re: [R] ggplot2, geom_hline and facet_grid

2011-01-20 Thread Sandy Small
Thank you. That seems to work - also on my much larger data set. I'm not sure I understand why it has to be defined as a factor, but if it works... Sandy Dennis Murphy wrote: Hi Sandy: I can reproduce your problem given the data provided. When I change ecd_rhythm

[R] puzzled with plotmath

2011-01-20 Thread Claudia Beleites
Dear all, I'm puzzled with matrix indices in plotmath. I'm plotting matrix elements: Z [i, i], and I'd like to put that as label. I'll describe what I want and what I get in LaTeX-notation. The output should look like Z_{i, i}, and my first try was plot (1, 1, ylab = expression (Z[i, i]))

[R] puzzled with plotmath II

2011-01-20 Thread Claudia Beleites
sorry, I forgot my sessionInfo: please see below. Original Message Subject: puzzled with plotmath Date: Thu, 20 Jan 2011 12:48:18 +0100 From: Claudia Beleites cbelei...@units.it To: R Help r-help@r-project.org Dear all, I'm puzzled with matrix indices in plotmath. I'm

Re: [R] Problems with ecodist

2011-01-20 Thread Sarah Goslee
Hi, If you read the help for mantel, it says that the data must be either vectors of dissimilarities or objects of class dist. Since you are reading in your data as full symmetric matrices, you have two options: mantel(as.dist(distancematrix) ~ as.dist(distancematrix1)) mantelr pval1

Re: [R] puzzled with plotmath II

2011-01-20 Thread Gerrit Eichner
Try plot (1, 1, ylab = expression (Z[list(i,i)])) Hth -- Gerrit Original Message Subject: puzzled with plotmath Date: Thu, 20 Jan 2011 12:48:18 +0100 From: Claudia Beleites cbelei...@units.it To: R Help r-help@r-project.org Dear all, I'm puzzled with matrix indices in

Re: [R] Loading wordnet in R

2011-01-20 Thread Uwe Ligges
On 18.01.2011 07:42, fayazvf wrote: I ve installed wordnet 2.1 and R 2.11.0 on windows 7. Whenver i try to load wordnet in R, i get an error initDict() FALSE cannot find wordnet 'dict' directory, Please set the WNHOME variable to its parent. I have tried setting WNHOME to C:\Program Files

[R] Generating time progressing line for Google Earth

2011-01-20 Thread fbielejec
Dear, I am trying to visualise a time-progressing line (it's supposed to represent spread patterns) using brew package and Google Earth. The idea is to have a function which takes start and end point geographic coordinates, as well as number of intervals to chop the path up, and returns the

Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Claudia Beleites
Gerrit, thanks viele Grüße nach Oberhessen :-) plot (1, 1, ylab = expression (Z[list(i,i)])) though that cannot be evaluated, either (due to [ not knowing what to do with an index list) for future searches: probably the easiest cheat is, of course, plot (1, 1, ylab = expression (Z[i, i]))

Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Uwe Ligges
On 20.01.2011 14:08, Claudia Beleites wrote: Gerrit, thanks viele Grüße nach Oberhessen :-) plot (1, 1, ylab = expression (Z[list(i,i)])) though that cannot be evaluated, either (due to [ not knowing what to do with an index list) Works for me with a recent R version. for future

Re: [R] reading in time series

2011-01-20 Thread jim holtman
Is this what you are trying to do: x - read.table(textConnection(3/23/2010 20:55, -0.10655, -0.121454561, -0.12032, -0.111680001,-0.122429997 + 3/23/2010 21:25, -0.099166997, -0.114189997, -0.11287, -0.104647976,-0.114720002), sep = ',', as.is = TRUE) closeAllConnections()

Re: [R] puzzled with plotmath II

2011-01-20 Thread Peter Ehlers
On 2011-01-20 04:09, Gerrit Eichner wrote: Try plot (1, 1, ylab = expression (Z[list(i,i)])) Hth -- Gerrit Original Message Subject: puzzled with plotmath Date: Thu, 20 Jan 2011 12:48:18 +0100 From: Claudia Beleitescbelei...@units.it To: R Helpr-help@r-project.org

Re: [R] reading in time series

2011-01-20 Thread Mogguy
You have to tell R that a column has date/time content. Here is an example: test-3/23/2010 20:55 #this is your format as.POSIXct(test, format=%m/%d/%Y %H:%M) #with the format parameter you tell R how to interpret your data ___ Moritz Grenke http://www.360mix.de

[R] Saving a webpage, when content is generated by javascript

2011-01-20 Thread YuriWerewolf
Hi to all members of this group, how can i download a webpage using R (html), which is generated using javasript when trying to open that webpage in the browser? When i try to save the page as text file i get only some java code inside, not the actual data. When opening website in the browser

Re: [R] subsets

2011-01-20 Thread Taras Zakharko
Hello Den, your problem is not as it may seem so Ivan's suggestion is only a partial answer. I see that each patient can have more then one diagnosis and I take that you want to isolate patients based on particular conditions. Thus, simply looking for ah or idh as Ivan suggests will yield

[R] selecting predictors for model from dataframe

2011-01-20 Thread Sander van Kuijk
Dear all, I think I have a rather strange question, but I'd like to give it a try: I want to perform a simulation numerous times, thats why I can't do it by hand. I sample a small dataset from a very large one, and use backward selection to select significant predictors for some arbitrary

Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Claudia Beleites
On 01/20/2011 02:11 PM, Uwe Ligges wrote: On 20.01.2011 14:08, Claudia Beleites wrote: Gerrit, thanks viele Grüße nach Oberhessen :-) plot (1, 1, ylab = expression (Z[list(i,i)])) though that cannot be evaluated, either (due to [ not knowing what to do with an index list) Works for me

Re: [R] subsets

2011-01-20 Thread Keith Jewell
I did try it. It gave me [[1]] id diagnosis 1 1ah 5 3ah 7 4ah 8 4 ihd 10 5 ihd [[2]] id diagnosis 1 1ah 2 2ah 5 3ah 7 4ah [[3]] id diagnosis 3 2 ihd 8 4 ihd 10 5 ihd Which isn't what

Re: [R] subsets

2011-01-20 Thread Ivan Calandra
Hi Taras, Indeed, I've overlooked the problem. Anyway, I'm not sure I would have been able to give a complete answer like you did! Ivan Le 1/20/2011 11:05, Taras Zakharko a écrit : Hello Den, your problem is not as it may seem so Ivan's suggestion is only a partial answer. I see that each

Re: [R] Installing package in windows 7

2011-01-20 Thread Haseeb Mahmud
Prof. Brian Ripley and Tal Galili, Thanks for your replies. I cannot make the *install.packages(ei,repos=http://r.iq.harvard.edu;, type='source')* command work. Alternatively, I can find the way (thanks to stackoverflow guys) I can install that file from a local repo. For the sake of record,

Re: [R] subsets

2011-01-20 Thread Petr Savicky
On Thu, Jan 20, 2011 at 10:53:01AM +0200, Den wrote: Dear R people Could you please help. Basically, there are two variables in my data set. Each patient ('id') may have one or more diseases ('diagnosis'). It looks like iddiagnosis 1 ah 2 ah 2 ihd 2 im 3 ah

[R] calculation correlation and p-values of genes using rcorr function

2011-01-20 Thread Stuart
Hi I want to do correlation of genes but I need to know p-values to construct netwrok based on correlation. But I,m getting too many zero for some reasons. I read one paper and they did analysed their data by :: 1- R values 2-P-values 3-Spearman p values - FDR corrected (Bejamini-Hochberg) Do

Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Gerrit Eichner
Claudia, Mittelhessen! ;-) thanks viele Grüße nach Oberhessen :-) plot (1, 1, ylab = expression (Z[list(i,i)])) though that cannot be evaluated, either (due to [ not knowing what to do with an index list) Something is missing; this last sentence of yours appears to be not complete,

Re: [R] subsets

2011-01-20 Thread Peter Ehlers
On 2011-01-20 02:05, Taras Zakharko wrote: Hello Den, your problem is not as it may seem so Ivan's suggestion is only a partial answer. I see that each patient can have more then one diagnosis and I take that you want to isolate patients based on particular conditions. Thus, simply looking

Re: [R] MCMC object indexing

2011-01-20 Thread Ben Bolker
Robinson, David G drobin at sandia.gov writes: I have an mcmc object and I'm trying to plot the quantiles of the variables - and not as a function of the iterations as in cumuplot. I cannot seem to find the right combination of indexing to access the variables; after which I'm sure I

Re: [R] Odp: Relative frequency on a character vector

2011-01-20 Thread Ista Zahn
Hi, On Tue, Jan 18, 2011 at 3:48 PM, ADias diasan...@gmail.com wrote: I have done like this to get the result I need more directly A-c(Tell me how many different letter this vector has?) prop.table(table(strsplit(A,)))        ?    a    c    d    e    f    h    i    l    m    n    o    r    

Re: [R] CCF and missing values.

2011-01-20 Thread Peter Ehlers
On 2011-01-19 08:48, Paul Ossenbruggen wrote: Hi, I have missing values in my time series. na.action = na.pass works for acf and pacf. Why do I get the following error for the ccf? ts(matrix(c(dev$u[1:10],dev$q[1:10]),ncol=2),start=1,freq=1) Time Series: Start = 1 End = 10

Re: [R] puzzled with plotmath II

2011-01-20 Thread Claudia Beleites
Peter, Look for 'comma-separated list' on the help page!! Yes, seeing the solution I also understand why list is the solution. The special meaning of list () in plotmath was only in my passive vocabulary - and after this discussion I think it is upgraded to active ;-) I have to admit that

[R] Obtaining a quadratic function igven three points on a curve

2011-01-20 Thread Barth B. Riley
Hello I would like to obtain the coefficients for a quadratic function (ax^2 + bx + c) given three sets of points on the quadratic curve. For instance: Y X 0.1595290 0.5 0.773019 1 1 Is there a function in R to

[R] Bandwidth - Kernel Density Estimation

2011-01-20 Thread Amelia Vettori
Dear R helpers I am having recovery rates as given below and I am trying to estimate the Loss Given Default (LGD) and for this I am using Kernel Density estimation method. recovery_rates = c(0.61,0.12,0.10,0.68,0.87,0.19,0.84,0.81,0.87,0.54,0.08,0.65,0.91,

Re: [R] Obtaining a quadratic function igven three points on a curve

2011-01-20 Thread Joshua Wiley
Hi Barth, Here is an option fitting a linear model toa second order polynomial and extracting the coefficients. The Intercept corresponds to c in your email, then poly(...)1 to b and poly(...)2 to a. dat - read.table(textConnection( Y X 0.159529 0 0.5 0.773019 1 1), header =

[R] syntax for a list of components from a list

2011-01-20 Thread Maas James Dr (MED)
I'm attempting to generalise a function that reads individual list components, in this case they are matrices, and converts them into 3 dimensional array. I can input each matrix individually, but want to do it for about 1,000 of them ... This works array2 -

[R] Identify duplicate numbers and to increase a value

2011-01-20 Thread Ortiz, John
Hi everybody. I want to identify duplicate numbers and to increase a value of 0.01 for each time that it is duplicated. Example: x=c(1,2,3,5,6,2,8,9,2,2) I want to do this: 1 2 + 0.01 3 5 6 2 + 0.02 8 9 2 + 0.03 2 + 0.04 I am trying to get something like this: 1 2.01 3 5 6 2.02 8 9 2.03

Re: [R] Accessing MySQL Database in R

2011-01-20 Thread PtitBleu
Hello, I used to use RMySQL but as there is no more package for windows, I decided to move to RODBC. I installed ODBC driver for MySQL (downloaded on the MySQL website) and then the RODBC package. I finally discovered that it was not needed to register your database with ODBC before using it.

Re: [R] Using anova() with glmmPQL()

2011-01-20 Thread Toby Marthews
Hi Ben Bolker, Just to say thank you VERY much for the reply below and for taking the time to go through my code. I think you're absolutely right and I have been using the wrong formula completely. I have been trying out several more examples (am still struggling with this) and will submit any

[R] Writing functions. please help

2011-01-20 Thread guilherme dantas
Hi, my name is Guilherme and I'm trying to solve an optimization problem in R, regarding reliability and survival time of equipments. I Have to write the function in the image attached to this email, please take a look, where the f(t) is weibull's distribution density function, Ca=1000 and Cb=100

Re: [R] Obtaining a quadratic function igven three points on a curve

2011-01-20 Thread David Scott
I think you need poly(X, 2, raw = TRUE) to interpret the coefficients in the manner described below. poly uses orthogonal polynomials by default: poly package:stats R Documentation Compute Orthogonal Polynomials Description: Returns or evaluates

Re: [R] Obtaining a quadratic function igven three points on a curve

2011-01-20 Thread Joshua Wiley
Many thanks for the correction David. Josh On Thu, Jan 20, 2011 at 7:17 AM, David Scott d.sc...@auckland.ac.nz wrote: I think you need poly(X, 2,  raw = TRUE) to interpret the coefficients in the manner described below. poly uses orthogonal polynomials by default: poly                  

Re: [R] syntax for a list of components from a list

2011-01-20 Thread Joshua Wiley
Hi, On Thu, Jan 20, 2011 at 6:59 AM, Maas James Dr (MED) j.m...@uea.ac.uk wrote: I'm attempting to generalise a function that reads individual list components, in this case they are matrices, and converts them into 3 dimensional array.  I can input each matrix individually, but want to do it

Re: [R] Obtaining a quadratic function given three points on a curve

2011-01-20 Thread Barth B. Riley
Thanks Josh and David Barth PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread Moritz Grenke
If you haven't got so much data a loop should do: while(sum(duplicated(x))0) #if this condition is TRUE then there are still duplicates in x { x[duplicated(x)] - x[duplicated(x)]+0.01 #using duplicated(x) to index the x vector } Hope this helps, Regards Moritz

[R] How to reshape wide format data.frame to long format?

2011-01-20 Thread Fredrik Karlsson
Dear list, I need to convert this data.frame names(codesM) [1] keyAMR.pa1.M AMR.pa2.M AMR.pa3.M AMR.pa4.M [6] AMR.pa5.M AMR.pa6.M AMR.pa7.M AMR.pa8.M AMR.pa9.M [11] AMR.pa10.M AMR.ta1.M AMR.ta2.M AMR.ta3.M AMR.ta4.M [16] AMR.ta5.M AMR.ta6.M AMR.ta7.M AMR.ta8.M AMR.ta9.M

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread Joshua Wiley
Hi John, If you only have one duplicated number (e.g., just 2), then this will work: x - c(1,2,3,5,6,2,8,9,2,2) xd - duplicated(x) x[xd] - x[xd] + seq(sum(xd))/100 x otherwise, I think a different framework than duplicated() will be necessary, because it will matter not just if the number is

Re: [R] How to reshape wide format data.frame to long format?

2011-01-20 Thread Abhijit Dasgupta
I would think that the following code should work: newcodesM = reshape(codesM, id=1) If other variables in the data.frame are factors, reshape thinks all of them are ID variables and tries to use all of them as keys. Specifying the id variable you want to keep (I used id=1 since key is in the

Re: [R] How to reshape wide format data.frame to long format?

2011-01-20 Thread Abhijit Dasgupta
As for your second question, you could certainly do newcodesM = transform(newcodesM, variable1 = unlist(strsplit(variable,'\\.'))[1], variable2 = unlist(strsplit(variable, '\\.'))[2], variable3 = unlist(strsplit(variable,'\\.'))[3]) though I'm sure there is a more efficient use of strsplit in

Re: [R] circular reference lines in splom

2011-01-20 Thread Peter Ehlers
On 2011-01-19 20:15, Max Kuhn wrote: Hello everyone, I'm stumped. I'd like to create a scatterplot matrix with circular reference lines. Here is an example in 2d: library(ellipse) set.seed(1) dat- matrix(rnorm(300), ncol = 3) colnames(dat)- c(X1, X2, X3) dat- as.data.frame(dat) grps-

Re: [R] How to reshape wide format data.frame to long format?

2011-01-20 Thread David Winsemius
On Jan 20, 2011, at 10:51 AM, Fredrik Karlsson wrote: Dear list, I need to convert this data.frame names(codesM) [1] keyAMR.pa1.M AMR.pa2.M AMR.pa3.M AMR.pa4.M [6] AMR.pa5.M AMR.pa6.M AMR.pa7.M AMR.pa8.M AMR.pa9.M [11] AMR.pa10.M AMR.ta1.M AMR.ta2.M AMR.ta3.M AMR.ta4.M

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ortiz, John Sent: Thursday, January 20, 2011 7:13 AM To: r-help@r-project.org Subject: [R] Identify duplicate numbers and to increase a value Hi everybody. I want to

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread Henrique Dallazuanna
Try this: replace(x + ave(x, x, FUN = seq) * .01, !(duplicated(x) | duplicated(x, fromLast = TRUE)), x) On Thu, Jan 20, 2011 at 1:12 PM, Ortiz, John ort...@si.edu wrote: Hi everybody. I want to identify duplicate numbers and to increase a value of 0.01 for each time that it is duplicated.

Re: [R] Accessing MySQL Database in R

2011-01-20 Thread Spencer Graves
The following worked for me recently: library(RMySQL) MySQL. - MySQL() MySQLcon - dbConnect(MySQL., user='thisuser', password='thispassword', dbname='desiredDB') I have the following suggestions and questions for you: 1. Have you tried

[R] Scale of 2nd y-axis

2011-01-20 Thread Andy Aldersley
Dear list, My query follows on from a question I posted a few days ago. I have the following 2 sets of data: wetMeans[1] 9.904762[2] 6.344828[3] 6.346154[4] 6.855769[5] 9.074324[6] 9.953988[7] 13.482966[8] 14.546053[9] 10.841584[10] 9.752033[11] 6.739336[12] 8.955056burnMeans[1] 0.06214286[2]

[R] Select unique point occurences per pixel - raster package (?) question

2011-01-20 Thread Diederik Strubbe
Dear all, This may be a simple question, but I cannot find the solution. I have a point shapefile containing several hundreds of points, and a grid file with a certain pixels size. Certain grid cells have several points falling into them. I am looking for a way to randomly select one point

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread James Lawrence
Hello John, If many numbers are duplicated, then one way is to coerce to a factor and use the levels() function. For instance: x - c(1,1,2,2,2,3,3,4,1,1,2,4) X - factor(x) for (i in levels(X)) { loc - (X==i); len = length(loc) x[loc] - x[loc] + 0.01 * (1:len) } x [1] 1.01 1.02

Re: [R] MCMC object indexing

2011-01-20 Thread Robinson, David G
Stoker, Ben wrote: A reproducible example would be very useful. In general I find that I can just index an mcmc object as though it were a matrix, e.g.: z - cbind(a=runif(20),b=runif(20),c=runif(20)) library(coda) m - mcmc(data=z) t(apply(m,2,quantile,c(0.025,0.975))) If that sort

[R] Constrained Regression

2011-01-20 Thread Jackie Chen
Hi everyone, I'm trying to perform a linear regression y = b1x1 + b2x2 + b3x3 + b4x4 + b5x5 while constraining the coefficients such that -3 = bi = 3, and the sum of bi =1. I've searched R-help and have found solutions for constrained regression using quadratic programming (solve.QP) where the

Re: [R] spacing of color key in filled.contour

2011-01-20 Thread Clint Bowman
I've gotten good results using the sine function to map colors. For example, when plotting x, map the range(x) to (-pi/2,pi/2) which the sine will transform to (-1,1), then add 1 and multiply by half the desired number of colors. Now the integer values will pick the colors and give a pleasing

Re: [R] Scale of 2nd y-axis

2011-01-20 Thread Moritz Grenke
Hi Andy, this is my way of doing it: #first data: wetMeans-c(9.904762,6.344828,6.346154,6.855769,9.074324,9.953988,13.482966, 14.546053,10.841584,9.752033,6.739336,8.955056) burnMeans-c(0.06214286,0.05396552,0.04096154,0.05302885,0.05831081,0.073926

Re: [R] Identify duplicate numbers and to increase a value

2011-01-20 Thread Gabor Grothendieck
On Thu, Jan 20, 2011 at 10:12 AM, Ortiz, John ort...@si.edu wrote: Hi everybody. I want to identify duplicate numbers and to increase a value of 0.01 for each time that it is duplicated. Example: x=c(1,2,3,5,6,2,8,9,2,2) I want to do this: 1 2 + 0.01 3 5 6 2 + 0.02 8 9 2 + 0.03

[R] Procuct of a sequence or vector

2011-01-20 Thread Jannis
Dear list, is there a function in R that returns the product of a vector? E.g. if the vector is c(1,2,3,4) it should return 1*2*3*4=24 Cheers Jannis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] function of probability for normal distribution

2011-01-20 Thread Greg Snow
Jeremy, I don't seem to remember signing up to have R-help be my personal e-mail :-) It is common to use phi to represent the standard normal distribution (with mean 0, and variance 1), the script/small/lower case version is for the distribution (height of the bell curve) and the

Re: [R] Procuct of a sequence or vector

2011-01-20 Thread jim holtman
Is this what you want: prod(c(1,2,3,4)) [1] 24 On Thu, Jan 20, 2011 at 12:18 PM, Jannis bt_jan...@yahoo.de wrote: Dear list, is there a function in R that returns the product of a vector? E.g. if the vector is c(1,2,3,4) it should return 1*2*3*4=24 Cheers Jannis

Re: [R] Procuct of a sequence or vector

2011-01-20 Thread Henrique Dallazuanna
Take a look in prod function: prod(1:4) On Thu, Jan 20, 2011 at 3:18 PM, Jannis bt_jan...@yahoo.de wrote: Dear list, is there a function in R that returns the product of a vector? E.g. if the vector is c(1,2,3,4) it should return 1*2*3*4=24 Cheers Jannis

[R] randomForest: too many elements specified?

2011-01-20 Thread Czerminski, Ryszard
I getting Error in matrix(0, n, n) : too many elements specified while building randomForest model, which looks like memory allocation error. Software versions are: randomForest 4.5-25, R version 2.7.1 Dataset is big (~90K rows, ~200 columns), but this is on a big machine ( ~120G RAM) and I call

Re: [R] Constrained Regression

2011-01-20 Thread Samuel Le
://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Information from ESET NOD32 Antivirus, version of virus signature database 5803 (20110120

Re: [R] circular reference lines in splom

2011-01-20 Thread Max Kuhn
This did the trick: panel.circ3 - function(...) { args - list(...) circ1 - ellipse(diag(rep(1, 2)), t = 1) panel.xyplot(circ1[,1], circ1[,2], type = l, lty = trellis.par.get(reference.line)$lty, col =

[R] Inverse Prediction with splines

2011-01-20 Thread Jeffrey.Morris
Hello, I have fit a simple spline model to the following data. Data x y 0 1.298 2 0.605 3 0.507 4 0.399 5 0.281 6 0.203 7 0.150 8 0.101 Model Sp.1=lm(y~bs(x,df=4)) Now I wish to inverse predict the x for y=.75, say. Optimize works fine for

Re: [R] densities greater than 1 for values within an (0, 1) intervall

2011-01-20 Thread Paul Ramer
How does one then interpret kernel density distributions with values greater than one? My output from the density function. --- density(delt.m[[1]][,6], na.rm=TRUE) Call: density.default(x = delt.m[[1]][, 6], na.rm = TRUE) Data: delt.m[[1]][, 6] (171 obs.); Bandwidth 'bw' =

[R] Regression Testing

2011-01-20 Thread Mojo
I'm new to R and some what new to the world of stats. I got frustrated with excel and found R. Enough of that already. I'm trying to test and correct for Heteroskedasticity I have data in a csv file that I load and store in a dataframe. ds - read.csv(book2.csv) df - data.frame(ds) I then

[R] ANOVA plotting

2011-01-20 Thread Bulent Arikan
Dear List, I recently started using R and I have a simple question. I am running R (v. 2.12.1) and Rcmdr (v.1-6.3) on Mac (Snow Leopard). I am using a data set I used before for practicing ANOVA with R, so I know what the results should look like. I can get ANOVA table using both Rcmdr and GUI.

Re: [R] CCF and missing values.

2011-01-20 Thread David Stoffer
combine them and then use acf: x - ts(rnorm(10)) y - ts(x+ rnorm(10)) u - ts.union(x, y) (acf(u, na.action=na.pass)) I don't know if it's correct, but it gives an answer... I'm too afraid to check if it's correct. -- View this message in context:

Re: [R] densities greater than 1 for values within an (0, 1) intervall

2011-01-20 Thread David Winsemius
The same way you interpret densities less than one? On Jan 20, 2011, at 2:28 PM, Paul Ramer wrote: How does one then interpret kernel density distributions with values greater than one? The same way you interpret densities less than one? density != probability My output from the

Re: [R] spacing of color key in filled.contour

2011-01-20 Thread claudia tebaldi
Hi again thank you to those who replied. I actually figured out a simple way (which does entail transforming the data, oh well...) and I thought I throw it out there just in case someone needs to solve a similar problem. Apologies if it is in fact obvious. Once the right levels for the

Re: [R] Regression Testing

2011-01-20 Thread David Winsemius
On Jan 20, 2011, at 2:08 PM, Mojo wrote: I'm new to R and some what new to the world of stats. I got frustrated with excel and found R. Enough of that already. I'm trying to test and correct for Heteroskedasticity I have data in a csv file that I load and store in a dataframe. ds -

Re: [R] Regression Testing

2011-01-20 Thread Mojo
On 1/20/2011 3:37 PM, David Winsemius wrote: On Jan 20, 2011, at 2:08 PM, Mojo wrote: I'm new to R and some what new to the world of stats. I got frustrated with excel and found R. Enough of that already. I'm trying to test and correct for Heteroskedasticity I have data in a csv file

Re: [R] Inverse Prediction with splines

2011-01-20 Thread David Winsemius
On Jan 20, 2011, at 2:37 PM, jeffrey.mor...@sanofipasteur.com jeffrey.mor...@sanofipasteur.com wrote: Hello, I have fit a simple spline model to the following data. Data x y 0 1.298 2 0.605 3 0.507 4 0.399 5 0.281 6 0.203 7 0.150 8

Re: [R] How to reshape wide format data.frame to long format?

2011-01-20 Thread Hadley Wickham
I think I should be able to do this using the reshape function, but I cannot get it to work. I think I need some help to understand this... (If I could split the variable into three separate columns splitting by ., that would be even better.) Use strsplit and [ Or colsplit, from reshape,

[R] Generating time progressing line for Google Earth

2011-01-20 Thread fbielejec
Dear, I am trying to visualise a time-progressing line (it's supposed to represent spread patterns) using brew package and Google Earth. The idea is to have a function which takes start and end point geographic coordinates, as well as number of intervals to chop the path up, and returns the

[R] splitting a square symmetric matrix

2011-01-20 Thread Joe P King
So many matrices are square symmetrical (i.e. variance-covariance matrices), is there any way to get R to split the matrix on its diagonal and just return one diagonal? So if I have mat-matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) is there anyway to get the lower right

Re: [R] adding text to y-axis per row of panels (lattice)

2011-01-20 Thread p_connolly
On Thu, 20-Jan-2011 at 10:34AM +0200, E Hofstadler wrote: | Dear all, | | Being a newbie to R, I've trawled through many old posts on this list | looking for a solution to my problem, but unfortunately couldn't quite | figure it out myself. I'd be very grateful if someone here on this | list

Re: [R] ggplot2, geom_hline and facet_grid

2011-01-20 Thread Hadley Wickham
Ok, that's a known bug: https://github.com/hadley/ggplot2/issues/labels/facet#issue/96 Thanks for the reproducible example though! Hadley On Thu, Jan 20, 2011 at 3:46 AM, Sandy Small sandy.sm...@nhs.net wrote:   Thank you.   That seems to work - also on my much larger data set.   I'm not

Re: [R] splitting a square symmetric matrix

2011-01-20 Thread Erik Iverson
Joe P King wrote: So many matrices are square symmetrical (i.e. variance-covariance matrices), is there any way to get R to split the matrix on its diagonal and just return one diagonal? mat-matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) is there anyway to get the lower

Re: [R] ANOVA plotting

2011-01-20 Thread Sarah Goslee
I'm not sure what a real ANOVA diagram is supposed to look like, nor do I know what your data look like. But this might get you started: fakedata - runif(100) fakegroups - sample(rep(letters[1:5], each=20)) boxplot(fakedata ~ fakegroups) If that isn't what you're after, a clearer explanation

Re: [R] Regression Testing

2011-01-20 Thread Achim Zeileis
On Thu, 20 Jan 2011, Mojo wrote: I'm new to R and some what new to the world of stats. I got frustrated with excel and found R. Enough of that already. I'm trying to test and correct for Heteroskedasticity I have data in a csv file that I load and store in a dataframe. ds -

Re: [R] Installing package in windows 7

2011-01-20 Thread Tal Galili
Haseeb - thank you for republishing your solution. Prof Brian Ripley - thanks for pointing to my error. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) |

Re: [R] splitting a square symmetric matrix

2011-01-20 Thread RICHARD M. HEIBERGER
It looks like you might be asking for this. This gets the lower right diagonal. mat - matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) mat [,1] [,2] [,3] [1,]143 [2,]412 [3,]321 diag(mat[rev(2:nrow(mat)),-1]) [1] 2 2 This gets the upper

Re: [R] ANOVA plotting

2011-01-20 Thread Robert Baer
I recently started using R and I have a simple question. I am running R (v. 2.12.1) and Rcmdr (v.1-6.3) on Mac (Snow Leopard). I am using a data set I used before for practicing ANOVA with R, so I know what the results should look like. I can get ANOVA table using both Rcmdr and GUI. However,

  1   2   >