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
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] 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] 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] 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")

[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

[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] 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

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 +

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

[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] 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

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] 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] [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 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

[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] 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

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] 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

[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 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

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] 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] 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] 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

[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] 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

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.

[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

[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="

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] 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

[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

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

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] 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] 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] 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

[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] 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

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] 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] 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

[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

[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] 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

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_

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] 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

<    1   2