Re: [R] Upgrade R?

2011-11-15 Thread Rainer M Krug
On Mon, Nov 7, 2011 at 9:23 PM, Kevin Burton wrote: > I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the > libraries from the 'library' directory in my existing installation (2.13.1) > to the installed R 2.14. Now I want to uninstall the old installation (R > 2.13.1) and I get t

Re: [R] Plot 2 different fields with image.plot()

2011-11-15 Thread Chris82
No, I have not. But it is a very nice option. Can't believe that I have overlooked it. Thanks a lot. Best regards -- View this message in context: http://r.789695.n4.nabble.com/Plot-2-different-fields-with-image-plot-tp4040413p4042339.html Sent from the R help mailing list archive at Nabble.co

Re: [R] Sweave and accented letters

2011-11-15 Thread Giuseppe
That is exactly what I thought I would do. But the problem persist. In the document below I have added "\inputencoding utf8", yet LyX fails to compile. #LyX 2.0 created this file. For more info see http://www.lyx.org/ \lyxformat 413 \begin_document \begin_header \textclass article \use_default_

[R] New site for Scientific Computing Q+A

2011-11-15 Thread Barry Rowlingson
If anyone has ever hesitated about posting a question to R-help that might be less about R and more about scientific computing in general (algorithms, datasets etc) then you might be interested in a proposed new site on StackExchange: http://area51.stackexchange.com/proposals/28815/scientific-comp

[R] averaging between rows with repeated data

2011-11-15 Thread robgriffin247
*The situation (or an example at least!)* example<-data.frame(rep(letters[1:10])) colnames(example)[1]<-("Letters") example$numb1<-rnorm(10,1,1) example$numb2<-rnorm(10,1,1) example$numb3<-rnorm(10,1,1) example$id<-c("CG234","CG232","CG441","CG128","CG125","CG182","CG232","CG441","CG232","CG125")

[R] Quantstrat; error with applyStrategy()

2011-11-15 Thread Steven Kukard
I'm testing out quantstrat using a simple one-indicator strategy. The error I get after applyStrategy(...) is Error in .xts(e, .index(e1), .indexCLASS = indexClass(e1), .indexFORMAT = indexFormat(e1), : index length must match number of observations In addition: Warning messages: 1: In match.n

Re: [R] Sweave and accented letters

2011-11-15 Thread Duncan Murdoch
On 11-11-15 4:46 AM, Giuseppe wrote: That is exactly what I thought I would do. But the problem persist. In the document below I have added "\inputencoding utf8", yet LyX fails to compile. Yihui is probably right that this is a question about Lyx, not R, but one other thing you can try is to

Re: [R] What is the CADF test criterion="BIC" report?

2011-11-15 Thread Claudio Lupi
Hi Paul, You are right. Model selection takes places using the common data sample across ALL checked models (otherwise you would end up comparing models estimated on different data!). What the procedure returns are the results based on the common sample. If you want to have the full-sample results,

Re: [R] help to ... import the data from Excel

2011-11-15 Thread Hans-Peter Suter
Jim, 2011/10/15 jim holtman : > You might also want to consider the XLConnect package. I have had > better luck reading/writing Excel files than with xlsReadWrite. XLConnect looks good but - as the xlsReadWrite author and planing to release a xlsx/64 bit successor - I'd be interested to learn wh

Re: [R] Problem creating reference manuals from latex

2011-11-15 Thread Duncan Murdoch
On 11-11-14 10:25 PM, Tyler Rinker wrote: Duncan, Thank you for your reply. I was not clear about the Internet access. I do have access, just at times I don't, hence the need to produce the manuals from latex rather than simply using the Internet. Please pardon my lack of knowledge around

[R] Question regarding Kruskal-Wallis test

2011-11-15 Thread syrvn
Hello, I need to analyse an experiment with 3 groups: Control group Treated group 1 (drug 1) Treated group 2 (drug 2) If I use a Kruskal-Wallis test do analyse the data and if I define the control group as the reference group does the test do then the following comparisons? Control group vs. T

Re: [R] averaging between rows with repeated data

2011-11-15 Thread R. Michael Weylandt
Good morning Rob, First off, thank you for providing a reproducible example. This is one of those little tasks that R is pretty great at, but there exist >\infty ways to do so and it can be a little overwhelming for the beginner: here's one with the base function ave(): cbind(ave(example[,2:4], e

Re: [R] averaging between rows with repeated data

