Re: [R] How to change the class of data?

2008-06-11 Thread Frankg
When you have a data X with a class factor, you can transform it to numeric as y<-as.numeric(X) to transform it to a factor again use y<-as.factor(X) -- View this message in context: http://www.nabble.com/How-to-change-the-class-of-data--tp17793351p17793713.html Sent from the R help mailing

Re: [R] The log function problem

2008-06-11 Thread Yohan Chalabi
"SVK" == "Shubha Vishwanath Karanth" <[EMAIL PROTECTED]> on Thu, 12 Jun 2008 12:02:25 +0530 SVK> Hi R, SVK> SVK> SVK> SVK> Please see the below commands. The question is I can see the value of SVK> log(2) before loading the package fcalendar in R. But after loading

[R] The log function problem

2008-06-11 Thread Shubha Vishwanath Karanth
Hi R, Please see the below commands. The question is I can see the value of log(2) before loading the package fcalendar in R. But after loading the package, the 'log' function doesn't work. How to solve this problem? Also note that the function code differs before and after downloading the pack

[R] How to change the class of data?

2008-06-11 Thread Qman Fin
Hi all, I have some data x, which are actualy consisted of numerical enties. But the class of this matrix is set to be "factor" by someone else. I used "class(x)", it turns out to be "factor". So I can not calculate them. How can I turn them into numerical data so that I can apply math operations

Re: [R] Panel-specific colours in barchart, lattice package --- thanks.

2008-06-11 Thread Rolf Turner
On 12/06/2008, at 4:08 PM, Martin Morgan wrote: I think this works -- 'custom' variables get sent to the panel function, where they're picked up and used for making garish plots. barchart(y ~ x | f, data=X, mycolors=rainbow(length(levels(X$f))), panel=function(..., mycolors)

Re: [R] Data.matrix fail to convert data.frame into matrix

2008-06-11 Thread Moshe Olshansky
Try gexp.arr <- data.matrix(gexp, rownames.force = FALSE) You are still supposed to get a matrix with one row (not a vector - dim(gexp.arr) is c(1,8) and not NULL). --- On Thu, 12/6/08, Gundala Viswanath <[EMAIL PROTECTED]> wrote: > From: Gundala Viswanath <[EMAIL PROTECTED]> > Subject: [R] Da

Re: [R] Panel-specific colours in barchart, lattice package.

2008-06-11 Thread Gabor Grothendieck
Try this: barchart(y ~ x | f, data=X, as.table=TRUE, panel = function(...) panel.barchart(..., col = panel.number())) On Wed, Jun 11, 2008 at 11:46 PM, Rolf Turner <[EMAIL PROTECTED]> wrote: > > I would like, for possibly invalid reasons, to have the bars of the barchart > in each panel to be

[R] Panel-specific colours in barchart, lattice package.

2008-06-11 Thread Rolf Turner
I would like, for possibly invalid reasons, to have the bars of the barchart in each panel to be the same colour, but with *different* colours from panel to panel. Can this be done? If so, how? I've read the help as much as I am capable of, and done an RSiteSearch () without becoming any

[R] Data.matrix fail to convert data.frame into matrix

2008-06-11 Thread Gundala Viswanath
Hi, With the following codes, I attempt to convert the data.frame into a matrix. However I notice that data.matrix function doesn't seem to work. __ BEGIN__ dat <- read.table("mydata", comment.char = "!" , na.strings = "null"); # Select n-genes by random sample # n = 1 nosamp <- 1 geneid <- sequ

Re: [R] Adding new columns to (output) data - e.g., read 5 cols write 8

2008-06-11 Thread Esmail Bonakdarian
jim holtman wrote: yourDF <- cbind(yourDF, f=yourDF$a+yourDF$b, g=yourDF$a * 3, h=yourDF$c + yourDF$d) Thanks Jim, I also learned about the transform() method from Erik which will also work beautifully. Esmail __ R-help@r-project.org mailing list ht

Re: [R] Adding new columns to (output) data - e.g., read 5 cols write 8

2008-06-11 Thread Esmail Bonakdarian
Hi Erik, Erik Iverson wrote: Esmail - Are these 5 vectors of data stored in a data.frame? I assume so. Yes, I do a simple load() call first to read the .rda file ... test2 <- transform(test, d = 2*a + b, e = 3*c) save(test2, file = "test2.Rdata") Does this help? Yes it does .. this is j

[R] mgcv::gam error message for predict.gam

