Re: [R] Potential minor GUI bug

2005-06-17 Thread Francisco J. Zagmutt
Dear Any Thanks for your response. Maybe I did not explain the behavior well. I am aware that the Not Responding is a windows default. What I was trying to explain is that once the process that generated the Not Responding is finished and I can use R for othe computations the Not

Re: [R] Potential minor GUI bug

2005-06-17 Thread Liaw, Andy
Now I understand. I get the same thing in SDI mode (R-2.1.0 on WinXPPro). No idea why... Andy From: Francisco J. Zagmutt Dear Any Thanks for your response. Maybe I did not explain the behavior well. I am aware that the Not Responding is a windows default. What I was trying to

[R] CORRELATION MATRIX CONVERSION

2005-06-17 Thread Omer Bakkalbasi
How do I convert the output of cor(x) to a columnar format? Ex. from format below XYZ X 1.0 0.9 0.5 Y 0.9 1.0 0.1 Z 0.5 0.1 1.0 to format below X X 1.0 X Y 0.9 X Z 0.5 Y X 0.9 Y Y 1.0 Y Z 0.1 Z X 0.5 Z Y 0.1 Z Z 1.0 Thanks! Omer

Re: [R] Potential minor GUI bug

2005-06-17 Thread Uwe Ligges
Liaw, Andy wrote: Now I understand. I get the same thing in SDI mode (R-2.1.0 on WinXPPro). No idea why... I guess this is a Windows bug, because I have seen it in other applications as well. Hence I don't think we should waste our time here ... Uwe Ligges Andy From: Francisco J.

Re: [R] CORRELATION MATRIX CONVERSION

2005-06-17 Thread Uwe Ligges
Omer Bakkalbasi wrote: How do I convert the output of cor(x) to a columnar format? Ex. from format below XYZ X 1.0 0.9 0.5 Y 0.9 1.0 0.1 Z 0.5 0.1 1.0 to format below X X 1.0 X Y 0.9 X Z 0.5 Y X 0.9 Y Y 1.0 Y Z 0.1 Z X 0.5 Z Y 0.1 Z Z 1.0 See, e.g.,

Re: [R] Potential minor GUI bug

2005-06-17 Thread Francisco J. Zagmutt
Dear Uwe I have not seen this behavior in other windows applications but I definitivelly agree with you that it is probably not worth spending time on this trivial issue. Thanks Francisco From: Uwe Ligges [EMAIL PROTECTED] To: Liaw, Andy [EMAIL PROTECTED] CC: 'Francisco J. Zagmutt' [EMAIL

Re: [R] Potential minor GUI bug

2005-06-17 Thread Prof Brian Ripley
Yes, it is a Windows bug: the frame is controlled by Windows and not by R. On Fri, 17 Jun 2005, Uwe Ligges wrote: Liaw, Andy wrote: Now I understand. I get the same thing in SDI mode (R-2.1.0 on WinXPPro). No idea why... I guess this is a Windows bug, because I have seen it in other

Re: [R] lm and time series: simple question

2005-06-17 Thread Prof Brian Ripley
On Thu, 16 Jun 2005 [EMAIL PROTECTED] wrote: This question is partly about R and partly out of my ignorance about time series. I want to regress one time series on another, taking into account the autocorrelation (in an AR1 model) within each series. I am interested in how the standard

Re: [R] possible bug in merge with duplicate blank names in 'by' field.

2005-06-17 Thread Prof Brian Ripley
What version of R is this (please do see the posting guide)? In both 2.1.0 and 2.1.1 beta I get all Promoter ip.x ip.y ip 130 40 40 240 40 40 3a 10 NA NA 4c 20 20 20 5b NA 15 15 6d NA 30 30 so cannot reproduce your

Re: [R] Analysing ordinal/nominal data

2005-06-17 Thread Prof Brian Ripley
On Thu, 16 Jun 2005, Piotr Majdak wrote: I'm looking for a solution to analyse data, which consists of dichotomous responses (yes/no) for 2 multinomial ordinal variables. Please explain how you get a binary response for a `multinomial ordinal variables'? If you intend these variables to be

Re: [R] regressing each column of a matrix on all other columns

2005-06-17 Thread Prof Brian Ripley
apply() is just a for() loop internally so why do you expect it to be faster? Some comments: 1) Here predict() is just extracting the fitted values. 2) Using lm.fit will be faster if fitted values is all you want. 3) You are actually regressing each column on all other columns plus an