2011-11-15 Thread R. Michael Weylandt
Oh sorry -- my mistake with ave() -- I only checked the first row drop = F is an optional argument to the function "[" which tells it to return one of what it began with, rather than simplifying. E.g., X = matrix(1:9, 3) is.matrix(X) TRUE is.matrix(X[,2:3]) TRUE is.matrix(X[,3]) FALSE # Ju

Re: [R] Adding units to levelplot's colorkey

2011-11-15 Thread David Winsemius
On Nov 14, 2011, at 7:20 PM, Carlisle Thacker wrote: Thanks, Dennis. Yes, I can do that, but that locks the physical units to locations of the labels. I had hoped that there might be something a bit more flexible, like a subtitle or more general text. If you would take the time to descri

Re: [R] Question about linear regression in R

2011-11-15 Thread David Winsemius
On Nov 14, 2011, at 10:49 PM, Miles Yang wrote: Hi all, I wrote a r program as below: x <- 1:10 y <- c(3,3,3,3,3,3,3,3,3,3) fit <- lm(log(y) ~ x) summary(fit) And I expect to get some error message from R, because "y" is constant. But, I got the message as below: You are asking R to tel

Re: [R] Remove names and more from list with capture.output()

2011-11-15 Thread David Winsemius
On Nov 14, 2011, at 11:49 PM, Sverre Stausland wrote: Hi R users, I end up with a list object after running an anova: lm(speed ~ 1 + dist + speed:dist, data = cars) -> Int lm(speed ~ 1 + dist, data = cars) -> NoInt anova(Int, NoInt) -> test test <- test[c("Df", "F", "Pr(>F)")][2,] is.list(te

[R] Creating Timeseries by manipulating data table

2011-11-15 Thread Chuske
Hi, I'm new to R and tried a search but couldn't find what I was looking for. I have some data as a csv file with columns:- longditude latitude year month rainfall region What I need to do is produce a monthly time series for each region, where region is an integer id and where each time point

[R] break error bars in ggplot2

2011-11-15 Thread Fischer, Felix
Hello, i use ggplot to plot some measures including CIs as horizontal errorbars. I get an error when the scale limits are narrower than the boundaries of the error bar and hence the CIs are not plotted. library(ggplot2) df <- data.frame(resp=c(1,2), k=c(1,2), se=c(1,2)) ggplot(df, aes(resp,y=k

Re: [R] averaging between rows with repeated data

2011-11-15 Thread Rob Griffin
Thanks Michael, That second (aggregate) option worked perfectly - the first (cbind) generated averages for each row between the columns. (rather than between rows for each column). I came so close with aggregate yesterday - it is only slightly different to one my attempts (of admittedly very ma

[R] How to plot hierarchical clustering with different colors?

2011-11-15 Thread yzzhao
Dear experts, I would like to plot a hierarchical clustering of 300 items. I had a distance matrix with dimension of 300*300. The 300 items were from 7 groups which I would like to label with 7 different colours in the plot. >h<-hclust(as.dist(300_distance_matrix)) >plot(h,hang=-1,cex=0.5, col="

[R] A question:How to plot hierarchical clustering with different colors?

2011-11-15 Thread yzzhao
Dear experts, I would like to plot a hierarchical clustering of 300 items. I had a distance matrix with dimension of 300*300. The 300 items were from 7 groups which I would like to label with 7 different colours in the plot. h<-hclust(as.dist(300_distance_matrix)) plot(h,hang=-1,cex=0.5, c

Re: [R] Creating Timeseries by manipulating data table

2011-11-15 Thread R. Michael Weylandt
It's a big subject and various mechanisms exist, but you should probably start by looking into the zoo package and the read.zoo() function. Hope that helps, Michael On Tue, Nov 15, 2011 at 8:03 AM, Chuske wrote: > Hi, > > I'm new to R and tried a search but couldn't find what I was looking for.

Re: [R] gsDesign

2011-11-15 Thread Liaw, Andy
Hi Dongli, Questions about usage of specific contributed packages are best directed toward the package maintainer/author first, as they are likely the best sources of information, and they don't necessarily subscribe to or keep up with the daily deluge of R-help messages. (In this particular c

[R] RODBC conectar MySQL con R

2011-11-15 Thread Usuario R
Hola, Alguno ha usado el paquete RODBC para acceder a una BBDD MySQL desde R en Windows? Qu'e mas tengo que hacer a parte de: 1) Aniadir el Driver de MySQL a la lista de User DSN en Control panel -> Administrative tools -> Data Sources(ODBC) 2) Testear que funciona la conexion 2) Ejecutar: ch <-

Re: [R] Creating Timeseries by manipulating data table

2011-11-15 Thread Gabor Grothendieck
On Tue, Nov 15, 2011 at 8:20 AM, R. Michael Weylandt wrote: > It's a big subject and various mechanisms exist, but you should > probably start by looking into the zoo package and the read.zoo() > function. > Note that there is an entire vignette on read.zoo, as well. See the Reading Data in Zoo

Re: [R] break error bars in ggplot2

2011-11-15 Thread Ben Bolker
Fischer, Felix charite.de> writes: > > Hello, > > i use ggplot to plot some measures including CIs as horizontal > errorbars. I get an error when the scale > limits are narrower than the boundaries of the error bar and > hence the CIs are not plotted. > > library(ggplot2) > df <- data.frame(

Re: [R] Question about linear regression in R

2011-11-15 Thread John Fox
Dear Miles, Within rounding error, you got the right intercept, log(3); slope, 0; residuals, all 0; residual standard error, 0; and standard errors of the intercept and slope, both 0. The R^2 should have been undefined (i.e., 0/0), but dividing one number that's 0 within rounding error by another

Re: [R] averaging between rows with repeated data

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 6:46 AM, R. Michael Weylandt wrote: Good morning Rob, First off, thank you for providing a reproducible example. This is one of those little tasks that R is pretty great at, but there exist \infty ways to do so and it can be a little overwhelming for the beginner: here's

Re: [R] Adding units to levelplot's colorkey

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 8:23 AM, Carlisle Thacker wrote: Sorry that I was not clear. I was asking how to add annotation to levelplot's colorkey, not the levelplot itself. The only entry I can find from the help pages is via its labels. Googling did yield this: " draw.colorkey() doesn't supp

[R] Bootstrap values for hierarchical tree based on distaance matrix

2011-11-15 Thread ronny
I would like to get an hierarchical clustering tree with bootstrap values indicated on the nodes, as in pvclust. The problem is that I have only distance matrix instead of the raw data, required for pvclust. Is there a way to get it? fit1 <- hclust(dist) # an object of class '"dist" plot(fit1) # d

Re: [R] Adding units to levelplot's colorkey

2011-11-15 Thread Carlisle Thacker
Sorry that I was not clear. I was asking how to add annotation to levelplot's colorkey, not the levelplot itself. The only entry I can find from the help pages is via its labels. Googling did yield this: " draw.colorkey() doesn't support a title for the legend". So I presume there is also n

Re: [R] RODBC conectar MySQL con R

2011-11-15 Thread Uwe Ligges
On 15.11.2011 14:34, Usuario R wrote: Hola, Alguno ha usado el paquete RODBC para acceder a una BBDD MySQL desde R en Windows? Qu'e mas tengo que hacer a parte de: 1) Aniadir el Driver de MySQL a la lista de User DSN en Control panel -> Administrative tools -> Data Sources(ODBC) 2) Testear q

Re: [R] gsDesign

2011-11-15 Thread Marc Schwartz
Hi Dongli, Sorry for the delay in following up. You might want to read the dsDesignManual.pdf document, which is available in the 'inst/doc' folder in the package source tarball on CRAN, or in the package 'doc' directory in your R installation. Use: system.file(package = "gsDesign") to get

[R] grid.arrange, grid.layout - legend, global y axis title

2011-11-15 Thread Johannes Radinger
Hello, I created several plot with ggplot2 dev mode. Now I want to combine the plots in a grid e.g. 2x2 with a fixed size of the output. What I am doing at the moment is: grid.newpage() pushViewport(viewport(layout = grid.layout(nrow=2, ncol=2, widths = unit(c(7.5,6.5),

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Juliet Hannah
In the solution below, what is the advantage of using "0L". M0 <- read.csv("M1.csv", nrows = 1)[0L, ] Thanks! 2011/11/8 Gabor Grothendieck : > 2011/11/8 Sergio René Araujo Enciso : >> Dear all: >> >> I have two larges files with 2000 columns. For each file I am >> performing a loop to extract t

Re: [R] [stats-rosuda-devel] Error .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout, : java.lang.NoSuchMethodError: density.Params.readFromArgs([Ljava/lang/String; )Ljava/lang/String;

2011-11-15 Thread Simon Urbanek
Please ask the authors and/or discussion list of dism, it may be a bug in dism or incompatibility between the maxent you are using and the package, I can't check sine maxent has a restrictive license. Also please do not cross-post to multiple mailing lists. Thanks, Simon On Nov 14, 2011, at 1:

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Gabor Grothendieck
On Tue, Nov 15, 2011 at 9:44 AM, Juliet Hannah wrote: > In the solution below, what is the advantage of using "0L". > >  M0 <- read.csv("M1.csv", nrows = 1)[0L, ] > As mentioned, you will find quite a bit of additional info on the sqldf home page but to address the specific question regarding the

Re: [R] help to ... import the data from Excel

2011-11-15 Thread jim holtman
Part of my problem has to do with getting through the corporate firewall to access the other program I have to download to use it. I just tried today and this is what I got: > xls.getshlib() Loading required package: tools --- xls.getshlib running... --- - download.file from 'http://dl.dropbox.

Re: [R] Sweave and accented letters

2011-11-15 Thread Yihui Xie
Yes, that is the point. I would prefer a LyX file instead of text in email, since the encoding can be different. You still did not tell us your R version, or better, sessionInfo(). Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State Univers

[R] ARMAtoAR function

2011-11-15 Thread Diego Fernando Lemus Polania
Good Morning. I wonder if R have a funtion to convert an ARMA process to infinite AR process, like ARMAtoMA function wich convert an ARMA process to infinite MA process -- Diego Fernando Lemus Polanía Ingeniero Industrial Universidad Nacional de Colombia Sede Medellín [[alternative HTML

Re: [R] Problem creating reference manuals from latex

2011-11-15 Thread Tyler Rinker
Duncan, Thank you for your patience, time and expertise. You were 100% correct and the problem has been resolved. I'm adding what I did as a windows user to complete the list record for future searchers. To download the inconsolata package (you may approach this several ways this one see

Re: [R] break error bars in ggplot2

2011-11-15 Thread Fischer, Felix
Dear Ben, great, works fine! I guess, the error occurs because data outside the scale limits "is thrown away" as stated in ?coord_cartesian . Thanks, Felix From: Ben Bolker mailto:bbolker_at_gmail.com?Subject=Re:%20[R]%20break%20error%20bars%20in%20ggplot2>> Date: Tue, 15 Nov 2011 13:44:44 +

[R] Models with ordered and unordered factors

2011-11-15 Thread Catarina Miranda
Hello; I am having a problems with the interpretation of models using ordered or unordered predictors. I am running models in lmer but I will try to give a simplified example data set using lm. Both in the example and in my real data set I use a predictor variable referring to 3 consecutive days o

[R] how to indice the column in the data.frame

2011-11-15 Thread haohao Tsing
hi R,users Now I read a data from a txt file newdata<-read.table("1.txt") in the 1.txt ,there are several column shown as below 1 3 4 5 2 3 5 6 4 5 6 7 so when I want analysis the second column anadata<-newdata$V2 but my question I can not use some certain variable to indice the column? e.g cmn=2

[R] Controlling the precision of the digits printed

2011-11-15 Thread Kevin Burton
Has anyone come across the right combinations to print a limited number of digits? My trial and error approach is taking too much time. Here is what I have tried: > op <- options() > a <- c(1e-10,1,2,3,.5,.25) > names(a) <- c("A", "B", "C", "D", "E", "F") > # default > a A B

Re: [R] how to indice the column in the data.frame

2011-11-15 Thread Joshua Wiley
Hi, Look at ?"[" anadata <- newdata[, cmn] ## i.e., extract all rows (the first argument is empty of the 2 column anadata <- newdata[, 2] Hope this helps, Josh On Tue, Nov 15, 2011 at 8:02 AM, haohao Tsing wrote: > hi R,users >  Now I read a data from a txt file > newdata<-read.table("1.txt")

Re: [R] how to indice the column in the data.frame

2011-11-15 Thread Sarah Goslee
On Tue, Nov 15, 2011 at 11:23 AM, Joshua Wiley wrote: > Hi, > > Look at ?"[" > > anadata <- newdata[, cmn] > ## i.e., extract all rows (the first argument is empty of the 2 column > anadata <- newdata[, 2] Or, if this is part of a more general problem and the column names are not necessarily in s

Re: [R] Controlling the precision of the digits printed

2011-11-15 Thread Joshua Wiley
Hi Kevin, I am not sure you will find anything other than manual tweaking, that will vary between no decimals for integers, some for small fractions, and scientific for very small. You can also look at: ?round ?format. If this is for code/a report, you could make any formatting you wanted with

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Bert Gunter
Ordered factors use orthogonal polynomial contrasts by default. The .L and .Q stand for the linear and quadratic terms. Unordered factors use "treatment" contrasts although (they're actually not contrasts), that are interpreted as you described. If you do not know what this means, you need to do s

Re: [R] how to indice the column in the data.frame

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 11:02 AM, haohao Tsing wrote: hi R,users Now I read a data from a txt file newdata<-read.table("1.txt") in the 1.txt ,there are several column shown as below 1 3 4 5 2 3 5 6 4 5 6 7 so when I want analysis the second column anadata<-newdata$V2 but my question I can not use

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Bert Gunter
... In addition, the following may also be informative. > f <- paste("day", 1:3) > contrasts(ordered(f)) .L .Q [1,] -7.071068e-01 0.4082483 [2,] -7.850462e-17 -0.8164966 [3,] 7.071068e-01 0.4082483 > contrasts(factor(f)) day 2 day 3 day 1 0 0 day 2 1

Re: [R] Controlling the precision of the digits printed

2011-11-15 Thread William Dunlap
When you print a vector R uses a single format for the whole vector and tries to come up with one format that displays all the values accurately enough. For a matrix (or data.frame) it uses a different format for each column, so perhaps you would like the output of: > matrix(a, nrow=1, dimnames

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-15 Thread Sammy Zee
Thanks. Yes, I meant nrow(dataset)+1 (typo...) Sammy On Mon, Nov 14, 2011 at 1:29 AM, Petr PIKAL wrote: > > > > dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") > > > > The above seems to have worked to append a row in place of a rbind(). > This > > No. It overwrites your last row. You maybe m

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Paul Johnson
On Tue, Nov 15, 2011 at 9:00 AM, Catarina Miranda wrote: > Hello; > > I am having a problems with the interpretation of models using ordered or > unordered predictors. > I am running models in lmer but I will try to give a simplified example > data set using lm. > Both in the example and in my rea

Re: [R] Controlling the precision of the digits printed

2011-11-15 Thread Kevin Burton
Thank you. I mainly didn't know about the vector/matrix printing rules. Kevin -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Tuesday, November 15, 2011 10:43 AM To: Kevin Burton; r-help@r-project.org Subject: RE: [R] Controlling the precision of the digits prin

[R] Regular expressions in R

2011-11-15 Thread Michael Griffiths
Good afternoon list, I have the following character strings; one with spaces between the maths operators and variable names, and one without said spaces. form<-c('~ Sentence + LEGAL + Intro + Intro / Intro1 + Intro * LEGAL + benefit + benefit / benefit1 + product + action * mean + CTA + help + me

Re: [R] Regular expressions in R

2011-11-15 Thread Sarah Goslee
Hi Michael, You need to take another look at the examples you were given, and at the help for ?sub(): The two ‘*sub’ functions differ only in that ‘sub’ replaces only the first occurrence of a ‘pattern’ whereas ‘gsub’ replaces all occurrences. If ‘replacement’ contains backreferen

[R] mlpowsim

2011-11-15 Thread Scott Raynaud
I'm using Bill Browne's MLPowSim to do some sample size estimation for a multilevel model.  It creates an R program to carry out the estimation using lmer in the lme4 library.  When there are predictors with more than two categories one has to modify the code generated to account for the multino

Re: [R] Regular expressions in R

2011-11-15 Thread Joshua Wiley
Hi Michael, Your strings were long so I made a bit smaller example. Sarah made one good point, you want to be using gsub() not sub(), but when I use your code, I do not think it even works precisely for one instance. Try this on for size, you were 99% there: ## simplified cases form1 <- c('produ

[R] Extract pattern from string

2011-11-15 Thread syrvn
Hello, with Sys.time() you get the following string: "2011-11-15 16:25:55 GMT" How can I extract the following substrings: year <- 2011 month <- 11 day_time <- 15_16_25_55 Cheers, Syrvn -- View this message in context: http://r.789695.n4.nabble.com/Extract-pattern-from-string-tp4073432p4

Re: [R] Extract pattern from string

2011-11-15 Thread Justin Haynes
take a look at the structure of what Sys.time returns. str(Sys.time) and now at ?strptime! > format(Sys.time(),format='%d-%H-%M-%S') [1] "15-09-55-55" > format(Sys.time(),format='%Y') [1] "2011" > format(Sys.time(),format='%m') [1] "11" > Hope that helps, Justin On Tue, Nov 15, 2011 at 9:48

[R] Putting directory path as a parameter

2011-11-15 Thread aajit75
Hi List, I am new to R, this may be simple. I want to store directory path as parameter which in turn to be used while reading and writing data from csv files. How I can use dir defined in the below mentioned example while reading the csv file. Example: dir <- "C:/Users/Desktop" #location of

[R] Help

2011-11-15 Thread Gyanendra Pokharel
Hi all, I have the mean vector mu<- c(0,0) and variance sigma <- c(10,10), now how to sample from the bivariate normal density in R? Can some one suggest me? I did not fine the function "mvdnorm" in R. Best Gyan [[alternative HTML version deleted]]

Re: [R] correlations between columns for each row

2011-11-15 Thread robgriffin247
Just as an update on this problem: I have managed to get the variance for the selected columns Now all I need is the covariance between these 2 selections - the two target columns are and the aim is that a new column contain a covariance value between these on each row: maindata[,c(174:213)] an

Re: [R] Putting directory path as a parameter

2011-11-15 Thread Joshua Wiley
Hi Aajit, try using the ?paste function to combine the variable with your directly and the filename into one string, and then pass that to read.csv() or whatever paste(dir, "/bs_dev_segment_file.csv", sep = '') HTH, Josh On Tue, Nov 15, 2011 at 6:12 AM, aajit75 wrote: > Hi List, > > I am new

Re: [R] Putting directory path as a parameter

2011-11-15 Thread R. Michael Weylandt
Try pasting them together like paste(dir, "...") You may need to use the collapse argument. Alternatively, change your working directory to dir with setwd(). M On Nov 15, 2011, at 9:12 AM, aajit75 wrote: > Hi List, > > I am new to R, this may be simple. > > I want to store directory path

Re: [R] correlations between columns for each row

2011-11-15 Thread Joshua Wiley
Hi Rob, Here is one approach: ## define a function that does the calculations ## (the covariance of two vectors divided by the square root of ## the products of their variances is just a correlation) rF <- function(x, a, b) cor(x[a], x[b], use = "complete.obs") set.seed(1) bigdata <- matrix(rno

Re: [R] Help

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 11:21 AM, Gyanendra Pokharel wrote: Hi all, I have the mean vector mu<- c(0,0) and variance sigma <- c(10,10), now how to sample from the bivariate normal density in R? Can some one suggest me? I did not fine the function "mvdnorm" in R. But when you typed ?mvdnorm R sh

Re: [R] Putting directory path as a parameter

2011-11-15 Thread Henrik Bengtsson
file.path() is much better for this than paste(), e.g. dir <- "C:/Users/Desktop" pathname <- file.path(dir, "bs_dev_segment_file.csv") temp_data <- read.csv(pathname) /Henrik On Tue, Nov 15, 2011 at 10:08 AM, R. Michael Weylandt wrote: > Try pasting them together like > > paste(dir, "...") > >

[R] points() colored by value

2011-11-15 Thread Chris82
Hi R users, I want to colored points by their value for example: x <- c(1,2,3,4) y <- c(1,2,3,4) z <- c(2,3,4,9) y and x are coordinates z is the value of the coordinates points(x,y,col= rainbow(z)) something like that But haven't found any solution at the moment. Thanks. Chris -- View

Re: [R] Lower bounds on selfStart function not working

2011-11-15 Thread Schatzi
I was able to solve this problem by going back to nls and obtaining the initial parameter estimates through optim. When I used nlsList with my dataset, it took 2 minutes to solve and was not limited by the bounds. Now I have the bounds working and it takes 45 seconds to solve. Here is the new code:

[R] Estimating model parameters for system of equations

2011-11-15 Thread lstevenson
Hi all, I'm trying to estimate model parameters in R for a pretty simple system of equations, but I'm having trouble. Here is the system of equations (all derivatives): eqAlgae <- (u_Amax * C_A) * (1 - (Q_Amin / Q_A)) eqQuota <- (p_max * R_V) / (K_p + R_V) - ((Q_A-Q_Amin)*u_Amax) eqResource <- -C

Re: [R] Estimating model parameters for system of equations

2011-11-15 Thread Arne Henningsen
Dear Louise On 15 November 2011 19:03, lstevenson wrote: > Hi all, > > I'm trying to estimate model parameters in R for a pretty simple system of > equations, but I'm having trouble.  Here is the system of equations (all > derivatives): > eqAlgae <- (u_Amax * C_A) * (1 - (Q_Amin / Q_A)) > eqQuota

Re: [R] Help

2011-11-15 Thread R. Michael Weylandt
I'm not sure your request completely makes sense: marginal means and variances are not sufficient to give the joint distribution; even if you can be assured it is bivariate normal, you still need a correlation. Just a heads up Michael. PS - next time would you please use a slightly more nuance

Re: [R] points() colored by value

2011-11-15 Thread R. Michael Weylandt
Try either col=z or col=rainbow(max(z))[z] depending on what color scheme you want. Michael On Nov 15, 2011, at 1:47 PM, Chris82 wrote: > Hi R users, > > I want to colored points by their value > > for example: > > x <- c(1,2,3,4) > y <- c(1,2,3,4) > z <- c(2,3,4,9) > > y and x are coord

Re: [R] points() colored by value

2011-11-15 Thread Sarah Goslee
Hi Chris, On Tue, Nov 15, 2011 at 1:47 PM, Chris82 wrote: > Hi R users, > > I want to colored points by their value > > for example: > > x <- c(1,2,3,4) > y <- c(1,2,3,4) > z <- c(2,3,4,9) > > y and x are coordinates > > z is the value of the coordinates > > points(x,y,col= rainbow(z)) In the ge

[R] Help with "error: no acceptable C compiler found in $PATH"

2011-11-15 Thread Hari Easwaran
Dear all, I am trying to install a package from bioconductor (biomaRt) for which I need the RCurl package. I get the following main error message when I try to install RCurl (and its dependencies). configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. ERROR:

[R] ANNOUNCEMENT: 20% discount on the most recent R books from Chapman & Hall/CRC!

2011-11-15 Thread Thorne, Melanie
Take advantage of a 20% discount on the most recent R books from Chapman & Hall/CRC! We are pleased to offer our latest R books at a 20% discount through our website. To take advantage of this offer, simply visit www.crcpress.com, choose your titles and insert code AZL02 in the 'Promotion C

Re: [R] Difference between two time series

2011-11-15 Thread Sarwarul Chy
Hello, Can you please help me with this? I am also stack in the same problem. Sam -- View this message in context: http://r.789695.n4.nabble.com/Difference-between-two-time-series-tp819843p4073800.html Sent from the R help mailing list archive at Nabble.com. __

[R] Plot alignment with mtext

2011-11-15 Thread Kevin Burton
I would like the text plotted with 'mtext' to be alighned like it is for printing on the console. Here is what I have: > print(emt) ME RMSE MAE MPE MAPE MASE original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554 3

Re: [R] Remove names and more from list with capture.output()

2011-11-15 Thread Sverre Stausland
Thanks David - this is pretty close to what I am looking for. However, the output of vec[2] now includes the row number [1] and quotations marks at the endpoints of the row. Is there an easy way to exclude those? Thanks Sverre On Tue, Nov 15, 2011 at 8:11 AM, David Winsemius wrote: > > On Nov 14

Re: [R] Estimating model parameters for system of equations

2011-11-15 Thread David Stevens
This problem is not for the faint of heart. Doug Bates, author of nls(...) has said that a general purpose implementaion of R code for multiresponse nonlinear regression is unlikely in the near future. You have a large set of issues to deal with here. First, you have a system of differential eq

[R] package installtion

2011-11-15 Thread Scott Raynaud
I'm getting the following error in a script: "Error: could not find function "lmer."    I'm wondering of my lme4 package is installed incorrectly.  Can someone tell me the installation procedure?  I looked at the support docs but couldn't translate that into anything that would work. __

Re: [R] Plot alignment with mtext

2011-11-15 Thread Sarah Goslee
Hi Kevin, On Tue, Nov 15, 2011 at 2:36 PM, Kevin Burton wrote: > I would like the text plotted with 'mtext' to be alighned like it is for > printing on the console. Here is what I have: You don't provide any of the info in the posting guide (OS may be important here), or a reproducible example,

Re: [R] Remove names and more from list with capture.output()

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 2:43 PM, Sverre Stausland wrote: Thanks David - this is pretty close to what I am looking for. However, the output of vec[2] now includes the row number [1] and quotations marks at the endpoints of the row. Is there an easy way to exclude those? The usual method is to use

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Jan van der Laan
Yet another solution. This time using the LaF package: library(LaF) d<-c(1,4,7,8) P1 <- laf_open_csv("M1.csv", column_types=rep("double", 10), skip=1) P2 <- laf_open_csv("M2.csv", column_types=rep("double", 10), skip=1) for (i in d) { M<-data.frame(P1[, i],P2[, i]) } (The skip=1 is needed as l

Re: [R] package installtion

2011-11-15 Thread Scott Raynaud
Never mind-I fixed it. My script is throwing the following error: "Error in glmer(formula = modelformula, data = data, family = binomial(link = logit),  :   Argument ‘method’ is deprecated. Use ‘nAGQ’ to choose AGQ.  PQL is not available." I remember hearing somewhere that PQL is no longer av

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
Error in cor(x[a], x[b], use = "complete.obs") : 'x' must be numeric This is strange, it works on your example (and you've understood what I'm trying to do perfectly), but then when I use it on the original data it comes up with the error above I've checked str() and the columns are all numeri

Re: [R] Extract pattern from string

2011-11-15 Thread syrvn
Wow, that is a very clever way to do it. Thank you very much! Cheers, Syrvn -- View this message in context: http://r.789695.n4.nabble.com/Extract-pattern-from-string-tp4073432p4074023.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Plot alignment with mtext

2011-11-15 Thread Kevin Burton
I hadn't considered altering the font. Thank you I will try that. -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Tuesday, November 15, 2011 1:53 PM To: Kevin Burton Cc: r-help@r-project.org Subject: Re: [R] Plot alignment with mtext Hi Kevin, On Tue, Nov 15,

Re: [R] correlations between columns for each row

2011-11-15 Thread R. Michael Weylandt
Is the whole thing a data frame? Then any multi-column subset is also a data frame. Try adding a as.matrix() wrapper in the definition of rF. Michael On Nov 15, 2011, at 3:14 PM, "Rob Griffin" wrote: > Error in cor(x[a], x[b], use = "complete.obs") : 'x' must be numeric > > This is strange,

Re: [R] package installtion

2011-11-15 Thread Scott Raynaud
OK, I think I see the problem.  Rather than setting method="nAGQ" I need nAGQ=1.  Doing so throws the following error: "Warning messages: 1: glm.fit: algorithm did not converge 2: In mer_finalize(ans) : gr cannot be computed at initial par (65) Error in diag(vcov(fitmodel)) :   error in evaluat

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
Excellent, as.matrix() didn't work but switched it to as.numeric() around the definition of both variables in the function and it did work: rF <- function(x, a, b) cor(as.numeric(x[a]), as.numeric(x[b]), use = "complete.obs") maindata$rFcor<-apply(maindata,1,FUN=rF,a=174:213,b=214:253) Thanks

Re: [R] Difference between two time series

2011-11-15 Thread R. Michael Weylandt
It's not clear what it means for the differences to be "of increasing order" but if you simply mean the differences are increasing, perhaps something like this will work: library(caTools) X = cumsum( 2*(runif(5e4) > 0.5) - 1) # Create a random Walk Y = runmean(X, 30, endrule = "mean", align = "rig

[R] using tapply() with the quantile function?

2011-11-15 Thread Kulpanowski, David
Hi: Summary: I am trying to determine the 90th percentile of ambulance response times for groups of data. Background: A fire chief would like to look at emergency response times at the 90th percentile for 1 kilometer grids in Cape Coral, Florida. I have mapped out ambulance response times on a

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread R. Michael Weylandt
1) tapply will work for quantile, but the syntax was a little off: try this tapply(Cape $ ResponseTime, Cape $ Grid_ID, quantile, c(0.05, 0.95)) The fourth argument is additional parameters passed to the function FUN which here is quantile. You could also do this tapply(Cape $ ResponseTime, Cape

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread R. Michael Weylandt
There's a slight variant that might be even more helpful if you need to line the data up with how you started: ave(). I'll let you work out the details, but the key difference is that it returns a vector that has the 90th percentile for each group, each time that group appears, instead of the summa

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread Bert Gunter
David: You need to re-read ?tapply _carefully_.  Note that: FUN the function to be applied, or NULL. In the case of functions like +, %*%, etc., the function name must be backquoted or quoted. Now note that in tapply(whatever, byfactor, mean), "mean" _is_ a function. However in tapply (what

[R] equal spacing of the polygons in levelplot key (lattice)

2011-11-15 Thread Andy Bunn
Given the example: R> (levs <- quantile(volcano,c(0,0.1,0.5,0.9,0.99,1))) 0% 10% 50% 90% 99% 100% 94 100 124 170 189 195 R> levelplot(volcano,at=levs) How can I make the key categorical with the size of the divisions equally spaced in the key? E.g., five equal size rectangles wit

Re: [R] Upgrade R?

2011-11-15 Thread John C Frain
Generally I have several versions of R installed on any PC running Windows 7 and have never had any problem choosing which version of R was to be the default one. In the past the updated version did not always register as the default but there was and is a utility RSetReg.exe in the bin directory

  1   2   >