[R] Levelplot of percentages always using 0 to 100 in the color scheme

2008-02-05 Thread Kelvin
I am trying to create levelplot's of cpu usage for systems. print(levelplot(util.mean ~ x.hour * x.day, colorkey=T, cut=20, scales=list(x=list(at=seq(0,96,length=25), labels=ifelse(seq(0,24) %% 4 == 0, seq(0,24), ''))), # add tick marks at the hour main="CPU Utilization During No

[R] 3D correlation

2008-02-05 Thread ramakg
hits=-1.6 tests=BAYES_00,NO_REAL_NAME X-USF-Spam-Flag: NO Hi all, I don't have enough knowledge in the statistics.Can any one help out how to generate correlated data which is correlated in three variables?? thanks in advance Rama __ R-help@r-project.

Re: [R] How to form a simple R package

2008-02-05 Thread Benilton Carvalho
?package.skeleton b On Feb 5, 2008, at 1:48 PM, [EMAIL PROTECTED] wrote: Is there a function to form in one step (configure files and install) a simple R package of consisting of one script file of R functions? For example in Windows: form.package(name="mypkg", rcodefile ="c:\misc\mypkg.r" )

[R] How to form a simple R package

2008-02-05 Thread Giles . Crane
Is there a function to form in one step (configure files and install) a simple R package of consisting of one script file of R functions? For example in Windows: form.package(name="mypkg", rcodefile ="c:\misc\mypkg.r" ) Thank you for any comments. Giles Giles Crane, M.Phil., MPH Research Scien

[R] Mixed models quantile regression