2008-06-11 Thread David Katz
Sometimes, for specific models, I get this error from predict.gam in library mgcv: Error in complete.cases(object) : negative length vectors are not allowed Here's an example: model.calibrate <- gam(meansalesw ~ s(tscore,bs="cs",k=4), data=toplot, weights=weight, gam.method

Re: [R] Adding new columns to (output) data - e.g., read 5 cols write 8

2008-06-11 Thread Erik Iverson
Esmail - Esmail Bonakdarian wrote: Hello, I have the following task I'd like to accomplish: A file contains 5 columns of data (several hundred rows), let's call them a, b, c, d and e (ie these are their column headers) Are these 5 vectors of data stored in a data.frame? I assume so. I als

Re: [R] Adding new columns to (output) data - e.g., read 5 cols write 8

2008-06-11 Thread jim holtman
yourDF <- cbind(yourDF, f=yourDF$a+yourDF$b, g=yourDF$a * 3, h=yourDF$c + yourDF$d) On Wed, Jun 11, 2008 at 9:26 PM, Esmail Bonakdarian <[EMAIL PROTECTED]> wrote: > Hello, I have the following task I'd like to accomplish: > > A file contains 5 columns of data (several hundred rows), let's call > t

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Simon Blomberg
> > Good points Ben. For now I'd recommend simply that the allergic > > reaction to insignificant statistical tests be treated with an > > antihistamine :-) > > > A vote for Frank's comment to be added to the 'fortunes' package. > Seconded! :-) > :-) > > Regards, > > Marc > > ___

[R] Adding new columns to (output) data - e.g., read 5 cols write 8

2008-06-11 Thread Esmail Bonakdarian
Hello, I have the following task I'd like to accomplish: A file contains 5 columns of data (several hundred rows), let's call them a, b, c, d and e (ie these are their column headers) I also have a set of definitions, e.g., f = a + b g = a * 3 h = c + d etc. I would like to write out a new .rd

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Marc Schwartz
on 06/11/2008 05:53 PM Frank E Harrell Jr wrote: Ben Bolker wrote: Lucke, Joseph F uth.tmc.edu> writes: And to follow FH and HW What level of significance are you using? .05 is excessively liberal. Are you adjusting your p-values for the number of possible models? Do you realize the p-values

Re: [R] problem with as.Date

2008-06-11 Thread d f
since it's a dataframe, use xd$V1. also, it doesn't seem like your data has a space between the / and the numbers, so take that out of the pattern: cdates <- as.Date(xd$V1, format = "%m/%d") On Wed, Jun 11, 2008 at 6:22 PM, Mr Natural <[EMAIL PROTECTED]> wrote: > > Data into R from Excel csv fil

Re: [R] problem with as.Date

2008-06-11 Thread Gabor Grothendieck
Using xd <- structure(list(V1 = c("6/6", "5/27", "5/16", "5/2")), .Names = "V1", row.names = c(NA, -4L), class = "data.frame") Try: > as.Date(paste("2008", xd$V1, sep = "/"), "%Y/%m/%d") [1] "2008-06-06" "2008-05-27" "2008-05-16" "2008-05-02" See R News 4/1 article on dates. On Wed, Jun 11, 20

[R] problem with as.Date

