[R] Fwd: how can I install the latest version of r in linux?

2011-10-24 Thread Jie TANG
-- Forwarded message -- From: Jie TANG Date: 2011/10/25 Subject: how can I install the latest version of r in linux? To: r-help@r-project.org HI R-users I downloaded the latest version of R with the name R-latest.tar.gz from the website But when I tar the package and configure

[R] how can I install the latest version of r in linux?

2011-10-24 Thread Jie TANG
HI R-users I downloaded the latest version of R with the name R-latest.tar.gz from the website But when I tar the package and configure the package, some error message showed that configure: error: --with-readline=yes (default) and headers/libs are not available and I run make command: error

Re: [R] merging two dataframes

2011-10-24 Thread Petr PIKAL
> > Thank you Petr! > > I have read on the merge help page, but I cant figure out how to write this > function. > When I use your function it includes all data from "data3", but all columns > in "data" has "NA"(without "name" and "date". I hoped to keep these values Because name and date comm

Re: [R] How to create a new variable based on parts of another character variable: A generalization

2011-10-24 Thread Petr PIKAL
Hi Bert I am aware of factor features and frankly speaking I consider them quite usefull despite of prevalent preference to character vectors. For the OP question seems to me that ifelse construction is appropriate, based on his statement he has 2 strings which shall be converted to another two

Re: [R] lambda, uncertainty coefficient (& Somers D)

2011-10-24 Thread hongwm
Dear Marc, I would also like to request the R code for doing this nominal measure of association analyses, thanks in advance. Your kindly helps are really appreciated. My email is hon...@mun.ca Have a great day, Hong -- View this message in context: http://r.789695.n4.nabble.com/lambda-uncert

Re: [R] cycling through a long list of files and names

2011-10-24 Thread Wet Bell Diver
Thanks all, for your great help! --Peter Op 24-10-2011 18:23, R. Michael Weylandt schreef: You might also need the assign() function which is sort of the opposite of get() Michael On Mon, Oct 24, 2011 at 12:15 PM, jim holtman wrote: Write a function that encapsulates the following three lin

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Ben Bolker
Md Desa, Zairul Nor Deana Binti ku.edu> writes: > > Hello, > Does anyone knows how to deal with zero subscript in R. Try the "Oarray" package (that's a capital letter "O"). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] Unlist alternatives?

2011-10-24 Thread Joshua Wiley
Hi Kyle, blups=ranef(modelrandom)[[1]] should give you a data frame, the rownames of which are your strain (I think). If that doesn't work, it would be great if you could post some data so we see what you see. Cheers, Josh On Mon, Oct 24, 2011 at 6:53 PM, kickout wrote: > dfhfs...@ghghgr.com

[R] Unlist alternatives?

2011-10-24 Thread kickout
dfhfs...@ghghgr.com I ran a simple lme model: modelrandom=lmer(y~ (1|Test) + (1|strain), data=tempsub) Extracted the BLUPs: blups=ranef(modelrandom)[1] Even wrote myself a nice .csv file: write.csv(ranef(modelrandom)[1],paste(x,"BLUPs.CSV")) This all works great. I end up with a .csv fil

Re: [R] heatmap for plotting categorical matrix

2011-10-24 Thread Yihui Xie
not sure about gplots, but the one in base R should work well if you specify the scaling method to be 'none': heatmap(a4[1:40, ], Rowv=NA, Colv=NA, col=c("grey", "blue", "purple", "red"), scale='none') Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statisti

Re: [R] cbind giving NA's?

2011-10-24 Thread Joshua Ulrich
Note that this issue was raised on StackOverflow recently. http://stackoverflow.com/questions/7678090/xts-merge-odd-behaviour Here's the solution: index(a) <- index(a) index(b) <- index(b) merge(a,b) ZWD.UGX SCHB.Close 2010-03-31 NA 28.02 2010-04-01 7.6343 NA 2010-04

[R] difficulties with MuMIn model generation with coxph

2011-10-24 Thread sgilbert
Hi All, I'm having trouble with the automatized model generation (dredge) function in the MuMIn package. I'm trying to use it to automatically generate subsets of models from a global cox proportional hazards model, and rank them based on AICc. These seems like it's possible, and the Mumin documen

[R] Building package/DESCRIPTION file not existing?

2011-10-24 Thread Francois Rousseu
Hello useRs I am trying to build a package for personal use and for making easier working with other people but I keep getting the same error message about the DESCRIPTION file not existing. when trying to install from a source tar.gz file: Error in .read_description(dfile) : file 'C:

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 7:23 PM, Md Desa, Zairul Nor Deana Binti wrote: Hello, Does anyone knows how to deal with zero subscript in R. I have this code: for (i in 1:nitems){ + for (j in 1:ncat-1) { + draw<-matrix(rnorm(nitems*(ncat-1),seed1,seed2),nitems, (ncat-1)) +

Re: [R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Joshua Wiley
Hi Deana, No, R does not deal with zero subscripts. Could it be done? Of course. The simplest approach is: 0 + 1 = 1, which is the R equivalent. You need to adjust your code to go, for example, from 1 to 30 instead of 0 to 29. Cheers, Josh On Mon, Oct 24, 2011 at 4:23 PM, Md Desa, Zairul No

[R] Create a matrix with increment and element with zero subscript

2011-10-24 Thread Md Desa, Zairul Nor Deana Binti
Hello, Does anyone knows how to deal with zero subscript in R. I have this code: for (i in 1:nitems){ + for (j in 1:ncat-1) { + draw<-matrix(rnorm(nitems*(ncat-1),seed1,seed2),nitems,(ncat-1)) + d<-( sigma_d*draw ) + mu_d + draw<-matrix(rtnorm((nitems*(ncat-1)

Re: [R] Date column in downloaded date

2011-10-24 Thread ajc
Michael: Thanks a lot. It worked. We have to extract the core part of the time-series data. Then do a xy-plot or linear regression. -Arka On Mon, Oct 24, 2011 at 10:34 AM, Michael Weylandt [via R] < ml-node+s789695n3933306...@n4.nabble.com> wrote: > Comments inline. > > On Oct 24, 2011, at 1:4

Re: [R] R2HTML giving "NULL" in output

2011-10-24 Thread Joshua Wiley
Hmm, I will see if I can see what Rcmdr is doing to possibly replicate. I am experimenting with processing that ignores NULL output from a function, BUT, this has to be done cautiously as NULL may be a legitimate return so I do not want to simply not print any NULL output, but I have not figured o

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, B77S wrote: The following might not be exactly the way to do this, but see the package "reshape" and the line of code following your data: Thank you, B77S. Bert pointed me to reshape and reshape2. I'll read the help pages for them before responding. I'll be out of the of

Re: [R] Summary stats in table

2011-10-24 Thread Hadley Wickham
On Mon, Oct 24, 2011 at 5:39 AM, Duncan Murdoch wrote: > Suppose I have data like this: > > A <- sample(letters[1:3], 1000, replace=TRUE) > B <- sample(LETTERS[1:2], 1000, replace=TRUE) > x <- rnorm(1000) > > I can get a table of means via > > tapply(x, list(A, B), mean) > > and I can add the marg

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread R. Michael Weylandt
Could you dput() the structure of x and y: I'm having trouble visualizing how your data is set up. Michael On Mon, Oct 24, 2011 at 12:07 PM, Julie wrote: > The variable y is made of four columns, each paired to 20, 200, 2000 or 20 > 000. >> y <- c(rdiktator20, rDiktator200, rDikt2000, rDikt2

[R] heatmap for plotting categorical matrix

2011-10-24 Thread Weiwei Shi
Hi there, I have a matrix like this: > a4[1:20, 1:5] 194 211 294 314 315 GO:003 1 1 1 1 1 GO:072 0 0 0 0 0 GO:076 1 0 0 0 0 GO:082 1 3 1 1 1 GO:083 1 0 0 0 1 GO:086 0 1 0 1 1 GO:114 0 0 0 0

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread B77S
The following might not be exactly the way to do this, but see the package "reshape" and the line of code following your data: df <- structure(list(site = structure(c(1L, 1L, 2L, 4L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("BC-0.5", "BC-2", "BC-3", "BC-4"), class = "factor"), sampda

Re: [R] Comparing two gff/gtf files : de novo transcripts v/s reference

2011-10-24 Thread Abhishek Pratap
Hey Martin Thats exactly what I intended but sent it to general R list. Will post it again. Thanks for checking. -A On Mon, Oct 24, 2011 at 2:32 PM, Martin Morgan wrote: > On 10/24/2011 02:23 PM, Abhishek Pratap wrote: > >> Hi All >> >> I am wondering if people based on their experience could

Re: [R] Plot Legend

2011-10-24 Thread R. Michael Weylandt
Glad to hear it worked for you. There does seem to be some confusion on your end as to what the with() command does, however. The following are all equivalent. data(mtcars) layout(matrix(1:4,2)) plot(mtcars$cyl, mtcars$mpg) plot(mtcars[["cyl"]], mtcars[["mpg"]]) plot(mtcars[,"cyl"], mtcars[,"mpg

Re: [R] R2HTML giving "NULL" in output

2011-10-24 Thread L.A.
Just discovered It doesn't do this when run in the latest release Rcmdr, yet still does in JGR, RKward and R-Gui. Confusing. Thanks, L.A. -- View this message in context: http://r.789695.n4.nabble.com/R2HTML-giving-NULL-in-output-tp2309776p3934410.html Sent from the R help mailing list archive

Re: [R] Plot Legend

2011-10-24 Thread RMSOPS
Hello Michael, You were absolutely right, it was not the database mtcars I wanted to use. but the example you sent me helped me a lot. I took the code that I adapted to this and what I wanted and resulted in perfection. Thank you for your help. dataset *with (dataset, plot (dataset

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, B77S wrote: Why not format the data like this: site sampledate SO4 TDS NA Mg Cond Cl Ca Because I don't know how to reformat the base data frame (chemdata) to achieve this. It seems to me that you summary doesn't make any sense. Those quantiles are meaningless as they

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, Daniel Nordlund wrote: you need to reorganize your data so that you have a single record (i.e. row) for each site/sampdate combination with the quant value for each of your params save in a column named by the param value (I don't remember all the param names so I used pn).

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 5:25 PM, Dennis Murphy wrote: Hi David: When I try your code, I get the wireframe with the x, y, z axes sans bounding cube and points, along with the error message Error using packet 1 object 'pts' not found Hi Dennis; My code was run with 2 objects, one named 'pts1' an

Re: [R] using predict.lm() within a function

2011-10-24 Thread Dennis Murphy
Hi Michael: Try this: show.beta <- function(model, x = 'x', x1, x2, label, col="black", ...) { abline(model, col=col, lwd=2) xs <- data.frame(c(x1, x2, x2)) names(xs) <- attr(model$coefficients, 'names')[2] ys <- predict(model, xs) lines(cbind(xs,ys[c(1,1,2)])

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Rich Shepard > Sent: Monday, October 24, 2011 2:17 PM > To: r-help@r-project.org > Subject: Re: [R] Syntax Help for xyplot() > > On Mon, 24 Oct 2011, Rich Shepard wrote: > > >

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread B77S
Why not format the data like this: site sampledate SO4 TDS NA Mg Cond Cl Ca i.e. with a column for each parameter? It seems to me that you summary doesn't make any sense. Those quantiles are meaningless as they encompass all the parameters. Am I missing something? Rich Shepard wrote: > >

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, Dennis Murphy wrote: xyplot('TDS'$quant ~ 'Cond'$quant | burns.tds.anal$site ) Dennis, xyplot('TDS'$quant ~ 'Cond'$quant | burns.tds.anal$site) Error in "TDS"$quant : $ operator is invalid for atomic vectors I tried that earlier today. Rich __

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, Bert Gunter wrote: Where's TDS? -- 'cause it's sure not in your data frame. Bert, summary(burns.tds.anal) sitesampdate param quant BC-3 :460 Min. :1992-03-27 Ca : 65 Min. : 1.00 BC-2 :107 1st Qu.:1994-09-21 Cl :148

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Dennis Murphy
Hi: You should perhaps do the following in the xyplot() call (untested because the TDS and Cond data frames are missing): xyplot('TDS'$quant ~ 'Cond'$quant | burns.tds.anal$site ) assuming that all three atomic objects have the same length. Caveat emptor. Dennis On Mon, Oct 24, 2011 at 2:17 PM

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Bert Gunter
Where's TDS? -- 'cause it's sure not in your data frame. -- Bert On Mon, Oct 24, 2011 at 2:17 PM, Rich Shepard wrote: > On Mon, 24 Oct 2011, Rich Shepard wrote: > > Perhaps because it's Monday I'm not successfully writing the xyplot() >> command to show the quant, for example, for TDS by site.

Re: [R] Comparing two gff/gtf files : de novo transcripts v/s reference

2011-10-24 Thread Martin Morgan
On 10/24/2011 02:23 PM, Abhishek Pratap wrote: Hi All I am wondering if people based on their experience could share what methods one could use to compare two gff/gtf files. The reason why I want to do so is that we have constructed a RNA-Seq based transcriptome and would like to compare it wit

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread Megan Bartlett
Hi, I got the same result with David's version, but defining the *lim values prior to the function actually made it work. I also renamed the points pts so it wouldn't matter whether it was pts1 or pts. The new code is: data.frame(x = seq(-4, 0, 0.5), y = seq(0, 40, 5))-> df expand.grid(x = df$x

[R] using predict.lm() within a function

2011-10-24 Thread Michael Friendly
I've written a simple function to draw a regression line in a plot and annotate the line showing the slope with a label. It works, as I'm using it, when the horizontal variable is 'x', but gives incorrect results otherwise. What's wrong? # simple function to show the slope of a line show.beta

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread Dennis Murphy
Hi David: When I try your code, I get the wireframe with the x, y, z axes sans bounding cube and points, along with the error message Error using packet 1 object 'pts' not found > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English

[R] Comparing two gff/gtf files : de novo transcripts v/s reference

2011-10-24 Thread Abhishek Pratap
Hi All I am wondering if people based on their experience could share what methods one could use to compare two gff/gtf files. The reason why I want to do so is that we have constructed a RNA-Seq based transcriptome and would like to compare it with reference transcriptome we had from in-silico a

Re: [R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, Rich Shepard wrote: Perhaps because it's Monday I'm not successfully writing the xyplot() command to show the quant, for example, for TDS by site. What I need to do is plot the quant values for TDS vs. Cond, TDS vs. SO4, etc. I should have provided some of the attempts:

Re: [R] Reading in and modifying multiple datasets in a loop

2011-10-24 Thread Debs Majumdar
Thanks Uwe. This works perfectly. ### owd <- setwd(pth) fls <- list.files(pattern="^chr") ufls <- unique(sapply(strsplit(fls, "_"), "[", 1)) for(i in ufls){      of <- strsplit(i, "\\.")[[1]]      of <- paste(of[1], tail(of, 1), sep=".")      impute2databel(genofile = i,              

Re: [R] Different symbols for select points

2011-10-24 Thread Sarah Goslee
On Mon, Oct 24, 2011 at 4:52 PM, lauren mcdonagh wrote: > Dear R users, > > I hope you can help me as you have done before. > > I was wondering if I can make some of the points on my graph a different > colour and symbol? Some of my soil samples are enriched and I wanted them to > be shown with

[R] Different symbols for select points

2011-10-24 Thread lauren mcdonagh
Dear R users,  I hope you can help me as you have done before.  I was wondering if I can make some of the points on my graph a different colour and symbol? Some of my soil samples are enriched and I wanted them to be shown with a red triangle and the samples which are not enriched I wanted to s

[R] Syntax Help for xyplot()

2011-10-24 Thread Rich Shepard
Thanks to David's help I subset my large data set and produced a smaller one for a single stream and 7 factors of interest. The structure of this data frame is: str(burns.tds.anal) 'data.frame': 718 obs. of 4 variables: $ site: Factor w/ 143 levels "BC-0.5","BC-1",..: 1 1 4 6 4 4 4 5 5

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 4:12 PM, Megan Bartlett wrote: > Hi David, > > Thanks for the suggestion - I changed pts1 to pts, but I still got > the same error as before. Do you know what else I'm doing wrong? I do not. The code that works for me is: wireframe(z ~ y*x, gridd, drape = TRUE, colorkey= T

Re: [R] Plot unusual subset of data

2011-10-24 Thread Noah Silverman
Works beautifully. Thanks! -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Oct 24, 2011, at 1:32 PM, (Ted Harding) wrote: > ix <- which(Seg[1013:1046] > 0) > lines((1013:1046)[ix], Seg[1013:1046][ix], col=2) [[alternative HTML ver

Re: [R] Plot unusual subset of data

2011-10-24 Thread Ted Harding
On 24-Oct-11 19:48:16, Noah Silverman wrote: > Hi, > I have a function that approximates some data and indicates "segments". > > I'd like to plot the original data, and then the linear approximations > on top of it. (Ideally, just a subset of N rows at a time, as the data > set is large.) > > I

Re: [R] tree construction

2011-10-24 Thread Dennis Murphy
What kind of tree do you want? The sos() package can help you find R functions associated with a particular topic: # install.packages('sos') library('sos') > findFn('tree') found 2798 matches; retrieving 20 pages, 400 matches. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 > findFn('classifica

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread Megan Bartlett
Hi David, Thanks for the suggestion - I changed pts1 to pts, but I still got the same error as before. Do you know what else I'm doing wrong? Thanks, Megan PS. New code is: wireframe(z ~ y*x, gridd, drape = TRUE, colorkey= TRUE, scales = list(arrows = FALSE), pts = pts1,

[R] Plot unusual subset of data

2011-10-24 Thread Noah Silverman
Hi, I have a function that approximates some data and indicates "segments". I'd like to plot the original data, and then the linear approximations on top of it. (Ideally, just a subset of N rows at a time, as the data set is large.) I can't figure out a clean way to do this. Suggestions? her

Re: [R] How to remove multiple outliers

2011-10-24 Thread R. Michael Weylandt
I believe Dr. Winsemius addressed this in your other thread, but I would hesitate to do any sort of outlier identification based on repeated application of a filter (for that matter, I'm not much of an outlier removal guy generally, but let's suppose I were). You can easily get into a situation whe

Re: [R] POT package

2011-10-24 Thread R. Michael Weylandt
I'm not particularly familiar with EVT but it seems that here the term exists to scale down the time base to that wherein extreme values were identified. Just a hunch though... If you want more accurate clarification you may wish to contact the package maintainer, but to be honest I wouldn't worry

[R] Tutorial on 'fields' package

2011-10-24 Thread Antonio Rodriges
Dear all, Does anyone know where can I find a tutorial on using 'fields' package and related packages dealing with regular grids? Thank you -- Kind regards, Antonio Rodriges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Using predicted() in R

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 2:45 PM, flokke wrote: Dear all, I am a R user since about 3 weeks now and still struggeling with things that must be very easy for you... This week I am struggling with the function predict() I want to use this function to get a 95% interval. I understand that you have

[R] Undiff - order 7

2011-10-24 Thread Flávio Fagundes
Hello users. I need a help again, please? I runned my Arima model using difference order = 7 * Y2=diff(Yst[,2],differences = 7)* Yfit=arima(Yst2,order=c(3,0,0),seasonal=list(order=c(0,0,0),period=7),include.mean=TRUE) and forecast Yfor=forecast.Arima(Yfit, h=31) Now, I would like to compare

Re: [R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 1:23 PM, Megan Bartlett wrote: Hi, I'm trying to follow the suggestions given by Deepayan Sarkar in this message: http://tolstoy.newcastle.edu.au/R/help/05/11/16135.html to plot 3-D points on a wireframe plot. The problem is that I keep getting a partly formed plot- wit

Re: [R] Alternative to interp.surface() offered

2011-10-24 Thread Waichler, Scott R
This is a correction to a post from 3/10/09. I just wanted to get this in the archive. It is the same thread as http://www.mail-archive.com/r-help@r-project.org/msg48762.html Thanks to Matt Oliver for bringing this to my attention. The correct code for my.interp.surface() follows. # A fun

[R] tree construction

2011-10-24 Thread sihuapeng
I have the data set like this: A B C D E A2 235 327 278 2569 B244 5 122 248 259 C324 223513 98 69 D22232 7 6569 E232 2278 9 This i

[R] Using predicted() in R

2011-10-24 Thread flokke
Dear all, I am a R user since about 3 weeks now and still struggeling with things that must be very easy for you... This week I am struggling with the function predict() I want to use this function to get a 95% interval. I understand that you have to use it in such a way as: lm_examplemodel<-

Re: [R] Plot Legend

2011-10-24 Thread R. Michael Weylandt
Are you sure you are using the data set mtcars? That data set doesn't have variables Na or K nor does it look like what you provided... For the real mtcars, you could try this which I think does something like what you want. with(mtcars, plot(cyl, mpg, pch = carb, col = gear)) with(mtcars, legend

Re: [R] new to R coding.

2011-10-24 Thread R. Michael Weylandt
I believe I already showed you how to do this (though your code doesn't seem to do what your words ask, so I'm not sure which one to answer), but didn't draw attention to it: x[-1]/x[-length(x)] This creates two vectors, one consisting of everything but the first element of x and the other of eve

Re: [R] Creating a histogram properly

2011-10-24 Thread Joshua Wiley
Hi Joe, What about this? Btw, the real key to a reproducible example is one that we can actually work withoutput of the summary of the data is not the same as the data itself. That makes it tricky to know what exactly you are working with (although sometimes the original form of the data can

Re: [R] subplot strange behavoir

2011-10-24 Thread Greg Snow
I see the problem, I fixed this bug for version 2.8 of TeachingDemos, but have not submitted the new version to CRAN yet (I thought that I had fixed this earlier, but apparently it is still only in the development version). An easy fix is to install version 2.8 from R-forge (install.packages("T

Re: [R] Creating a histogram properly

2011-10-24 Thread Dennis Murphy
Hi: Aren't V1 and V2 factors in this data frame? If so, you should be plotting bar charts rather than histograms (they're not the same). Do you want separate graphs for V1 and V2, do you want them stacked, or do you want them dodged (side-by side for each level 001, 002, 003)? In the absence of su

Re: [R] extract the p value

2011-10-24 Thread Duncan Murdoch
On 24/10/2011 1:47 PM, Jim Bouldin wrote: OK, what is the trick to extracting the overall p value from an lm object? It shows up in the summary(lm(model)) output but I can't seem to extract it: It's not part of the object, it is computed when the object is printed. To see the print method, do

Re: [R] extract the p value

2011-10-24 Thread R. Michael Weylandt
It's not directly extractable since it's calculated on the fly in the printing method. If you type stats:::print.summary.lm, you can see the code the leads to the calculation: It's basically (I'm leaving out some formatting stuff): pf(x$fstatistic[1L], x$fstatistic[2L], x$fstatistic[3L], lower.ta

Re: [R] extract the p value

2011-10-24 Thread Joshua Wiley
Hi Jim, Its a bit of a trick question. There isn't actually any overall p value stored in the lm object, or even in the summary.lm object. It is calculated from the f statistic by the print methods for summary.lm. Of course, none of that helps, per se. Try this: summary(lm(mpg ~ hp, data = mt

[R] extract the p value

2011-10-24 Thread Jim Bouldin
OK, what is the trick to extracting the overall p value from an lm object? It shows up in the summary(lm(model)) output but I can't seem to extract it: > test2 = apply(aa, 1, function(x) summary(lm(x[,1] ~ 0 + x[,3] + x[,6]))) > test2[[1]] Call: lm(formula = x[, 1] ~ 0 + x[, 3] + x[, 6]) [omitte

[R] Adding points to a wireframe: 'x and units must have length >0' error

2011-10-24 Thread Megan Bartlett
Hi, I'm trying to follow the suggestions given by Deepayan Sarkar in this message: http://tolstoy.newcastle.edu.au/R/help/05/11/16135.html to plot 3-D points on a wireframe plot. The problem is that I keep getting a partly formed plot- with the colored lattice visible but no axis labels or addit

Re: [R] Adding rows to a table with a loop

2011-10-24 Thread Weidong Gu
It surely can be done. One way is to keep track of selected variables in a set. If a new variable is selected, you expand the selected set and set the frequency to be one, otherwise just increase the freqency of the selected variable (if... else). Also, you might want to have a look at glmulti pac

Re: [R] Creating a histogram properly

2011-10-24 Thread Joshua Wiley
What about? hist(Data$V1) hist(Data$V2) Cheers, Josh On Mon, Oct 24, 2011 at 9:38 AM, Joe Carl wrote: > > Hello all, > > I'm trying to make a histogram of the data contained in my dataframe. > The summary of the data gives me exactly what I want > > summary (Data) > V1     V2 > first001: 3   l

Re: [R] 2 x 3 Tables

2011-10-24 Thread Jim Silverton
Hello all, I have the following. Two sets of p x 3 matrices where p is say relatively large. My data looks like : mat1 2 3 4 2 3 4 1 2 3 mat2 2 3 4 12 12 4 10 12 3 when p = 3. I form a 2 x 3 contingency table using the i^th row from each matrix. Its Fisher's exact te

[R] Creating a histogram properly

2011-10-24 Thread Joe Carl
Hello all, I'm trying to make a histogram of the data contained in my dataframe. The summary of the data gives me exactly what I want summary (Data) V1 V2 first001: 3 last001: 9 first002: 3 last002: 7 first003: 2 last003: 6 (Other) :52(Other): 27 But how do I capture the names and

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Aaron Siirila
The count() function in the plyr package works beautifully. Thanks to Jim, Rainer and Dennis for your help. Best. -Original Message- From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Monday, October 24, 2011 12:05 PM To: asindc Cc: r-help@r-project.org Subject: Re: [R] How to selecti

Re: [R] new to R coding.

2011-10-24 Thread tynashy
I am new to R coding and I am trying to model the returns on the ftse100 since 1990. I have got a vector with all the closing values on each trading day. however, instead of using the difference in the closing values of two consecutive days, (ie dx=diff(x) where x is the vector containing the clos

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread Julie
The variable y is made of four columns, each paired to 20, 200, 2000 or 20 000. > y <- c(rdiktator20, rDiktator200, rDikt2000, rDikt2) So I guess the problem is in the fact that I did not specify it correctly, is it so? How can I tell R properly that one part of y matches to one part of x? Th

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Aaron Siirila
Sorry, I attempted to paste the sample data but it must have been stripped out when I posted. It is hopefully now listed below. tapply looks useful. I will check it out further. Here's the sample data: > flights[1:10,] PASSENGERS DISTANCE ORIGIN ORIGIN_CITY_NAME ORIGIN_WAC DEST DEST_CITY_NA

[R] Adding rows to a table with a loop

2011-10-24 Thread MJS
Hi All, Its a bit of a beginners question I'm afraid. I have a looped stepwise regression (using MASS and StepAIC) to take random predictors out of the total number. For this example a random sample of 5 out of a total of 20. The loop will continue until all combinations of variables have been

Re: [R] new to R coding.

2011-10-24 Thread R. Michael Weylandt
Try it yourself: x = seq(1, 11, by = 2) diff(log(x)) log(x[-1]/x[-length(x)]) all.equal(diff(log(x)), log(x[-1]/x[-length(x)])) It seems like you don't really understand logs / log returns and why they are used by some in quant finance: might I suggest you read this: http://quantivity.wordpress.

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, David Winsemius wrote: You could also have saved the subsetted data, applied `factor` to the subsetted column and then used `xtabs`. temp <- subset(chemdata, , ) temp$param <- factor(temp$param) (Now only levels that exist are in the temp version.) David, Thank you. I

Re: [R] using lme and 'by' function to extract the co-efficients by individuals

2011-10-24 Thread Ben Bolker
tom_pienkowski blueyonder.co.uk> writes: > I'm trying to use the 'by' function to extract the co-efficients from a > mixed model which is performed on multiple individuals. I basically have a > group of individuals and for each individual I want the co-efficient for > there change in 'pots_hauled

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 12:10 PM, Rich Shepard wrote: On Mon, 24 Oct 2011, David Winsemius wrote: The appearance of levels with all zeroes is probably because I didn't include drop.unused.levels = FALSE in the xtabs specification. OK. Adding 'drop.unused.levels' does make a huge difference.

Re: [R] cycling through a long list of files and names

2011-10-24 Thread R. Michael Weylandt
You might also need the assign() function which is sort of the opposite of get() Michael On Mon, Oct 24, 2011 at 12:15 PM, jim holtman wrote: > Write a function that encapsulates the following three lines: > > > city1997<- dataCleaning(read.csv2("C:\\city\\year1997.txt")) > city1997<- wasteCalcu

Re: [R] cex multiplier not exact

2011-10-24 Thread Ali Tofigh
On Mon, Oct 24, 2011 at 06:10, Prof Brian Ripley wrote: > On Mon, 24 Oct 2011, Uwe Ligges wrote: > >> >> >> On 23.10.2011 22:33, Ali Tofigh wrote: >>> >>> Hi, >>> >>> When I plot text and use cex to change the text size, I notice that the >>> cex >>> multiplier is not exact. It looks as if the rea

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread Jeff Newmiller
X and y must have the same number of elements, and NA values must be removed (?na.omit) --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar

Re: [R] bestglm function and output in R

2011-10-24 Thread Dennis Murphy
Hi: bestglmtest is your input data frame, is it not? From the names() line, you can see that it has no variable named BestModel that corresponds to a list containing a component named coefficients. Were you perhaps looking for output$BestModel$coefficients ?? Dennis On Mon, Oct 24, 2011 at 8:3

Re: [R] cycling through a long list of files and names

2011-10-24 Thread jim holtman
Write a function that encapsulates the following three lines: city1997<- dataCleaning(read.csv2("C:\\city\\year1997.txt")) city1997<- wasteCalculations(city1997, year = 1997) if (city1997[1,1] == "Time") {city1997<- timeCalculations(city1997)} and then pass in the appropriate parameters. On Mon

Re: [R] merging two dataframes

2011-10-24 Thread Jeff Newmiller
The merge function seems perfect for your problem. If you can't get it to work, the problem may be in the data you are working with, which you have not supplied (read the posting guide, and use the head and dput functions to make your example small and reproducible). One common mistake by beginn

Re: [R] new to R coding.

2011-10-24 Thread R. Michael Weylandt
Assuming that d(x) is equal to x, (I don't know a d() function in R) these should be the same. log(a/b) = log(a) - log(b) = diff(log(c(a,b)) If you mean simple returns instead of continuous/log returns, perhaps try this: x[-1]/x[-length(x)] - 1 Michael On Mon, Oct 24, 2011 at 11:44 AM, tynashy

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, David Winsemius wrote: The appearance of levels with all zeroes is probably because I didn't include drop.unused.levels = FALSE in the xtabs specification. OK. Adding 'drop.unused.levels' does make a huge difference. Thanks, Rich __

Re: [R] cycling through a long list of files and names

2011-10-24 Thread Wet Bell Diver
Thanks so much, this is very very helpful. I do have one remaining question here. I definitely see the value of making a list of the datasets, an advise I will definitely follow. However, for educational purposes, I would still like to know how to automate the following without using a list:

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Dennis Murphy
See the count() function in the plyr package; it does fast summation. Something like library('plyr') count(passengerData, c('ORIGIN_WAC', 'DEST_WAC'), 'npassengers') HTH, Dennis On Mon, Oct 24, 2011 at 8:27 AM, asindc wrote: > Hi, I am new to R so I would appreciate any help. I have some data t

Re: [R] How to create a new variable based on parts of another character variable: A generalization

2011-10-24 Thread Bert Gunter
... Well, this works in this simple case, but is too clumsy for a general formulation of this problem: given a "dictionary" consisting of two character vectors of unique "names" (or two columns in a data frame), x and y, how does one convert a factor z with levels in x into the corresponding equi

[R] new to R coding.

2011-10-24 Thread tynashy
how do I code the following in R. I want to produce a vector where dx=log( (d(x))/(d(x-1)) ). I can do it for dx=diff(log(x)). I am learning/trying to model log returns of a stock market index. But instead of using the difference of the closing values of two consecutive days, i want to use the log

[R] using lme and 'by' function to extract the co-efficients by individuals

2011-10-24 Thread tom_pienkowski
Hi all I'm trying to use the 'by' function to extract the co-efficients from a mixed model which is performed on multiple individuals. I basically have a group of individuals and for each individual I want the co-efficient for there change in 'pots_hauled' in response to a change in 'vpue' with m

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread jim holtman
It would be good to follow the posting guide and at least supply a sample of the data. Most likely 'tapply' is one way of doing it: tapply(df$passenger, list(df$orig, df$dest), sum) On Mon, Oct 24, 2011 at 11:27 AM, asindc wrote: > Hi, I am new to R so I would appreciate any help. I have some d

[R] bestglm function and output in R

2011-10-24 Thread Candice
Hi all, I have been trying to run a bestglm in R for a while now and am struggling to get it to run. When I thought I had succeeded, the "output" it gave me was "NULL" and that's it. Below is my code: bestglmtest<-read.table("C:\\Documents and Settings\\clyons\\Desktop\\bestglmtest.txt",header=T,

  1   2   >