Re: [R] Computing generalized eigenvalues

2005-06-17 Thread Prof Brian Ripley
On Thu, 16 Jun 2005, Joshua Gilbert wrote: I need to compute generalized eigenvalues. The eigen function in base doesn't do it and I can't find a package that does. They are very rarely used in statistics, so this is not surprising. I presume you mean solving Ax = lambda B x: if B is

Re: [R] Plotting second axes outside xyplot

2005-06-17 Thread Andrew Robinson
Paul, thanks! An elegant solution. Andrew -- Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : [EMAIL PROTECTED] PO Box 441133W : http://www.uidaho.edu/~andrewr Moscow ID

[R] glmmADMB: Mixed models for overdispersed and zero-inflated count data in R

2005-06-17 Thread Hans Skaug
Dear R-users, Earlier this year I posted a message to this list regarding negative binomial mixed models in R. It was suggested that the program I had written should be turned into an R-package. This has now been done, in collaboration with David Fournier and Anders Nielsen. The R-package

[R] About simulations

2005-06-17 Thread Caroline TRUNTZER
Hello I would like to generate covariance matrix with autoregressive structure. I saw some functions in nlme such as corAR1 for example but I don't know how to use it for my goal. Could someone help me or advise me another function? Thank you in advance Caroline

[R] axis labels vertically

2005-06-17 Thread BoM DS
Hi, I have a plot and a custom axis labeling, e.g. x-c(...) plot(x,axes=FALSE) axis(2) axis(1,1:50,c(label1,...,label50)) now since the labels are quite long, only a few fit on the page. Can I rotate each label by 90 degree counterclockwise (so that they are vertical)

Re: [R] About simulations

2005-06-17 Thread Prof Brian Ripley
ARMAacf() will give you the acf for an autoregression, and toeplitz() wil turn this into a correlation matrix. Then just multiply by the desired variance. I am not sure what this has to do with your subject line, and ?arima.sim might be helpful for that. On Fri, 17 Jun 2005, Caroline TRUNTZER

Re: [R] Analysing ordinal/nominal data

2005-06-17 Thread Piotr Majdak
Prof Brian Ripley wrote: On Thu, 16 Jun 2005, Piotr Majdak wrote: I'm looking for a solution to analyse data, which consists of dichotomous responses (yes/no) for 2 multinomial ordinal variables. Please explain how you get a binary response for a `multinomial ordinal variables'? If

Re: [R] Computing generalized eigenvalues

2005-06-17 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes: On Thu, 16 Jun 2005, Joshua Gilbert wrote: I need to compute generalized eigenvalues. The eigen function in base doesn't do it and I can't find a package that does. They are very rarely used in statistics, so this is not surprising. An aside,

Re: [R] Analysing ordinal/nominal data

2005-06-17 Thread Prof Brian Ripley
As I suggested before, a binomial logistic model is appropriate here, not a Poisson log-linear one. (They are equivalent, but the binomial version is easier to interpret and less wasteful to fit.) You have still not defined v' and w', nor the scores (are they estimated or not). But the model

[R] Mixed model question

2005-06-17 Thread Alfonso M Sanchez-Lafuente
Hi, I am new to this list as a poster, but a reader for some time. I've using R for several weeks now, and I have a lot of questions about certain procedures. Here I go: I want to test if there are differences in the time spent by pollinators visiting flowers of a given plant species,

[R] Mixed model question

2005-06-17 Thread Alfonso M Sanchez-Lafuente
Hi, I am new to this list as a poster, but a reader for some time. I've using R for several weeks now, and I have a lot of questions about certain procedures. Here I go: I want to test if there are differences in the time spent by pollinators visiting flowers of a given plant species,

Re: [R] axis labels vertically