2008-06-11 Thread Mr Natural
Data into R from Excel csv file xd<-read.csv("court.dates1.txt",as.is=T, header = F) > str(xd) 'data.frame': 5 obs. of 1 variable: $ V1: chr "6/6" "5/27" "5/16" "5/2" ... >xd V1 1 6/6 2 5/27 3 5/16 4 5/2 5 4/29 cdates <- as.Date(xd, format = " %m/ %d") Error in as.Date.default(xd, f

Re: [R] Problem when combining dotplot() and textplot() using grid

2008-06-11 Thread Paul Murrell
Hi Bernhard wrote: > Hi everyone. > > I want to solve the following problem. I have a data.frame and I > create a dotplot using lattice. > > Then I want to use the grid-package to create a combined graphic which > contains the dotplot as well as a textplot() (using package gplots) of > the data

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Frank E Harrell Jr
Ben Bolker wrote: Lucke, Joseph F uth.tmc.edu> writes: And to follow FH and HW What level of significance are you using? .05 is excessively liberal. Are you adjusting your p-values for the number of possible models? Do you realize the p-values for dropping a term, being selected as the maximu

Re: [R] difference between nlm and nlminb

2008-06-11 Thread Douglas Bates
nlminb provides unconstrained optimization and optimization subject to box constraints (i.e. upper and/or lower constraints on individual elements of the parameter vector). The nlm function provides unconstrained optimization. I created the nlminb function because I was unable to get reliable con

[R] I wonder if cch function in Survival package can calculate time dependent covariate

2008-06-11 Thread Jin Wang
Hi In case cohort study, we can fit proportional hazard regression model to case-cohort data. In R, the function is cch() in Survival package Now I am working on case cohort analysis with time dependent covariates using cch() of "Survival" R package. I wonder if cch() provide this utility or not?

Re: [R] converting a data set to a format for time series analysis

2008-06-11 Thread Ricardo Pietrobon
Jim, it worked perfectly. thanks a lot On Mon, Jun 9, 2008 at 8:58 PM, jim holtman <[EMAIL PROTECTED]> wrote: > This should do it: > >> x <- read.table(textConnection("subject hospitaldate_enrollment >> hospital_beds > + 1 hospitalA 1/3/2002300 > + 2 hospitalA

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Ben Bolker
Lucke, Joseph F uth.tmc.edu> writes: > > And to follow FH and HW > > What level of significance are you using? .05 is excessively liberal. > Are you adjusting your p-values for the number of possible models? Do > you realize the p-values for dropping a term, being selected as the > maximum of a

Re: [R] Close Window Button Problems

2008-06-11 Thread Bert Gunter
This should be posted on R-devel, not here. -- Bert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, June 11, 2008 1:30 PM To: r-help@r-project.org Subject: [R] Close Window Button Problems i have created a wrapper C++

Re: [R] MLE Estimation of Gamma Distribution Parameters for data with 'zeros'

2008-06-11 Thread Ben Bolker
Fox, Aaron golder.com> writes: > > Greetings, all > > I am having difficulty getting the fitdistr() function to return without > an error on my data. Specifically, what I'm trying to do is get a > parameter estimation for fracture intensity data in a well / borehole. > Lower bound is 0 (no frac

[R] ETH Internship - Dynamic Portfolio Asset Allocation

2008-06-11 Thread Diethelm Wuertz
Summer Internship at ETH Zurich "Dynamic Portfolio Asset Allocation" We offer a 3-months internship starting midth July 2008. The topic addresses "Dynamic Portfolio Asset Allocation" including alternative instruments and hedge funds. The goal will be to compare the robust mean-variance, the lo

Re: [R] the title is too long for a graph

2008-06-11 Thread Hua Li
Thank you all! The answers are very helpful! Best regards, Hua --- On Wed, 6/11/08, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > > Hua Li wrote: > >> Hi All, > >> > >> I have a problem of putting long titles on a > graph: > >> > >> for example, > >> > >> x= seq(1:100) > >> y=seq(1:100)

Re: [R] R and Fortran

2008-06-11 Thread Prof Brian Ripley
Are you serious, reporting on a 2004 version of R? Please do as the posting guide requested, and update your R. (Only posting one copy is also appreciated around here.) Beyond that, normally foo.o is not a shared library but a compiled object. You have not told us what you did, and probably

[R] Close Window Button Problems

2008-06-11 Thread damon
i have created a wrapper C++ class that popen()s R. When i create a x11 window and plot, i cannot close it using the window button. Also, when i minimize or maximize the window, the plot does not redraw. Can anybody tell me if there is a way i can get back this window functionality or if it is not

Re: [R] Copula fitting

2008-06-11 Thread Frankg
first, verify the class of your data by the following code: class(data) the class must be numeric if ok the problem can be caused from the starting value. Try choose other value. -- View this message in context: http://www.nabble.com/-R--Copula-fitting-tp6947714p17786789.html Sent from the R

[R] R and Fortran

2008-06-11 Thread Derrick Lee
Dear Fellow R-Users, I am having some difficulties loading a Fortran subroutine into R and wondering if anyone could lend me some insight to this problem. When I load some simpler Fortran codes into R, it loads fine, but when I load more complex codes I get the following error: Error

Re: [R] MLE Estimation of Gamma Distribution Parameters for data with 'zeros'

2008-06-11 Thread Peter Dalgaard
Fox, Aaron wrote: Greetings, all I am having difficulty getting the fitdistr() function to return without an error on my data. Specifically, what I'm trying to do is get a parameter estimation for fracture intensity data in a well / borehole. Lower bound is 0 (no fractures in the selected data i

Re: [R] R and Fortran

2008-06-11 Thread Derrick Lee
Hi Erin, Unfortunately no, its not named "chol", I know about the cholesky decomposition in R, I was just testing out a more complex subroutine as the subroutine I intend to use gets similar errors. Thanks for the insight, though. Cheers. - Derrick Erin Hodgess wrote: Hi Derrick! Is you

Re: [R] piper diagram

2008-06-11 Thread Dylan Beaudette
On Wednesday 11 June 2008, Jim Lemon wrote: > Jim Lemon wrote: > > Dylan Beaudette wrote: > >> Hi, > >> > >> Is anyone on the list familiar with an R implementation of Piper > >> Diagrams? > >> > >> Example: > >> http://faculty.uml.edu/nelson_eby/89.315/IMAGES/Figure%209-78.jpg > >> > >> I am think

[R] R and Fortran

2008-06-11 Thread Derrick Lee
Dear Fellow R-Users, I am having some difficulties loading a Fortran subroutine into R and wondering if anyone could lend me some insight to this problem. When I load some simpler Fortran codes into R, it loads fine, but when I load more complex codes I get the following error: Error i

Re: [R] specifying ranges in scatter plot

2008-06-11 Thread Henrique Dallazuanna
You can use also xlim and ylim, from the help page: " ...: arguments to be passed to or from methods." pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)]) pairs(iris[1:4], main = "Anderson's Iris Data -- 3 specie

[R] R and Fortran

2008-06-11 Thread Derrick Lee
Dear Fellow R-Users, I am having some difficulties loading a Fortran subroutine into R and wondering if anyone could lend me some insight to this problem. When I load some simpler Fortran codes into R, it loads fine, but when I load more complex codes I get the following error: Error in

[R] Help!!! Agnes dendogram (Clustering)

2008-06-11 Thread Sharai Gomez-Raygoza
The data "one" is a vector of 553 observations agglone<-agnes(one, metric = "manhattan", stand = TRUE) plot(agglone,which.plots=2, nmax=150) My problem is in the dendogram, I can not see the nodes because it is too crowded. I have attached the diagram. Any help is more than welcome. Thank you a l

[R] specifying ranges in scatter plot

2008-06-11 Thread He, Yulei
Hi, there: Does anyone know how to specify the ranges in the axises when I make scatter plots using pairs()? In the general plot function, I can use xlim and ylim option. But how can I do this if I use pairs()? Thanks. Yulei [[alternative HTML version deleted]] ___

Re: [R] Search entire table for a value

2008-06-11 Thread Henrique Dallazuanna
See ?which On Wed, Jun 11, 2008 at 4:19 PM, <[EMAIL PROTECTED]> wrote: > Hi, > > I have a table of numbers without any repeats. Is there a function that > will > search the entire table for a specified value and return the indices if it > is > found? Also, some rows may have columns without value

[R] Search entire table for a value

2008-06-11 Thread naw3
Hi, I have a table of numbers without any repeats. Is there a function that will search the entire table for a specified value and return the indices if it is found? Also, some rows may have columns without values. Thank you so much, -Nina __ R-help@r-

Re: [R] Parsing a data file - Help

2008-06-11 Thread Chuck Cleland
On 6/11/2008 1:29 PM, A Ezhil wrote: Hi All, I have the data in the following format: idktsaaplahto pidg 5266199119943078A 526619921005199210302968A 19930208199302093074A 2002032920

[R] MLE Estimation of Gamma Distribution Parameters for data with 'zeros'

2008-06-11 Thread Fox, Aaron
Greetings, all I am having difficulty getting the fitdistr() function to return without an error on my data. Specifically, what I'm trying to do is get a parameter estimation for fracture intensity data in a well / borehole. Lower bound is 0 (no fractures in the selected data interval), and upper

Re: [R] Barplot help

2008-06-11 Thread stephen sefick
I had to to get the data as a matrix and fix a couple of other things- If you would like for me to post my solution then I can. I appoligize my fingers went faster than my brain. Stephen On Wed, Jun 11, 2008 at 1:55 PM, Marc Schwartz <[EMAIL PROTECTED]> wrote: > on 06/11/2008 12:44 PM stephen

Re: [R] Barplot help

2008-06-11 Thread Marc Schwartz
on 06/11/2008 12:44 PM stephen sefick wrote: #I am having trouble figuring out this one. I have read the help and I am at a loss. what am I missing x <- structure(list(X = structure(c(6L, 5L, 9L, 2L, 10L, 8L, 7L, 3L, 13L, 12L, 11L, 4L, 1L, 1L, 1L), .Label = c("", "April", "August", "December",

[R] Barplot help

2008-06-11 Thread stephen sefick
#I am having trouble figuring out this one. I have read the help and I am at a loss. what am I missing x <- structure(list(X = structure(c(6L, 5L, 9L, 2L, 10L, 8L, 7L, 3L, 13L, 12L, 11L, 4L, 1L, 1L, 1L), .Label = c("", "April", "August", "December", "February", "January", "July", "June", "March"

[R] Parsing a data file - Help

2008-06-11 Thread A Ezhil
Hi All, I have the data in the following format: idktsaaplahto pidg 5266199119943078A 526619921005199210302968A 19930208199302093074A 2002032920020402F322 20020402

Re: [R] Increase Number of Decimals

2008-06-11 Thread Charilaos Skiadas
On Jun 11, 2008, at 12:17 PM, Neil Gupta wrote: R Users, I'm new to R and was wondering how I can show more decimal places when I run commands. If I'm simply running a correlation(ES,YM) how would I increase the number of decimal places R shows? When I run this it shows me . 9734044. How

Re: [R] Increase Number of Decimals

2008-06-11 Thread jim holtman
options(digits=...) On Wed, Jun 11, 2008 at 12:17 PM, Neil Gupta <[EMAIL PROTECTED]> wrote: > R Users, > > I'm new to R and was wondering how I can show more decimal places when I run > commands. If I'm simply running a correlation(ES,YM) how would I increase > the number of decimal places R shows

[R] how to save an updated dataset

2008-06-11 Thread Chris Stubben
I wrote a package which includes a number of genome sequencing project statistics on the web like http://www.ncbi.nlm.nih.gov/genomes/lproks.cgi. I included some generic functions to summarize, plot, and update the tables with the most recent version data(lproks) update(lproks) [1] "lproks

Re: [R] applying a function recursively

2008-06-11 Thread Marc Schwartz
on 06/11/2008 10:51 AM Georg Otto wrote: Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of recursion: test.list<-list("I"=list("A"=c("a", "b", "c"), "B"=c("d", "e", "f"), "C"=c("g", "h", "i"

Re: [R] applying a function recursively

2008-06-11 Thread Charles C. Berry
See ?rapply for your example rapply( test.list, rev, how='replace' ) HTH, Chuck On Wed, 11 Jun 2008, Georg Otto wrote: Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of

[R] Increase Number of Decimals

2008-06-11 Thread Neil Gupta
R Users, I'm new to R and was wondering how I can show more decimal places when I run commands. If I'm simply running a correlation(ES,YM) how would I increase the number of decimal places R shows? When I run this it shows me .9734044. How can I extend this further? In addition I was running hist

Re: [R] applying a function recursively

2008-06-11 Thread Prof Brian Ripley
See ?rapply On Wed, 11 Jun 2008, Georg Otto wrote: Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of recursion: test.list<-list("I"=list("A"=c("a", "b", "c"), "B"=c("d", "e", "f"), "C"=c("

Re: [R] Word wrapping for character objects (WINDOWS R ONLY)

2008-06-11 Thread Greg Snow
You could try passing your character string to the strwrap function first, then use cat on the result. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTE

Re: [R] Some problem with the OLS

2008-06-11 Thread Charles C. Berry
On Wed, 11 Jun 2008, roberto laforgia wrote: Dear all!! I estimated the following OLS model with R 2.5.6: Output R 2.5.6 You need to read and follow the posting guide AND provide a minimal, reproducible example. What is R 2.5.6 ?? What do sessionInfo() or version report? Where can I get

[R] applying a function recursively

2008-06-11 Thread Georg Otto
Hi, I have a question about applying a function recursively through a list. Suppose I have a list where the different elements have different levels of recursion: > test.list<-list("I"=list("A"=c("a", "b", "c"), "B"=c("d", "e", "f"), > "C"=c("g", "h", "i")), + "II"=list("A"=lis

[R] Word wrapping for character objects (WINDOWS R ONLY)

2008-06-11 Thread Toby Marthews
Can anybody help me with this problem? ** ONLY WINDOWS R - PROBLEM DOESN'T OCCUR ON LINUX ** I want to print a long character to screen: > getOption("width") [1] 60 > z=(1:20)/10#z is a vector of length between 20 and 30 (depending on user options) containing lengths in mm (i.e. each element

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Lucke, Joseph F
And to follow FH and HW What level of significance are you using? .05 is excessively liberal. Are you adjusting your p-values for the number of possible models? Do you realize the p-values for dropping a term, being selected as the maximum of a set of p-values, do not follow their usual distributi

Re: [R] newbie nls question

2008-06-11 Thread Ranney, Steven
Worked liked a charm. Thanks for your help. SR Steven H. Ranney Graduate Research Assistant (Ph.D) USGS Montana Cooperative Fishery Research Unit Montana State University PO Box 173460 Bozeman, MT 59717-3460 phone: (406) 994-6643 fax: (406) 994-7479 -Original Message- From: Micha

[R] Some problem with the OLS

2008-06-11 Thread roberto laforgia
Dear all!! I estimated the following OLS model with R 2.5.6: Output R 2.5.6 Call: lm(formula = UN ~ log(x) + time2, data = dati) Residuals: Min 1Q Median 3QMax -5.649 -2.753 -1.015 1.225 16.199 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercep

Re: [R] Problem with densityplot from the lattice package

2008-06-11 Thread Prof Brian Ripley
Look at the y axis ... so try something like densityplot(test, from=0, to=1, ylim=c(-0.1, 1.5)) The jittered plot is plotted centred on y=0. On Wed, 11 Jun 2008, Malte Brockmann wrote: Dear list, I just experienced some strange behavior of the densityplots provided by the lattice package.

Re: [R] Matrix transformation problem

2008-06-11 Thread Berend Hasselman
stefan.petersson wrote: > > > ng, > > I have a matrix (x) with binary content. Each row of the matrix holds > exactly one 1, and the rest of the row is zeros. The thing is that I need > to 'collapse' the matrix to one column where each row holds the original > column index of the 1's (y). Som

[R] Goodness of fit tests for copula

2008-06-11 Thread Frankg
How can i calculate the discrete L2 distance between the empirical copula and the estimated one. -- View this message in context: http://www.nabble.com/Goodness-of-fit-tests-for-copula-tp17779318p17779318.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread hadley wickham
On Wed, Jun 11, 2008 at 6:42 AM, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > ChCh wrote: >> >> Hello, >> >> I have consciously avoided using step() for model simplification in favour >> of manually updating the model by removing non-significant terms one at a >> time. I'm using The R Book by M

[R] Problem with densityplot from the lattice package

2008-06-11 Thread Malte Brockmann
Dear list, I just experienced some strange behavior of the densityplots provided by the lattice package. Depending on the values for "from" and "to" that are passed on to the function for kernel density estimates, the densityplot excludes the jittered stripplot that is routinely included in la

Re: [R] searching for specific row in matrix

2008-06-11 Thread Esmail Bonakdarian
# determine which data matches matches <- t(pop) == target # 't' due to matching in column order # colSums equal to COLS will indicate matches which(colSums(matches) == COLS) Neat! .. somewhat similar to the solution I came up with in the meantime, only yours works :-) Thanks Jim. Esmail

Re: [R] searching for specific row in matrix

2008-06-11 Thread Esmail Bonakdarian
Dimitris Rizopoulos wrote: try this: match.pat <- function (mat, target, nomatch = -1) { f1 <- do.call("paste", c(as.data.frame(mat), sep = "\r")) f2 <- paste(target, collapse = "\r") ind <- f1 %in% f2 if (any(ind)) which(ind)[1] else nomatch } Thanks! More R for me to sink my teet

Re: [R] Default Argument Passing in Script

2008-06-11 Thread Sebastian P. Luque
On Wed, 11 Jun 2008 21:01:54 +0800, "Gundala Viswanath" <[EMAIL PROTECTED]> wrote: > Hi all, Currently I run R script with arguments the following ways > $ R --vanilla < myscript.R ARGUMENT1 I don't think that call could possibly recognize ARGUMENT1 in myscript.R, according to the docs. > And

Re: [R] searching for specific row in matrix

2008-06-11 Thread Esmail Bonakdarian
Henrique Dallazuanna wrote: Try this: which(apply(t(m) == target, 2, all)) Wow! .. talk about concise! Neat! Thanks. This will return all matches correct? So if I only wanted the first I'd simply subscript [1] into it. Do you think the fact that it searches the whole matrix instead of stoppi

Re: [R] searching for specific row in matrix

2008-06-11 Thread Henrique Dallazuanna
Try this: which(apply(t(m) == target, 2, all)) On Wed, Jun 11, 2008 at 8:58 AM, Esmail Bonakdarian <[EMAIL PROTECTED]> wrote: > Hi, > > I have matrix of bits and a target vector. Is there an > efficient way to search the rows of the matrix for the target? > I am interested in the first row index

[R] Default Argument Passing in Script

2008-06-11 Thread Gundala Viswanath
Hi all, Currently I run R script with arguments the following ways $ R --vanilla < myscript.R ARGUMENT1 And in my script it is encoded as: __BEGIN__ args<-commandArgs() do_sth(args[3]) My question is that is there a way to set a default argument inside the R script? In Perl analogically wou

Re: [R] searching for specific row in matrix

2008-06-11 Thread Dimitris Rizopoulos
try this: match.pat <- function (mat, target, nomatch = -1) { f1 <- do.call("paste", c(as.data.frame(mat), sep = "\r")) f2 <- paste(target, collapse = "\r") ind <- f1 %in% f2 if (any(ind)) which(ind)[1] else nomatch } ## set.seed(1234) mat <- matrix(sample(0:1, 50, TRU

Re: [R] searching for specific row in matrix

2008-06-11 Thread jim holtman
This should work for you: > create_bin_string <- function(len) + { + sample(0:1, len, replace=T) + } > > ROWS = 10 > COLS = 5 > set.seed(2) > pop = matrix(create_bin_string(ROWS*COLS), ROWS, COLS, byrow=T) > > > > target=c(1, 1, 0, 1, 1) > > # my population > print(pop) [,1] [,2] [,3] [,4]

Re: [R] R idiom list? [was: Matrix transformation problem

2008-06-11 Thread Gabor Grothendieck
Google for Rtips. Also Rwiki On Wed, Jun 11, 2008 at 6:35 AM, Dietrich Trenkler <[EMAIL PROTECTED]> wrote: > Dimitris Rizopoulos schrieb: >> >> sorry, my previous answer was not correct; you need: >> >> x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0, 1,0,0), >> ncol = 3, byrow = TRUE) >> which

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gundala Viswanath
Thanks so much both. - Gundala On 6/11/08, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > which(pca == min(pca), arr.ind = TRUE) > which(pca == max(pca), arr.ind = TRUE) > > > On Wed, Jun 11, 2008 at 7:34 AM, Gundala Viswanath <[EMAIL PROTECTED]> > wrote: > > > > Hi, > > > > Supp

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread DavidM.UK
Firstly surely (CL,PC5) = -0.7416656 is the minima? I think something like this should work, though I'm not sure library(MASS) data(crabs) crab.pca <- prcomp(crabs[,4:8],retx=TRUE) x<- crab.pca$rotation c.len = length(x[,1]) r.len = length(x[1,]) maxy = which(x == min(x)) x.co <- ceiling(max

[R] R idiom list? [was: Matrix transformation problem

2008-06-11 Thread Dietrich Trenkler
Dimitris Rizopoulos schrieb: sorry, my previous answer was not correct; you need: x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0, 1,0,0), ncol = 3, byrow = TRUE) which(t(x == 1), arr.ind = TRUE)[, "row", drop = FALSE] Dear helpeRs, I would like to use this thread for a proposal which ling

[R] Odp: Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 11.06.2008 12:34:47: > Hi, > > Suppose I have the following data frame. > > __BEGIN__ > > > library(MASS) > > data(crabs) > > crab.pca <- prcomp(crabs[,4:8],retx=TRUE) > > crab.pca$rotation > PC1PC2PC3PC4PC5 > FL 0.288981

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gabor Grothendieck
This suggests that one nice to have item would be to support arr.ind= on which.min and which.max On Wed, Jun 11, 2008 at 7:57 AM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > which(pca == min(pca), arr.ind = TRUE) > which(pca == max(pca), arr.ind = TRUE) > > On Wed, Jun 11, 2008

[R] searching for specific row in matrix

2008-06-11 Thread Esmail Bonakdarian
Hi, I have matrix of bits and a target vector. Is there an efficient way to search the rows of the matrix for the target? I am interested in the first row index where target is found. Example: > source("lookup.R") [,1] [,2] [,3] [,4] [,5] [1,]10110 [2,]11

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Henrique Dallazuanna
Try this: which(pca == min(pca), arr.ind = TRUE) which(pca == max(pca), arr.ind = TRUE) On Wed, Jun 11, 2008 at 7:34 AM, Gundala Viswanath <[EMAIL PROTECTED]> wrote: > Hi, > > Suppose I have the following data frame. > > __BEGIN__ > > > library(MASS) > > data(crabs) > > crab.pca <- prcomp(crabs[

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Frank E Harrell Jr
ChCh wrote: Hello, I have consciously avoided using step() for model simplification in favour of manually updating the model by removing non-significant terms one at a time. I'm using The R Book by M.J. Crawley as a guide. It comes as no surprise that my analysis does proceed as smoothly as doe

Re: [R] model simplification using Crawley as a guide

2008-06-11 Thread Peter Dalgaard
ChCh wrote: > Hello, > > I have consciously avoided using step() for model simplification in favour > of manually updating the model by removing non-significant terms one at a > time. I'm using The R Book by M.J. Crawley as a guide. It comes as no > surprise that my analysis does proceed as smooth

Re: [R] MCA in R

2008-06-11 Thread John Fox
Dear Kimmo, MCA is a rather old name (introduced, I think, in the 1960s by Songuist and Morgan in the OSIRIS package) for a linear model consisting entirely of factors and with only additive effects -- i.e., an ANOVA model will no interactions. You can fit such a model with lm() -- e.g., lm(y ~

Re: [R] piper diagram

2008-06-11 Thread Jim Lemon
Jim Lemon wrote: Dylan Beaudette wrote: Hi, Is anyone on the list familiar with an R implementation of Piper Diagrams? Example: http://faculty.uml.edu/nelson_eby/89.315/IMAGES/Figure%209-78.jpg I am thinking that two calls to triax.plot (plotrix) along with some kind of affine-transformed

[R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gundala Viswanath
Hi, Suppose I have the following data frame. __BEGIN__ > library(MASS) > data(crabs) > crab.pca <- prcomp(crabs[,4:8],retx=TRUE) > crab.pca$rotation PC1PC2PC3PC4PC5 FL 0.2889810 0.3232500 -0.5071698 0.7342907 0.1248816 RW 0.1972824 0.8647159 0.414135

Re: [R] Matrix transformation problem

2008-06-11 Thread Ted Harding
For precisely this particular type of question, the following seems to be the simplest, most direct, and most transparent solution: rowSums(x%*%(1:ncol(x))) # [1] 1 3 2 3 2 1 Ted. On 11-Jun-08 09:21:35, Dimitris Rizopoulos wrote: > sorry, my previous answer was not correct; you need: > > x <-

[R] Fwd: Hello

2008-06-11 Thread sumit gupta
Hii The contour plot is somewhat similar to what I want. I am attaching the data here. What I want to do is divide all the three variable( Recency, frequency,and monetory ) in 5 intervals based on their values.That will make 25 rectangle(5(recency)X 5(frequency) boxes on heat plot. and then plot

[R] Odp: computing and showing mean

2008-06-11 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 11.06.2008 08:41:27: > Hello to everyone, > I am trying to compute a mean and show it to the screen and then save to later be used > as a boxplot.I have used the following code: > dat<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\ here

Re: [R] Bayesian Analysis using the BUGS Language

2008-06-11 Thread Prof Brian Ripley
On Wed, 11 Jun 2008, Uwe Ligges wrote: DrakeGis wrote: WinBugs doesn't run in LINUX. Neither OpenBugs. Ah, sorry, haven't read carefully enough. The only possible thing is to run WinBUGS under wine and use R2WinBUGS, which supports the wine/WinBUGS combination. 'Linux' is too vague. AFA

Re: [R] Matrix transformation problem

2008-06-11 Thread Eik Vettorazzi
you may try a matrix multiplication, which has a very high performance in R x%*%1:ncol(x) hth. [EMAIL PROTECTED] schrieb: ng, I have a matrix (x) with binary content. Each row of the matrix holds exactly one 1, and the rest of the row is zeros. The thing is that I need to 'collapse' the ma

Re: [R] Hello

2008-06-11 Thread Petr PIKAL
"sumit gupta" <[EMAIL PROTECTED]> napsal dne 11.06.2008 07:53:54: > Hello > thanx for the info.. > > I still have tthe doubt regarding the heat map. > I am attching a plot of a 70X3 data matrix.In which 3rd variable has been > shown as colour of different boxes.Could you help me to draw this

Re: [R] Matrix transformation problem

2008-06-11 Thread Dimitris Rizopoulos
sorry, my previous answer was not correct; you need: x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0, 1,0,0), ncol = 3, byrow = TRUE) which(t(x == 1), arr.ind = TRUE)[, "row", drop = FALSE] Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic Univer

Re: [R] Matrix transformation problem

2008-06-11 Thread Dimitris Rizopoulos
try this: x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0, 1,0,0), ncol = 3, byrow = TRUE) which(x == 1, arr.ind = TRUE)[, "col", drop = FALSE] I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kap

Re: [R] difference between nlm and nlminb

2008-06-11 Thread DavidM.UK
I believe nlminb() performs *constrained* optimization, where as nlm() is for *unconstrained* opimization So I guess nlm() is for solving min(f[a,b]), and nlminb() min(f[a,b]) given a+b <= c FYI I think optim() also does constrained optimization, well I've used for min(f[a,b]) given a <= a* and

[R] Matrix transformation problem

2008-06-11 Thread stefan . petersson
ng, I have a matrix (x) with binary content. Each row of the matrix holds exactly one 1, and the rest of the row is zeros. The thing is that I need to 'collapse' the matrix to one column where each row holds the original column index of the 1's (y). Sometimes, the matrix is quite large, so I h

  1   2   >