2008-02-05 Thread Beth Strain
Dear R, I have a question concerning quantile regression models. I am using the quantile regression model to test the relationship between abalone and the percentage cover of algae etc at different sites and depths. An example is fit<-rq(abalone~%coversessileinvertebrates+factor(Depth)+factor(S

Re: [R] extracting AIC scores from lmer and other objects

2008-02-05 Thread jebyrnes
Working with lists of models gets stranger. I've actually found that, with lmer objects in a list, as long as I use them such as in the following example all.models<-c(my.lmer, my.lmer2) summary(all.models[[1]]) Everything is fine. However, if, instead, I had lm objects or glm objects, the sam

Re: [R] error message from apply()

2008-02-05 Thread Stanley Ng
Now I understand why 3 by 3 data2_1 works and not the 3x10 data2_1. How can I precompute thr and pass it safely to function(x) for the column operation ? -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 06, 2008 11:33 To: Ng Stanley Cc: r-help Su

Re: [R] Nested ANOVA models in R

2008-02-05 Thread Bill.Venables
Here is a short example: > dat <- data.frame(x = rnorm(20), a = rep(letters[1:4], 5), b = rep(letters[1:5], each = 4)) > summary(aov(x ~ a*b, dat)) Df Sum Sq Mean Sq a3 0.8021 0.2674 b4 3.7175 0.9294 a:b 12 10.5416

[R] Nested ANOVA models in R

2008-02-05 Thread Daniel Bolnick
Hi, I'm trying to work through a Nested ANOVA for the following scenario: 20 males were used to fertilize eggs of 4 females per male, so that female is nested within male (80 females used total). Spine length was measured on 11 offspring per family, resulting in 880 measurements on 80 families

Re: [R] How to search for packages - wrap up!

2008-02-05 Thread Charilaos Skiadas
On Feb 5, 2008, at 10:37 AM, Monica Pisica wrote: > Hi everybody, > > > I have to recognize that my post certainly shows my lack of skills > in really navigating the R web page i am surprised that only > one or two persons wrote me about the "Task Views" - it is what i > was after - al

[R] inserting text lines in a dat frame

2008-02-05 Thread joseph
Hi Jim I am trying to prepare a bed file to load as accustom track on the UCSC genome browser. I have a data frame that looks like the one below. > x V1V2 V3 1 chr1 11255 55 2 chr1 11320 29 3 chr1 11400 45 4 chr2 21680 35 5 chr2 21750 84 6 chr2 21820 29 7 chr2 31890 46 8 chr3 32100 29 9

Re: [R] ARCH LM test for univariant time series

2008-02-05 Thread Spencer Graves
Dear Bernhard: Thanks very much. Unless you object, I shall add it to the 'FinTS' library as "ArchTest" (comparable to the S-PLUS Finmetrics 'archTest' function) -- with a worked example in '\scripts\ch03.R'. Best Wishes, Spencer Pfaff, Bernhard Dr. wrote: > Dear All, > >

Re: [R] how to plot an user-defined function

2008-02-05 Thread Duncan Murdoch
jim holtman wrote: > Your function 'll' only returns a single value when passed a vector: > > >> x <- seq(0,2,.1) >> ll(x) >> > [1] -7.571559 > > > 'plot' expects to pass a vector to the function and have it return a > vector of the same length; e.g., > > >> sin(x) >> > [1] 0.0

Re: [R] error message from apply()

2008-02-05 Thread jim holtman
You matrix only has 3 rows, so when you do 'apply(data2_1,2,...)' you are extracting columns which only have a length of 3 while thr has a length of 10 > str(data2_1) num [1:3, 1:10] 0.958 0.271 -0.950 -0.130 -0.754 ... > str(thr) num [1:10] 1.060 0.528 0.104 0.925 -0.256 ... > That is wh

Re: [R] error message from apply()

2008-02-05 Thread Ng Stanley
Replacing colMeans by mean removed the warning messages. Thanks However, when I precompute thr, and pass it to function(x), the error returns. Using the shorter data2_1, doesn't give any warnings. What is happening ? data2_1 <- matrix(c(0.9584190, 0.2710325, -0.9495618, -0.1301772, -0.7539687, 0.

Re: [R] how to plot an user-defined function

2008-02-05 Thread jim holtman
Your function 'll' only returns a single value when passed a vector: > x <- seq(0,2,.1) > ll(x) [1] -7.571559 'plot' expects to pass a vector to the function and have it return a vector of the same length; e.g., > sin(x) [1] 0. 0.09983342 0.19866933 0.29552021 0.38941834 0.47942554 0.5

Re: [R] error message from apply()

2008-02-05 Thread jim holtman
The error message was coming from the call to colMeans where 'x' was not a matrix; it was a vector that resulted from the 'apply' call. Did you intend to use 'mean' instead like this example: > data2_1 <- matrix(c(0.9584190, 0.2710325, -0.9495618, -0.1301772, -0.7539687, + 0.5344464, -0.8205933, 0

[R] error message from apply()

2008-02-05 Thread Ng Stanley
Hi, I keep getting the error message. Please help. Error in colMeans(x, na.rm = TRUE) : 'x' must be an array of at least two dimensions The codes are: data2_1 <- matrix(c(0.9584190, 0.2710325, -0.9495618, -0.1301772, -0.7539687, 0.5344464, -0.8205933, 0.1581723, -0.5351588, 0.04448065, 0.9936

Re: [R] R-Commander - pie charts menu blinded out

2008-02-05 Thread John Fox
Dear Peter and Iksmax, To elaborate slightly, the Rcmdr tries to figure out which menu items are appropriate in a given context, and as Peter says, requires that you have at least one factor in the active dataset before activating the pie chart menu item; only factors will be included in the pie-c

[R] how to plot an user-defined function

2008-02-05 Thread John Smith
Dear R-users, Suppose I have defined a likelihood function as ll(tau), how can I plot this likelihood function by calling it by plot? I want to do it like this: ll <- function(tau) { w <- 1 / (s^2 + tau^2) mu <- sum(theta * w) / sum(w) -1/2*sum((theta-mu)^2*w -log(w)) } plot(ll,

Re: [R] modifying arrays within functions

2008-02-05 Thread Bill.Venables
I can feel a sermon coming on... I'd like to emphasize Martin's warning below and encourage you to avoid this kind of construction. The problem is side effects. Some R functions do this (e.g. fix) but everyone understands why. The real problem, in my view, is deeper. The question you ask orig

Re: [R] K Means Clustering Weighted by Frequency

2008-02-05 Thread Bill.Venables
kmeans doesn't allow weights. Since your weights are frequencies, though, there is a slightly inelegant way of handling it. You need to unwind the frequencies and let each point enter the calculation separately. (OK, very inelegant!) A <- a[rep(1:nrow(a), a[, 3]), 1:2] ### expanded

Re: [R] R-Commander - pie charts menu blinded out

2008-02-05 Thread Peter Dalgaard
Agrarimmobilien wrote: > Hello, > > I hope somebody can help me. I'm using the R-comander with library(Rmcdr). > > Using the menu, I added an new data-matrix . After I wanted to draw a pie > chart, but the problem is, that the pie chart menu is blinded out. > > In the concerning variable column, t

[R] multivariate mle ar(1)

2008-02-05 Thread Konrad BLOCHER
Hi, I am trying to perform Maximum Likelihood estimation of a Multivariate model (2 independent variables + intercept) with autocorrelated errors of 1st order (ar(1)). Does R have a function for that? I could only find an univariate option and when writing my own I find that it is pretty memory-c

[R] c-index

2008-02-05 Thread bereket weldeslassie
I am using Cox regression to identify at risk groups. I have a training data set and a validation data set. How can I get the C-index in R? Any hint is highly appreciated. Thanks, Bereket [[alternative HTML version deleted]] __ R-help@r-project

Re: [R] C-index

2008-02-05 Thread Frank E Harrell Jr
bereket weldeslassie wrote: > Hi > > I am using Cox regression to identify at risk groups. How can I get the > C-index in R? > > Thanks, > > Bereket library(Hmisc) ?rcorr.cens # assumes no overfitting Also: library(Design) ?validate # penalizes for overfitting Frank > <'[EMAIL PROTECTED]'>

Re: [R] maps and lattice

2008-02-05 Thread Sundar Dorai-Raj
Jon Loehrke said the following on 2/5/2008 2:29 PM: > Is it possible to place maps onto lattice plots? > > With basic plotting you can add a map to a plot > > library(lattice) > long<-c(-69.2, -69.5, -70.1, -70.3) > lat<-c(41, 41.5, 43.2, 42.8) > plot(long, lat) > map('state', c("massachusetts")

[R] R-Commander - pie charts menu blinded out

2008-02-05 Thread Agrarimmobilien
Hello, I hope somebody can help me. I'm using the R-comander with library(Rmcdr). Using the menu, I added an new data-matrix . After I wanted to draw a pie chart, but the problem is, that the pie chart menu is blinded out. In the concerning variable column, there are no NA -Value (is.na) . Any

[R] maps and lattice

2008-02-05 Thread Jon Loehrke
Is it possible to place maps onto lattice plots? With basic plotting you can add a map to a plot library(lattice) long<-c(-69.2, -69.5, -70.1, -70.3) lat<-c(41, 41.5, 43.2, 42.8) plot(long, lat) map('state', c("massachusetts"),add=TRUE) but is it possible with lattice? library(lattice) factor<

[R] xYplot, error bars, log scale

2008-02-05 Thread Jacob Etches
I'm new to Hmisc and trying to get the following to work, but if I un- comment the y-scale list (in order to get a log-scale for the hazard ratio), the error bars become strangely large. The dataframe is simply ODS output from TPHREG in SAS. Can someone point me towards what I'm sure is a

Re: [R] spilting time series

2008-02-05 Thread Henrique Dallazuanna
Ops, I think is this you want lapply(c("head", "tail"), function(.x)as.ts(apply(a, 2, .x, nrow(a)/2))) On 05/02/2008, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > lapply(split(a, rep(1:2, each=nrow(x)/2)), ts, start=start(a), > freq=frequency(a)) > > > On 04/02/2008, stephen s

Re: [R] spilting time series

2008-02-05 Thread Henrique Dallazuanna
Try this: lapply(split(a, rep(1:2, each=nrow(x)/2)), ts, start=start(a), freq=frequency(a)) On 04/02/2008, stephen sefick <[EMAIL PROTECTED]> wrote: > I have a time series object with two columns. > > a <- ts(x, frequency=1/15) > I would like to split this into two time series of the same length

Re: [R] dynamically add items to key of lattice xyplot

2008-02-05 Thread hadley wickham
On Feb 5, 2008 3:50 AM, Bram Kuijper <[EMAIL PROTECTED]> wrote: > Hi all, > > is it possible to dynamically add key items to an already existing key, > belonging to a lattice xyplot? It's not lattice, but this is pretty easy to do with ggplot2: install.packages("ggplot2") library(ggplot2) qplot(

Re: [R] SAS ODBC

2008-02-05 Thread Scillieri, John
That did it, thanks. -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 4:28 PM To: Scillieri, John Cc: [EMAIL PROTECTED] Subject: Re: [R] SAS ODBC See the help page for odbcConnect. I have no experience with that ODBC driver, but a few

[R] Stratifying level-1 variance with lmer()

2008-02-05 Thread David Afshartous
All, I've fit some models via lme() and now I'm trying to fit similar models with lmer() for some simulations I'm running. The model below (fm1) has an intercept variance that depends on treatment group. How would one accomplish a similar stratification for the level-1 variance, i.e., the with

Re: [R] SAS ODBC

2008-02-05 Thread Prof Brian Ripley
See the help page for odbcConnect. I have no experience with that ODBC driver, but a few contain errors and need believeNRows = FALSE. On Tue, 5 Feb 2008, Scillieri, John wrote: > All, > > I'm trying to connect to a remote SAS server using SAS's 9.1 ODBC driver > and the RODBC package. I'm runn

[R] K Means Clustering Weighted by Frequency

2008-02-05 Thread Aylward, Jesse
*Apologies if this is not the right way to ask a question, I'm a first timer posting here. Does anyone have a solution to this? I'm having trouble figuring out how to use weighting with K Means Clustering. So say if my dataset is: Column 1 = x coords Column 2 = y coords Column 3 = frequency

[R] SAS ODBC

2008-02-05 Thread Scillieri, John
All, I'm trying to connect to a remote SAS server using SAS's 9.1 ODBC driver and the RODBC package. I'm running R-2.6.1 on Win XP. I can successfully connect to the database, but no matter which table I query, I get back an empty table with only the column headers. For example: > sqlQuer

Re: [R] Inconsistent lattice scales$x$at, label behaviour for POSIXct

2008-02-05 Thread Deepayan Sarkar
On 2/5/08, Alex Brown <[EMAIL PROTECTED]> wrote: > I have encountered the following behaviour in lattice in 2.6.1 (and > 2.4.0) which differs depending upon the type you use. I believe the > numeric behaviour to be correct, and the POSIXct behaviour to be in > error. > > When the x data and x axis

Re: [R] precision in seq

2008-02-05 Thread jim holtman
If you want 0,0.05,0.1,...0.95,1.00 then think about encoding as characters: > sprintf("%.2f", seq(0, 1, 0.05)) [1] "0.00" "0.05" "0.10" "0.15" "0.20" "0.25" "0.30" "0.35" "0.40" "0.45" "0.50" "0.55" [13] "0.60" "0.65" "0.70" "0.75" "0.80" "0.85" "0.90" "0.95" "1.00" > then you won't have the p

Re: [R] Vector loop

2008-02-05 Thread jim holtman
Not too sure of exactly what you want to do with the loop. Here is one that prints out the values: > x <- 1:10 > for (i in x) print(i) [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 > On 2/5/08, mohamed nur anisah <[EMAIL PROTECTED]> wrote: > hi, > > I'm in my learning process of

Re: [R] dynamically add items to key of lattice xyplot

2008-02-05 Thread Deepayan Sarkar
On 2/5/08, Bram Kuijper <[EMAIL PROTECTED]> wrote: > Hi all, > > is it possible to dynamically add key items to an already existing key, > belonging to a lattice xyplot? No. -Deepayan > This is what I do: I make an xyplot with an initial key. Later on, I > want to extend this key with more items

Re: [R] extracting AIC scores from lmer and other objects

2008-02-05 Thread Ben Bolker
Jarrett Byrnes ucdavis.edu> writes: > > I have a slight conundrum. I'm attempting to write a scrip that will > take a number of objects (lm, glm, and lmer) and return AIC scores > and weights. I've run into 3 problems, and was wondering if anyone > had any pointers. > > 1) is there any

Re: [R] Using lapply and list names not available

2008-02-05 Thread john seers (IFR)
OK, that looks a good suggestion. Though it is a bit of a step towards loops and counting ... Thanks a lot. Regards JS -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tue 2/5/2008 4:51 PM To: john seers (IFR) Cc: R Help Subject: Re: [R] Using lapply and

Re: [R] Extracting level-1 variance from lmer()

2008-02-05 Thread Doran, Harold
Dave: This is an attribute. So, you can get it as follows: library(lme4) example(lmer) attr(VarCorr(fm1), "sc") > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous > Sent: Tuesday, February 05, 2008 2:37 PM > To: r-help@r-project.o

[R] Extracting level-1 variance from lmer()

2008-02-05 Thread David Afshartous
All, How does one extract the level-1 variance from a model fit via lmer()? In the code below the level-2 variance component may be obtained via subscripting, but what about the level-1 variance, viz., the 3.215072 term? (actually this term squared) Didn't see anything in the archives on this.

Re: [R] How to search for packages

2008-02-05 Thread hadley wickham
> I like the fact that Task Views are written by experts but the > community aspect of crantastic is really appealing. Depending how the > aforementioned experts feel about crantastic, and how it grows and > scales, I would be very glad to see: > > - some "experts reviews" on some packages. some pe

Re: [R] Sampling

2008-02-05 Thread markleeds
>From: Judith Flores <[EMAIL PROTECTED]> >Date: 2008/02/05 Tue PM 12:52:06 CST >To: RHelp <[EMAIL PROTECTED]> >Subject: [R] Sampling you just can put 24 in there and then use replace=FALSE sample(rep(letters[1:2],c(12,12),24,replace=FALSE)) >Hi there, > > I want to generate different samples

Re: [R] Sampling

2008-02-05 Thread Daniel Nordlund
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Judith Flores > Sent: Tuesday, February 05, 2008 10:52 AM > To: RHelp > Subject: [R] Sampling > > Hi there, > >I want to generate different samples using the > followindg code: > > > g<-sample(LE

Re: [R] Sampling

2008-02-05 Thread Jorge Iván Vélez
Hi Judith, Also you can try NSIM=20 # Number of samples res=apply(matrix(rep(rep(LETTERS[1:2],12),NSIM),ncol=NSIM),2,sample) res I hope this helps. Jorge Iván Vélez On 2/5/08, Daniel Dunn <[EMAIL PROTECTED]> wrote: > > sample(rep(LETTERS[1:2],12), 24, replace=F) > > -Original Message--

[R] scatter plot with point colors from kernel density

2008-02-05 Thread James Kellner
I am using R 2.6.1 on a 64 bit PC running Windows XP Pro. My main problem is that I want to produce a scatter plot with density estimation, where the colors of points correspond to a kernel density estimate at the location of the points. I have not found a package that will do this. If the

Re: [R] Sampling

2008-02-05 Thread Chuck Cleland
On 2/5/2008 1:52 PM, Judith Flores wrote: > Hi there, > >I want to generate different samples using the > followindg code: > > > g<-sample(LETTERS[1:2], 24, replace=T) > >How can I specify that I need 12 "A"s and 12 "B"s? > > Thank you, > > Judith x <- rep(c("A","B"), each=12) x [

Re: [R] Sampling

2008-02-05 Thread Zembower, Kevin
Would this work: g<-sample(rep(LETTERS[1:2],12), 24, replace=F) HTH -Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judith Flores Sent: Tuesday, February 05, 2008 1:52 PM To: RHelp Subject: [R] Sampling Hi there, I want to generate different s

Re: [R] Sampling

2008-02-05 Thread Daniel Dunn
sample(rep(LETTERS[1:2],12), 24, replace=F) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judith Flores Sent: Tuesday, February 05, 2008 1:52 PM To: RHelp Subject: [R] Sampling Hi there, I want to generate different samples using the followindg cod

Re: [R] adding the mean and standard deviation to boxplots

2008-02-05 Thread Felipe Carrillo
Tom: You can do this with ggplot2. The code below puts 95% CI,a smooth line and the mean(blue point)on the same plot. Felipe library(ggplot2) r <- ggplot(ToothGrowth, aes(y=len, x=factor(dose))) r$background.fill = "cornsilk" r + geom_boxplot(aes(colour=supp)) + stat_summary(aes(group=supp)

[R] Sampling

2008-02-05 Thread Judith Flores
Hi there, I want to generate different samples using the followindg code: g<-sample(LETTERS[1:2], 24, replace=T) How can I specify that I need 12 "A"s and 12 "B"s? Thank you, Judith Be a better

Re: [R] How to search for packages

2008-02-05 Thread jiho
On 2008-February-04 , at 21:10 , hadley wickham wrote: >> The real answer was Task Views on CRAN (most of the OQs topics >> *are* already >> Task Views), so crantastic is very partial. If you have a little >> time and want > > I think crantastic and task views solve somewhat different problems

Re: [R] Maximum number of variables allowed in a multiple linearregression model

2008-02-05 Thread Bert Gunter
I strongly suggest you collaborate with a local statistician. I can think of no circumstance where multiple regression on "hundreds of thousands of variables" is anything more than a fancy random number generator. -- Bert Gunter Genentech Nonclinical Statistics -Original Message- From: [

[R] Inconsistent lattice scales$x$at,label behaviour for POSIXct

2008-02-05 Thread Alex Brown
I have encountered the following behaviour in lattice in 2.6.1 (and 2.4.0) which differs depending upon the type you use. I believe the numeric behaviour to be correct, and the POSIXct behaviour to be in error. When the x data and x axis in a lattice graph are POSIXct, and when using scal

[R] Maximum number of variables allowed in a multiple linear regression model

2008-02-05 Thread Michelle Chu
Hi, I appreciate it if someone can confirm the maximum number of variables allowed in a multiple linear regression model. Currently, I am looking for a software with the capacity of handling approximately 3,000 variables. I am using Excel to process the results. Any information for processing a

[R] Maximum number of variables allowed in a multiple linear regression model

2008-02-05 Thread Michelle Chu
Hi, I appreciate it if someone can confirm the maximum number of variables allowed in a multiple linear regression model. Currently, I am looking for a software with the capacity of handling approximately 3,000 variables. I am using Excel to process the results. Any information for processing a

Re: [R] Using lapply and list names not available

2008-02-05 Thread Gabor Grothendieck
If you must use lapply then do it over the names rather than the data: lapply(names(people), function(nm) plot(1:10, people[[nm]], main = nm)) On Feb 5, 2008 11:47 AM, john seers (IFR) <[EMAIL PROTECTED]> wrote: > > > Hi Gabor > > Thanks for the suggestion but I am not sure it actually address

Re: [R] Using lapply and list names not available

2008-02-05 Thread john seers (IFR)
Hi Gabor Thanks for the suggestion but I am not sure it actually addresses my problem. I will ponder the idea of my data needing to be in a different form but I am not sure how to get there easily with what I have got. The example I gave was just a simplified example to demonstrate how you ca

Re: [R] C-index

2008-02-05 Thread bereket weldeslassie
Hi > > I am using Cox PH regression using the coxph function to identify at risk > groups. How can I get the C-index (area under ROC curve) statistic in R? > > Thanks, > > Bereket > [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] two densities with same stepsize

2008-02-05 Thread Greg Snow
Duncan told you how to do this using density, another option is to use the logspline package for a different way to estimate densities. With this approach you can use the dlogspline and plogspline functions to compare your density estimates. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Stat

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Luke Tierney
On Tue, 5 Feb 2008, Barry Rowlingson wrote: > Duncan Murdoch wrote: > >> Another problem is that there are two different class systems in R: >> sometimes calls S3 and S4 (because of the versions of S where they were >> introduced). You were reading about S3. > > There's three different class sys

Re: [R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Got it Thanks > On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote: >> Hi, >> >> I'm pretty new to R and seem to be having difficulties with writing a >> function that would change an array and keep the change after the >> function >> finishes its work. >> > It seems you want this: > > X

Re: [R] modifying arrays within functions

2008-02-05 Thread Wittner, Ben, Ph.D.
In general functions changing global variables as a side effect is dangerous (i.e., often leads to programming errors and difficult-to-maintain code). So, if the performance of the following is sufficient, it is what I would recommend. addition <- function(X, a) { X[1, 1] <- X[1, 1] + a X

Re: [R] immediate print

2008-02-05 Thread Christos Hatzis
Introduce cat(j) flush.console() in your loop. -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Waterman, > DG (David) > Sent: Tuesday, February 05, 2008 11:20 AM > To: r-help@r-project.org > Subject: [R] immediate print > > Hi every

Re: [R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Thanks that works fine but still doesnt keep the result only prints it. How can I make it retain the value in the variable? Thanks, > You want to have X as an argument to your function > and return X at the end of it: > > addition <- function(x, a) { > x[1,1] <- x[1,1] + a > x > } > > add

[R] Uninformative error msgs w/ svm.default - Error in svm.default ... y must be a vector or a factor -

2008-02-05 Thread Ken Termiso
Hello, I'm using recursive SVM script (rSVM - http://www.stanford.edu/group/wonglab/RSVMpage/R-SVM.html ) on some microarray data. The data to be input are log2, as numeric matrix w/ attributes -- str(svm_num_mat) num [1:10, 1:12340] 13.1 13.1 13.1 13.1 13.0 ... - attr(*, "dimnames")=List

Re: [R] modifying arrays within functions

2008-02-05 Thread Martin Elff
On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote: > Hi, > > I'm pretty new to R and seem to be having difficulties with writing a > function that would change an array and keep the change after the function > finishes its work. > It seems you want this: X<-array(1,dim=c(2,2)) addition<

Re: [R] modifying arrays within functions

2008-02-05 Thread john seers (IFR)
Hi KB I am not sure exactly what you want to do but perhaps this is this closer to what you need: addition<-function(X, a){Xnew<-X + a} X<-array(1,dim=c(2,2)) a<-2 Xa<-addition(X,a) Xa Regards JS --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf O

Re: [R] Using lapply and list names not available

2008-02-05 Thread Dimitris Rizopoulos
hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO X-USF-Spam-Flag: NO maybe you could use mapply(), e.g., people <- list(Andrew = rnorm(10), Mary = rnorm(10), Jane = rnorm(10), Richard = rnorm(10)) doplot <- function (individual, main) { plot(individual, main = main) } par(mfrow = c(2,2)) jpe

[R] immediate print

2008-02-05 Thread Waterman, DG (David)
Hi everyone, I have a function containing a loop that takes some time to complete. Before I enter the loop I want to print a text string to the screen explaining what is being calculated, however, I find that the information is not printed until the function exits. Is there a way of immediately p

Re: [R] Using lapply and list names not available

2008-02-05 Thread Gabor Grothendieck
The problem is your data is in wide format and you want it in long format. See ?reshape and also see the reshape package. In your example, ?stack is sufficient: library(lattice) xyplot(values ~ seq_along(values) | ind, data = stack(people)) On Feb 5, 2008 11:05 AM, john seers (IFR) <[EMAIL PRO

[R] Incomplete ouput with sink and split=TRUE

2008-02-05 Thread jiho
Dear List, I am trying to get R's terminal output to a file and to the terminal at the same time, so that I can walk through some tests and keep a log concurrently. The function 'sink' with the option split=TRUE seems to do just that. It works fine for most output but for objects of class

[R] Res: How to set working directory to a fixed map?

2008-02-05 Thread Milton Cezar Ribeiro
Hi Kes May be this help: setwd("c:\\temp\\mydir") you can also change by setwd("c:/temp/mydir") Best wishies Miltinho Brazil - Mensagem original De: Falco tinnunculus <[EMAIL PROTECTED]> Para: r-help@r-project.org Enviadas: Terça-feira, 5 de Fevereiro de 2008 9:26:18 Assunto: [R]

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Henrik Bengtsson
On Feb 5, 2008 6:06 AM, Barry Rowlingson <[EMAIL PROTECTED]> wrote: > Duncan Murdoch wrote: > > > Another problem is that there are two different class systems in R: > > sometimes calls S3 and S4 (because of the versions of S where they were > > introduced). You were reading about S3. > > There'

[R] Using lapply and list names not available

2008-02-05 Thread john seers (IFR)
Hello All Using lapply and ending up with lists of lists I often end up in the position of not having the names of the list passed by lapply. So, if I am doing something like a plot, and I would like the title to reflect which plot it is, I cannot easily do it. So I find myself doing some unstru

[R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Hi, I'm pretty new to R and seem to be having difficulties with writing a function that would change an array and keep the change after the function finishes its work. in other words I have an array of 1'sX<-array(1,dim=c(2,2)) I want to add a number to X[1,1] by means of a function called

[R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Hi, I'm preetty new to R and seem to be having difficulties with writing a function that would change an array and keep the change after the function finishes its work. in other words I have an array of 1'sX<-array(1,dim=c(2,2)) I want to add a number to X[1,1] by means of a function called

Re: [R] extracting rows from dataframe that match a vector

2008-02-05 Thread Gabor Csardi
You almost got it right. THe solution is df[df$ind %in% subgr,] See ?"%in%" G. On Tue, Feb 05, 2008 at 04:47:02PM +0100, Karin Lagesen wrote: > > Hi! > > I have a large dataframe that I want to extract a subset from. This > subset has a certain column value that matches elements in a vector I

[R] extracting rows from dataframe that match a vector

2008-02-05 Thread Karin Lagesen
Hi! I have a large dataframe that I want to extract a subset from. This subset has a certain column value that matches elements in a vector I have defined. So, my question is how do I get the rows that match one of the elements in the vector. Example: a = c(1:5) b = letters[1:10] df = data.fram

Re: [R] How to search for packages - wrap up!

2008-02-05 Thread Monica Pisica
Hi everybody, I have to recognize that my post certainly shows my lack of skills in really navigating the R web page i am surprised that only one or two persons wrote me about the "Task Views" - it is what i was after - although maybe too general for my lazy taste - but hei - it is ther

Re: [R] how to suppress some tk dialogs

2008-02-05 Thread jiho
On 2008-February-05 , at 16:13 , Prof Brian Ripley wrote: > Without reproduction instructions we have to guess at what you are > doing. Sorry to not have included some. I did not think it was relevant since this was not directly a coding issue. I'll be more thorough in the future. > But

Re: [R] How to generate table output of a series of lm's

2008-02-05 Thread Martin Elff
On Tuesday 05 February 2008 (15:54:26), Daniel Dunn wrote: > I have a related question. Suppose I generate a series of linear models > > modco=list() > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, > weights=wtz) > modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = c

Re: [R] how to suppress some tk dialogs

2008-02-05 Thread Prof Brian Ripley
Without reproduction instructions we have to guess at what you are doing. But I think the answer is in the help for options(), and more obvious from ?chooseCRANmirror (which seems to be one of the functions you are using). On Tue, 5 Feb 2008, jiho wrote: > Dear List, > > I noticed that, when e

[R] how to suppress some tk dialogs

2008-02-05 Thread jiho
Dear List, I noticed that, when executing R without X11 (e.g. on a remote machine without X forwarding), when R needs to display a Tk dialog (e.g. when presenting the list of mirrors for install.packages,or of available packages containing help on a given keyword) it replaces it by a simpl

Re: [R] How to generate table output of a series of lm's

2008-02-05 Thread Daniel Dunn
I have a related question. Suppose I generate a series of linear models modco=list() modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, weights=wtz) modco[[length(modco)+1]]=lm(normskvop ~ I(nts^0.5)-1, data = colo, weights=wtz, subset=sector!="X") modco[[length(modco)+1]]=lm(norm

[R] Vector loop

2008-02-05 Thread mohamed nur anisah
hi, I'm in my learning process of doing a programming with "for" loop. How to make a loop of a vector of length 10 where elements are 1,2,3,4,5,6,7,8,9,10. Any suggestion needed!! Many thanks. Cheers, Anisah - [[alternative HTML vers

Re: [R] Output mean/median survival time from survfit

2008-02-05 Thread Heinz Tuechler
Maybe this thread is of use for you. How to access results of survival analysis Xiaochun Li (06 May 2006) http://tolstoy.newcastle.edu.au/R/help/06/05/26713.html Heinz At 21:28 04.02.2008, Xing Yuan wrote: >Hi all, > >Does anybody know how to output the mean/median survival time from survfit? >Th

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Barry Rowlingson
Duncan Murdoch wrote: > Another problem is that there are two different class systems in R: > sometimes calls S3 and S4 (because of the versions of S where they were > introduced). You were reading about S3. There's three different class systems if you also include the R.oo add-on package[1

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
On Feb 5, 2008 9:09 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > This illustration uses S3. Note that functions do not modify their arguments > so to modify an object we have to pass it to the method and then pass the > object back. There is also another system called S4 which involves typ

[R] advice requested re: building "good" system (R, SQL db) for handling large datasets

2008-02-05 Thread Thomas Pujol
R-community, Sometime during the next 12-months, I plan on configuring a new computer system on which I will primarily run "R" and a SQL database (Microsoft SQL Server, MySQL, Oracle, etc). My primary goal is to "optimize" the system for R, and for passing data to and from R and the database.

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
This illustration uses S3. Note that functions do not modify their arguments so to modify an object we have to pass it to the method and then pass the object back. There is also another system called S4 which involves typing of arguments and there are packages proto and R.oo which provide differe

Re: [R] How to set working directory to a fixed map?

2008-02-05 Thread Duncan Murdoch
On 2/5/2008 7:26 AM, Falco tinnunculus wrote: > Dear all, > > How do I set the working directory to a fixed map? It's time consuming to > change working directory every time I run R. You can put a setwd() command in your Rprofile. On Windows, you could set the startup directory in the shortcut.

[R] Basic questions about lme()

2008-02-05 Thread Falco tinnunculus
Hi, I have some basic questions about lme(), I have run following: >Mod1<-lme >summary (Mod1) >anova (Mod1) 1. What is the differece between the summary result and the anova result? 2. Is it sufficient to only report the anova result in an article? 3. How is the most proper way to desc

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Duncan Murdoch
On 2/5/2008 8:21 AM, tom soyer wrote: > Hi, > > I read section 5, oop, of the R lang doc, and I am still not sure I > understand how to build a class in R for oop. I thought that since I > understand the oop syntex of Java and VB, I am wondering if the R programmig > experts could help me out by c

Re: [R] precision in seq

2008-02-05 Thread Duncan Murdoch
On 2/5/2008 7:21 AM, Eric Elguero wrote: > thank you to all who answered. > > >> 0+0.05+ > + 0.05+0.05+0.05+0.05+0.05+0.05+ > + 0.05+0.05+0.05+0.05+0.05+0.05+ > + 0.05+0.05+0.05+0.05+0.05+0.05 - 0.95 > [1] 3.330669e-16 > >> seq(0,1,0.05)[20] - 0.95 > [1] 1.110223e-16 > >> 0+19*0.05 - 0.95 > [1]

  1   2   >