2005-06-17 Thread Sundar Dorai-Raj
BoM DS wrote: Hi, I have a plot and a custom axis labeling, e.g. x-c(...) plot(x,axes=FALSE) axis(2) axis(1,1:50,c(label1,...,label50)) now since the labels are quite long, only a few fit on the page. Can I rotate each label by 90 degree counterclockwise (so that they

Re: [R] CORRELATION MATRIX CONVERSION

2005-06-17 Thread Muhammad Subianto
Maybe like: dat X Y Z X 1.0 0.9 0.5 Y 0.9 1.0 0.1 Z 0.5 0.1 1.0 datrow - stack(as.data.frame(dat)) datrow$X=rownames(dat) datrow values ind X 11.0 X X 20.9 X Y 30.5 X Z 40.9 Y X 51.0 Y Y 60.1 Y Z 70.5 Z X 80.1 Z Y 91.0 Z Z

Re: [R] axis labels vertically

2005-06-17 Thread Uwe Ligges
BoM DS wrote: Hi, I have a plot and a custom axis labeling, e.g. x-c(...) plot(x,axes=FALSE) axis(2) axis(1,1:50,c(label1,...,label50)) now since the labels are quite long, only a few fit on the page. Can I rotate each label by 90 degree counterclockwise (so that they are

Re: [R] Analysing ordinal/nominal data

2005-06-17 Thread Piotr Majdak
Prof Brian Ripley wrote: You have still not defined v' and w', nor the scores (are they estimated or not). But the model I suggested is such a model with scores 1,2,... Sorry for that, here it is: scores v and w: integer scores, reflecting the ordering of columns/rows. Agresti suggests to

Re: [R] axis labels vertically

2005-06-17 Thread BoM DS
2005/6/17, Sundar Dorai-Raj [EMAIL PROTECTED]: You should (re-)read ?axis, which points you to the las parameter: x - 1:50 plot(x, axes = FALSE) axis(1, x, paste(label, x), las = 2, cex.axis = 0.5) axis(2) box() thank you very much. This answer helps me in several ways: 1. it solves my

[R] Error message from pamr

2005-06-17 Thread luk
Hi, I got the fowllowing error message when I run pamr. Could you please advise me what does this error mean? Many thanks -- mydata - pamr.from.excel(datgrp4, 352, sample.labels=TRUE) Read 812768 items Read in 2307 genes Read in 350 samples Read in 350 sample labels Make

[R] mlbench xor

2005-06-17 Thread Thorstensen Nicolas
HI! I have 2D feature vectors and 2 classes. I want to solve this classification problem with SVM. I create an object XOR of the mlbench library. Then I replace the values of the XOR object with my values. Then I do a plot and I have my data plotted and coloured with the labels from the XOR

[R] wapply from gplots -- How do I get a local estimate of variance?

2005-06-17 Thread Fredrik Karlsson
Dear list, I am trying to plot the local variance in a moving window on a dataset. The function that I am trying to use for this is wapply from gtools. However, from the lattice panel function code: snip cat(x) cat(y) wapply(x,y,method=range,width=1/10,fun=sd,na.rm=TRUE)

[R] Fwd: lattice, panel.grid, and scales=list(tick.number=XXX)

2005-06-17 Thread Deepayan Sarkar
I just realised that I had forgotten to copy this to the list. -- Forwarded message -- From: Deepayan Sarkar [EMAIL PROTECTED] Date: Jun 15, 2005 12:13 PM Subject: Re: [R] lattice, panel.grid, and scales=list(tick.number=XXX) To: Berton Gunter [EMAIL PROTECTED] On 6/14/05,

Re: [R] mlbench xor

2005-06-17 Thread Uwe Ligges
Thorstensen Nicolas wrote: HI! I have 2D feature vectors and 2 classes. I want to solve this classification problem with SVM. I create an object XOR of the mlbench library. Then I replace the values of the XOR object with my values. Then I do a plot and I have my data plotted and

Re: [R] Error message from pamr

2005-06-17 Thread Uwe Ligges
luk wrote: Hi, I got the fowllowing error message when I run pamr. Could you please advise me what does this error mean? Many thanks -- mydata - pamr.from.excel(datgrp4, 352, sample.labels=TRUE) Read 812768 items Read in 2307 genes Read in 350 samples

Re: [R] mlbench xor

2005-06-17 Thread Friedrich . Leisch
On Fri, 17 Jun 2005 13:28:21 +0200, Thorstensen Nicolas (TN) wrote: HI! I have 2D feature vectors and 2 classes. I want to solve this classification problem with SVM. I create an object XOR of the mlbench library. Then I replace the values of the XOR object with my values. Then

[R] Rmpi installation over MPICH

2005-06-17 Thread Sean Davis
This is a rather obscure question, I realize. I have written to the package author but have not heard back as of yet. I have read the README in the package, as well, but it didn't give me enough detail to diagnose the problems that I am having. (I did edit out the LAM-MPI check in

Re: [R] CORRELATION MATRIX CONVERSION

2005-06-17 Thread Liaw, Andy
Something like: dat - data.frame(x=runif(10), y=runif(10), z=runif(10)) m - cor(dat) m x y z x 1.000 0.1183305 0.1096394 y 0.1183305 1.000 -0.2819285 z 0.1096394 -0.2819285 1.000 mat2col - function(m) { + m2 - matrix(m, ncol=1) +

Re: [R] CORRELATION MATRIX CONVERSION

2005-06-17 Thread Omer Bakkalbasi
Excellent! This is the most flexible and intuitive option. Thanks! Omer Cell: (914) 671-7447 -Original Message- From: Liaw, Andy [mailto:[EMAIL PROTECTED] Sent: Friday, June 17, 2005 8:40 AM To: '[EMAIL PROTECTED]'; r-help@stat.math.ethz.ch Subject: RE: [R] CORRELATION MATRIX

Re: [R] possible bug in merge with duplicate blank names in 'by' field.

2005-06-17 Thread Frank Gibbons
Thanks for your quick responses, Gabor and Brian. I'm currently running R version 1.9.1 on Linux. Actually, I have just tested this on R v.2.1.0 running under Windows XP, and indeed, as you both indicate, the problem does not exist on that version for that OS. So, at an appropriate time I'll

[R] Trying to build R sources on Windows

2005-06-17 Thread Bill Northcott
I am trying without success to build the R-2.1.0 sources on Windows 2003 server. I have MinGW/bin in front of cygwin/bin in the Windows path. However, I try to build, I get failures trying to include headers which are not part of MinGW. I am definitely using the MinGW compilers, so why

[R] reading csv-data

2005-06-17 Thread Johanna Sundvik
Hi! I have had this problem for a long time. I have tried to study the manuals and search the mailing lists, but I can not solve this. I think there has to be one simple solution to this, but I just can not find it. I have saved the data in excel (csv-format). Then I read the data in R e.g.

[R] [R-pkgs] New CRAN package sp: classes and methods for spatial data

2005-06-17 Thread Edzer J. Pebesma
We're happy to announce the CRAN release of sp, an R package which has new-style classes and methods for spatial data, version 0.7-9. Spatial data types that sp implements are: points, grids, lines, and polygons (i.e., rings) optionally with holes. Methods include + the usual print, summary,

[R] drop elements of vector by class

2005-06-17 Thread E. Michael Foster
i'm trying to build a little summary table for the contents of a data frame. t-sapply(macro, data.class) c-sapply(macro, length) m-sapply(macro, mean, na.rm=T, digits=2) cbind(type=t, n=c , mean=m) I want to drop the variables that are factors so I can include -max- and -min- in my table.

Re: [R] reading csv-data

2005-06-17 Thread Thomas Lumley
On Fri, 17 Jun 2005, Johanna Sundvik wrote: However, this Mean1 is categorical when it should be real numbers. Mean1 [1] 4.4332 8.5113 35.1624 9.1693 2.974 65.1578 43.2241 3.1278 5.3364 Levels: 2.974 3.1278 35.1624 4.4332 43.2241 5.3364 65.1578 8.5113 9.1693 Why R does not understand

[R] How to calculate random matrices from the multivariate normal distribution

2005-06-17 Thread Juan Carlos Quiroz Espinosa
Hi R users, I am trying to calculate MonteCarlo from the multivariate normal distribution. I am utilizing the parameters vector (how mean) and covariance matrix (or 1/hessian) how input. Can anyone provide guidance on how I could do this? Thank you.

[R] Fit values for NA's in linear regression

2005-06-17 Thread Luca Wacker
Hi, To obtain estimates for some missing values in my data I fitted a linear regression and then used the command fitted(model) to get the fitted values from the model, but R doesn't return any values for the NA's. I can calculate the fitted values from the estimates obtained from the summary

Re: [R] Analysing ordinal/nominal data

2005-06-17 Thread Piotr Majdak
Hi Brian (and the list of course!), I still have problems analysing data in R, because I don't know how to tell glm() use row-effect model, please. The models are well defined by Agresti, but can't get the link from the theory to the implementations in R. Different names, definitions and no

Re: [R] reading csv-data

2005-06-17 Thread Ivar Herfindal
Thomas Lumley wrote: On Fri, 17 Jun 2005, Johanna Sundvik wrote: However, this Mean1 is categorical when it should be real numbers. Mean1 [1] 4.4332 8.5113 35.1624 9.1693 2.974 65.1578 43.2241 3.1278 5.3364 Levels: 2.974 3.1278 35.1624 4.4332 43.2241 5.3364 65.1578 8.5113 9.1693

Re: [R] reading csv-data

2005-06-17 Thread Don MacQueen
In my experience, this has always been due to the presence of non-numeric values in the input. In the example you show, it is not obvious that there is any. I would start by first inspecting the input file very carefully, using a text editor outside of R. Since your example appears to have

Re: [R] How to calculate random matrices from the multivariate normal distribution

2005-06-17 Thread Duncan Murdoch
On 6/17/2005 11:03 AM, Juan Carlos Quiroz Espinosa wrote: Hi R users, I am trying to calculate MonteCarlo from the multivariate normal distribution. I am utilizing the parameters vector (how mean) and covariance matrix (or 1/hessian) how input. Can anyone provide guidance on how I could

Re: [R] drop elements of vector by class

2005-06-17 Thread Dimitris Rizopoulos
try this # to get only the factors macro.f - macro[sapply(macro, is.factor)] to drop the factors macro.nf - macro[sapply(macro, !is.factor)] # to get only numerics macro.n - macro[sapply(macro, is.numeric)] and so on. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student

Re: [R] How to calculate random matrices from the multivariate normal distribution

2005-06-17 Thread Spencer Graves
RSiteSearch(random multivariate normal) produced 82 hits, the fourth of which was for multivariate normal distribution, function pmvnorm in library mvtnorm, which also includes a function rmvorm, that should do what you want. Buena suerte. spencer graves Juan Carlos

Re: [R] drop elements of vector by class

2005-06-17 Thread McGehee, Robert
a - data.frame(a = 1:2, b = c(a, b), c = I(c(a, b))) a - a[ , !sapply(a, class) %in% factor] -Original Message- From: E. Michael Foster [mailto:[EMAIL PROTECTED] Sent: Friday, June 17, 2005 10:58 AM To: r-help@stat.math.ethz.ch Subject: [R] drop elements of vector by class i'm trying

Re: [R] Mixed model question

2005-06-17 Thread Spencer Graves
Have you also tried lmer in library(lme4)? This is newer and better in many ways. Unfortunately, I see only one example in the Help file, but you might be able to figure out how to use lmer from the help file and from the 125 hits on RSiteSearch(lmer). The definitive work

Re: [R] Fit values for NA's in linear regression

2005-06-17 Thread Spencer Graves
Have you considered: set.seed(1) tstDF - data.frame(x=1:4, y=c(NA, 2:4+rnorm(3))) fit - lm(y~x, tstDF) predict(fit) 234 1.678441 2.573854 3.469266 predict(fit, tstDF) 1 2 3 4 0.7830284 1.6784410 2.5738536 3.4692662

Re: [R] reading csv-data

2005-06-17 Thread Spencer Graves
I've struggled with this myself in the past. I've recently started using the following: File - pair.txt # File name with path if different from getwd() readLines(File, n=9) The function readLines reads the first n lines as n individual character strings. From this, you

[R] Data comparison

2005-06-17 Thread dscully
Question : Is it possible to create a function, using a for ifelse function, inside sapply, to compare the values in one data frame to a set of upper and lower limits in another data frame, same number of columns., Take the values which meet the requirements TRUE and create a new data frame

Re: [R] Fit values for NA's in linear regression

2005-06-17 Thread Liaw, Andy
It depends on the na.action used in lm(), which defaults to na.omit. Here's an example: x - c(1:5, NA, 7:10) y - rnorm(x) fitted(lm(y ~ x)) 1 2 3 4 5 7 8 0.68680104 0.47913875 0.27147646 0.06381417 -0.14384812 -0.55917271

[R] vectorization

2005-06-17 Thread Dimitri Joe
Hi there, I have a data frame (mydata) with 1 numeric variable (income) and 1 factor (education). I want a new column in this data with the median income for each education level. A obviously inneficient way to do this is for ( k in 1: nrow(mydata) ){ l - mydata$education[k]

Re: [R] Fit values for NA's in linear regression

2005-06-17 Thread Liaw, Andy
I posted a bad example. The question would only make sense if NAs are all in the response. Here's try #2: I believe you can not get fitted values for cases where y is missing directly from the model object. You can, however, use predict(lm.object, newdata=mydata[!complete.cases(mydata)]) to

Re: [R] logistic regression - using polys and products of features

2005-06-17 Thread ronggui
On Fri, 17 Jun 2005 07:39:30 +1000 Stephen Choularton [EMAIL PROTECTED] wrote: Hi I can get all my features by doing this: logistic.model = glm(similarity ~ ., family=binomial, data = cData[3001:3800,]) I can get the product of all my features by this: logistic.model =

[R] trim a string

2005-06-17 Thread Omar Lakkis
How to trim the leading and trailing white space off of a string? If the variable is E I need to convert it to E. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

Re: [R] Mixed model question

2005-06-17 Thread ronggui
and the newest R-new in the www.r-project.org has an article about how to use the lmer function. On Fri, 17 Jun 2005 08:43:41 -0700 Spencer Graves [EMAIL PROTECTED] wrote: Have you also tried lmer in library(lme4)? This is newer and better in many ways. Unfortunately, I see only

[R] How to get the values of a vector having the indices?

2005-06-17 Thread Amir Safari
Hi I want to get the values of a vector which I have its indices. How it is possible? For example after clustering , I can access to the indices of the first cluster using: first- which(clusters$clustering==1) first give me the indices, but how can I access to the values? Thanks a lot and

Re: [R] vectorization

2005-06-17 Thread Liaw, Andy
Here I go again with ave(): mydata$md - ave(mydata$income, mydata$education, FUN=median, na.rm=TRUE) IMHO it's one of the most under-rated helper functions in R. Andy From: Dimitri Joe Hi there, I have a data frame (mydata) with 1 numeric variable (income) and 1 factor (education). I

Re: [R] trim a string

2005-06-17 Thread Liaw, Andy
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14493.html Andy From: Omar Lakkis How to trim the leading and trailing white space off of a string? If the variable is E I need to convert it to E. __ R-help@stat.math.ethz.ch

Re: [R] vectorization

2005-06-17 Thread Huntsinger, Reid
You can use tapply() to compute the medians, as in meds - tapply(mydata$inc,INDEX=mydata$ed,FUN=median) then create a new column with the medians as medianEd - meds[mydata$ed] Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitri

Re: [R] vectorization

2005-06-17 Thread Kevin Bartz
These two lines worked for me: rst - tapply(mydata$income, mydata$education, median) mydata$md - rst[mydata$education] Here's my cheesy example: mydata - data.frame(income= round(rnorm(3, 55000, 1)), + education = letters[rbinom(3, 4, 1/2)+1]) rst -

Re: [R] vectorization

2005-06-17 Thread james . holtman
try this: x.1 - data.frame(income=runif(100)*1, educ=sample(c('hs','col','none'),100,T)) x.1 income educ 1 5930.30882 col 2 5528.83222 hs 3 5967.04041 hs 4 3926.30682 hs 5 2603.75924 none ... x.2 - tapply(x.1$income, x.1$educ, mean) x.2 col

Re: [R] trim a string

2005-06-17 Thread Francisco J. Zagmutt
RSiteSearch(trim) will give you a lot of answers. You cal also use the higher level function trim{R.oo} i.e.: library(R.oo) x=e trim(x) [1] e From: Omar Lakkis [EMAIL PROTECTED] Reply-To: Omar Lakkis [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] trim a string Date: Fri, 17

Re: [R] trim a string

2005-06-17 Thread Prof Brian Ripley
Better code for this purpose is in example(grep). `white space' and `a blank' are not necessarily the same thing. On Fri, 17 Jun 2005, Liaw, Andy wrote: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14493.html Andy From: Omar Lakkis How to trim the leading and trailing white space off

Re: [R] vectorization

2005-06-17 Thread Rau, Roland
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitri Joe Sent: Friday, June 17, 2005 7:01 PM To: R-Help Subject: [R] vectorization Hi there, I have a data frame (mydata) with 1 numeric variable (income) and 1 factor (education). I

Re: [R] trim a string

2005-06-17 Thread Mike R
How to trim the leading and trailing white space off of a string? If the variable is E I need to convert it to E. gsub('^[[:space:]]+', '',E ) gsub('[[:space:]]+$', '',E ) as in R-2.1.0/library/base/html/grep.html

Re: [R] Data comparison

2005-06-17 Thread Duncan Murdoch
On 6/17/2005 12:33 PM, [EMAIL PROTECTED] wrote: Question : Is it possible to create a function, using a for ifelse function, inside sapply, to compare the values in one data frame to a set of upper and lower limits in another data frame, same number of columns., Take the values which

Re: [R] another aov results interpretation question

2005-06-17 Thread Spencer Graves
I commend you to (a) the recent article by Doug Bates on Fitting nonlinear mixed models in R pp. 27-30 in the latest issue of R News available from www.r-project.org - Newsletter and (b) Doug's book with Pinheiro (2000) Mixed-Effects Models in S and S-PLUS (Springer). I suggest you

[R] an operator for contains

2005-06-17 Thread Mike R
k = c(1:9) if( length( which(k==3) ) ){ print(contained) }else{ print(not contained) } is therre a simple way to test if a vector/list contains a particular value? for example an operator, along the lines of: == more generally, is the a documentaion page that lists/describes all such operators?

Re: [R] an operator for contains

2005-06-17 Thread Huntsinger, Reid
Yes, %in% or is.element(). Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike R Sent: Friday, June 17, 2005 4:32 PM To: r-help@stat.math.ethz.ch Subject: [R] an operator for contains k = c(1:9) if( length( which(k==3) ) ){

Re: [R] an operator for contains

2005-06-17 Thread Spencer Graves
Does '?%in%' or '?match' meet your needs? spencer graves Mike R wrote: k = c(1:9) if( length( which(k==3) ) ){ print(contained) }else{ print(not contained) } is therre a simple way to test if a vector/list contains a particular value? for example an operator, along

Re: [R] an operator for contains

2005-06-17 Thread Jonathan Baron
See match(). Also intersect(). The documentation for operators is, I think mostly at the top of the index page for the base package, the one you searched. The relevant one is %in%. I guess Value matching didn't ring the right bell. On 06/17/05 13:31, Mike R wrote: k = c(1:9) if( length(

Re: [R] an operator for contains

2005-06-17 Thread Arne Henningsen
%in% R k - 1:9 R 3 %in% k [1] TRUE R 33 %in% k [1] FALSE Arne On Friday 17 June 2005 22:31, Mike R wrote: k = c(1:9) if( length( which(k==3) ) ){ print(contained) }else{ print(not contained) } is therre a simple way to test if a vector/list contains a particular value? for example an

Re: [R] an operator for contains

2005-06-17 Thread Sarah Goslee
On 6/17/05, Mike R [EMAIL PROTECTED] wrote: k = c(1:9) if( length( which(k==3) ) ){ print(contained) }else{ print(not contained) } is therre a simple way to test if a vector/list contains a particular value? Yes, several. Here's one: k - 1:9 if(any(k == 3)) { cat(is an element\n) } else {

Re: [R] an operator for contains

2005-06-17 Thread Thomas Lumley
On Fri, 17 Jun 2005, Mike R wrote: k = c(1:9) if( length( which(k==3) ) ){ print(contained) }else{ print(not contained) } is therre a simple way to test if a vector/list contains a particular value? value %in% vector more generally, is the a documentaion page that lists/describes all

[R] adjusted R^2 vs. ordinary R^2

2005-06-17 Thread James Salsman
I thought the point of adjusting the R^2 for degrees of freedom is to allow comparisons about goodness of fit between similar models with different numbers of data points. Someone has suggested to me off-list that this might not be the case. Is an ADJUSTED R^2 for a four-parameter, five-point

[R] 3D Scatter Plot

2005-06-17 Thread Lauren, Peter
Hello: I would like to be able to do a 3D scatter plot from 3 variables, 2 independent and 1 dependent. The closest R function I could find for this is cloud. However cloud uses, as input, a matrix where the value of each matrix element is the dependent variable value at that matrix

Re: [R] an operator for contains

2005-06-17 Thread Mike R
wow. thanks everyone for the multitude of suggestions ! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] adjusted R^2 vs. ordinary R^2

2005-06-17 Thread Peter Dalgaard
James Salsman [EMAIL PROTECTED] writes: I thought the point of adjusting the R^2 for degrees of freedom is to allow comparisons about goodness of fit between similar models with different numbers of data points. Someone has suggested to me off-list that this might not be the case. Is an

Re: [R] axis labels vertically

2005-06-17 Thread Mike R
2. I wasn't aware that there is an online-help. (was using the tutorial on the web, which is nat at all detailed. help(), help.search(), and apropos() may all be useful.(thanks Sarah !!) and RSiteSearch() You might find this handy too example(axis)(thanks Brian !!)

Re: [R] axis labels vertically

2005-06-17 Thread Mike R
2. I wasn't aware that there is an online-help. (was using the tutorial on the web, which is nat at all detailed. help(), help.search(), and apropos() may all be useful.(thanks Sarah !!) and RSiteSearch() You might find this handy too example(axis)(thanks Brian !!)

[R] one factor multiple level anova

2005-06-17 Thread Lei Jiang
I am having trouble figuring out this one. I want to do a one way anvoa with 13 levels. mydata is in a vector with length 65. each level has 5 repeats. but it contains NA. I made mygroup-gl(13, 5, 65, labels=(...)) anova(lm(mydata ~ mygroup)) it gives following error: Error in

[R] aggregate?

2005-06-17 Thread alex diaz
Dear all: Here is my problem: Example data: dat-data.frame(x=rep(c(a,b,c,d),2),y=c(10:17)) If I wanted to aggregate each level of column dat$x I could use: aggregate(dat$y,list(x=dat$x),sum) But I just want to aggregate two levels (?c? and ?d?) to obtain a new level ?e? I am expecting

[R] hist single block plot issue

2005-06-17 Thread ap
# CASE 1 # The following plots a single cell or block for all three location 0,1,2. y - rep(2,8) hist(y)# why is this a single block? hist(y,xlim=c(0,2))# same thing hist(y,breaks=2) # same # CASE 2 # adding a different value, plots as expected y - append(y,0) hist(y)

Re: [R] one factor multiple level anova

2005-06-17 Thread Guohui Ding
Test that: mydata - as.numeric(mydata) anova(lm(mydata ~ mygroup)) 2005/6/18, Lei Jiang [EMAIL PROTECTED]: I am having trouble figuring out this one. I want to do a one way anvoa with 13 levels. mydata is in a vector with length 65. each level has 5 repeats. but it contains NA. I made

Re: [R] 3D Scatter Plot

2005-06-17 Thread Deepayan Sarkar
On 6/17/05, Lauren, Peter [EMAIL PROTECTED] wrote: Hello: I would like to be able to do a 3D scatter plot from 3 variables, 2 independent and 1 dependent. The closest R function I could find for this is cloud. However cloud uses, as input, a matrix where the value of each matrix

Re: [R] hist single block plot issue

2005-06-17 Thread Guohui Ding
In case #1, the argument 'breaks' can break the histogram cells: hist(y, breaks=c(0, 0.5, 1.0, 1.5, 2.0)) # not the same ^_^ 2005/6/18, ap [EMAIL PROTECTED]: # CASE 1 # The following plots a single cell or block for all three location 0,1,2. y - rep(2,8) hist(y) # why is this a single

Re: [R] aggregate?

2005-06-17 Thread Gabor Grothendieck
On 6/17/05, alex diaz [EMAIL PROTECTED] wrote: Dear all: Here is my problem: Example data: dat-data.frame(x=rep(c(a,b,c,d),2),y=c(10:17)) If I wanted to aggregate each level of column dat$x I could use: aggregate(dat$y,list(x=dat$x),sum) But I just want to aggregate two levels (c