Re: [R] how to fetch rows with certain characteristics

2009-10-28 Thread Viechtbauer Wolfgang (STAT)
tapply(x, y, min) where x is the vector of numbers and y the vector of class labels. Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (0)43 388-2277 School for Public Health and Primary Care Office Location: Maast

Re: [R] Negative binomials mixtures

2009-10-28 Thread Jim Silverton
I am trying to find the root of the following function. Basically, I am trying to find n1, n2, prob1, and prob2 from a mixture of two negative binomials.. I differentiated the log likelihood with respect to n and am trying to solve this equation. zij and y are both a column of vectors. y is the dat

[R] Basic question ( too broad for help topics).

2009-10-28 Thread Jim Burke
I have searched help topics but don't know exactly what to search for. Need to use my_num to find any matching STREPs in my_df my_num <- c("101","102","103","104","105","107","108","112","113","114","115") ## "my_df" has 8,000 different STREPS in it. ## I have a statement where I can select

[R] how to fetch rows with certain characteristics

2009-10-28 Thread Waverley @ Palo Alto
Hi, I have a matrix, first column is of certain values, second column is the class labels or a factor. e.g. 1.2 1 1.3 1 1.3 1 1.5 1 2.1 2 2.0 2 9.9 2 1.4 3 1.8 3 1.9 3 I want to find out what is the min values of column 1 for each corresponding class (column 2). For the above example, I want to

[R] modeling and forecasting commodity time series?

2009-10-28 Thread Luna Moon
Hi all, Could anybody please shed some lights on me about good books/literature about modeling and forecasting financial time series in the commodity space? Thanks so much! [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] HOW to determine the number of components of the mixture model stratfied by age

2009-10-28 Thread lybaomc
DOES NOBODY KNOW? HELP! lybaomc wrote: > > Hi,all > > with my data,there are more than 1000 quantitative results of antibody > concentrations, there may be 2 components(positive and negative), or 3 > components (may be strong positive, positive, and negative), or 4-6 > components. Could you

Re: [R] Removing & generating data by category

2009-10-28 Thread jim holtman
Here is one way of doing it: > a <- + data.frame(id=c(c("A1","A2","A3","A4","A5"), + c("A3","A2","A3","A4","A5")),loc=c("B1","B2","B3","B4","B5"), + clm=c(rep(("General"),6),rep("Life",4))) > # split the indices based on 'id' & 'loc' > a.indx <- split(seq(nrow(a)), paste(a$id, a$loc)) > #

Re: [R] Removing & generating data by category

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 9:30 PM, Steven Kang wrote: Dear R users, Basically, from the following arbitrary data set: a <- data .frame (id = c (c ("A1 ","A2 ","A3 ","A4 ","A5 "),c ("A3 ","A2 ","A3 ","A4","A5")),loc=c("B1","B2","B3","B4","B5"),clm=c(rep(("General"), 6),rep("Life",4))) a id

[R] Removing & generating data by category

2009-10-28 Thread Steven Kang
Dear R users, Basically, from the following arbitrary data set: a <- data.frame(id=c(c("A1","A2","A3","A4","A5"),c("A3","A2","A3","A4","A5")),loc=c("B1","B2","B3","B4","B5"),clm=c(rep(("General"),6),rep("Life",4))) > a id loc clm 1 A1 B1 General 2 A2 B2 General 3 A3 B3 General 4 A

[R] Presence Absence of variables in a multivariate data set

2009-10-28 Thread gcam032
I'm sure this is a simple problem, however I need a bit of help to sort it out. I have a multivariate data set of elements. Some of the observations have some amount of certain elements but are lacking in others. Therefore, I want to quickly group/cluster the observations based on a presence/ab

Re: [R] Stack overflow in R 2.10.0 with sub() and gsub() SOLVED!

2009-10-28 Thread Kenneth Roy Cabrera Torres
Thanks to Dr. Ripley and Dr. Murdoch for the workaround and the solution to the problem with sub() and gsub() memory problem. Now, with the perl=TRUE option added it works perfect (with the full database)! alumnos$AL_NUME_ID<-gsub("(^ +)|( +$)","",alumnos$AL_NUME_ID,perl=TRUE) I am going to test

Re: [R] Non-normal residuals.

2009-10-28 Thread Bert Gunter
OOPS! ("Why can't the English learn to speak? ... Why in America, they haven't spoken it for years!" --Prof. Henry Higgins in MY FAIR LADY. ) Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: Rolf Turner [mailto:r.tur...@auckland.ac.nz] Sent: Wednesday, Oc

Re: [R] R 2.10 under Windows XP: glitches and successes

2009-10-28 Thread Ross Boylan
On Wed, 2009-10-28 at 19:03 -0400, Duncan Murdoch wrote: > > Second, install.packages("intervals") produced the usual line about > > selecting a mirror, but no selection list popped up. It just sat > there > > until I interrupted the session and reentered the command with a > > pre-specified repos

Re: [R] re placing in character column

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 7:06 PM, David Winsemius wrote: On Oct 28, 2009, at 6:22 PM, Mark W. Miller wrote: I am guessing that your is not really an NA_character, but rather a factor with a level of "". See if str(s1) confirms my suspicions. df1 <- read.table(textConnection(" Firstname

Re: [R] re placing in character column

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 6:22 PM, Mark W. Miller wrote: I am guessing that your is not really an NA_character, but rather a factor with a level of "". See if str(s1) confirms my suspicions. df1 <- read.table(textConnection(" Firstname Lastname Age + 1Bob Smith 20 + 2 John

Re: [R] R 2.10 under Windows XP: glitches and successes

2009-10-28 Thread Duncan Murdoch
On 28/10/2009 5:54 PM, Ross Boylan wrote: I just installed 2.10 on XP; ESS is my primary interface. I seem to be able to access all the help files; under 2.8.1 I was having seemingly random problems accessing some help topics (including one day I could and a few days later I couldn't, and vice-v

Re: [R] Re ading user input (Readline)

2009-10-28 Thread skyjo
Thanks! Rolf Turner-3 wrote: > > > ?get > > On 29/10/2009, at 11:25 AM, skyjo wrote: > >> >> Hello. I am trying to write an interactive function that asks the >> user for a >> vector of observations. Unfortunately, if a user inputs a vector, R >> treats >> the vector name as a string in

Re: [R] Re ading user input (Readline)

2009-10-28 Thread Rolf Turner
?get On 29/10/2009, at 11:25 AM, skyjo wrote: Hello. I am trying to write an interactive function that asks the user for a vector of observations. Unfortunately, if a user inputs a vector, R treats the vector name as a string instead of a variable. Here is an example: vector.input<-fun

[R] Re ading user input (Readline)

2009-10-28 Thread skyjo
Hello. I am trying to write an interactive function that asks the user for a vector of observations. Unfortunately, if a user inputs a vector, R treats the vector name as a string instead of a variable. Here is an example: vector.input<-function(){ k<-as.integer(readline("Input number of vect

Re: [R] Non-normal residuals.

2009-10-28 Thread Rolf Turner
On 29/10/2009, at 10:48 AM, Bert Gunter wrote: Folks: If generalities -- with the attendant risk of occasional specific caveats and violations -- can be tolerated, then George Box's (paraphrased) comments of circa 40-50 years ago seem apropos: why do statisticians obsess over normality,

Re: [R] re placing in character column

2009-10-28 Thread Mark W. Miller
I am guessing that your is not really an NA_character, but rather a factor with a level of "". See if str(s1) confirms my suspicions. > df1 <- read.table(textConnection(" Firstname Lastname Age + 1Bob Smith 20 + 2 John Clark NA + 3 Andy 40"), header=T)

Re: [R] hierarchical partitioning in generalized linear mixed models

2009-10-28 Thread David Winsemius
The obvious search strategy within Thompson's excellent compendium of R methods to accompany Agresti succeeds: https://home.comcast.net/~lthompson221/Splusdiscrete2.pdf In particular pages 260-267. On Oct 28, 2009, at 5:54 PM, emilio.vir...@urjc.es wrote: dear colleagues, I want to use hier

Re: [R] Can I write Nothing to a variable?

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 5:22 PM, Carl Witthoft wrote: Just wondering if it's possible to have an item with no content at all. Here's what I was hoping to do, inside a larger function that acts on a 3-D array. I want to enter, as one of the arguments to the main function, the index over whic

[R] hierarchical partitioning in generalized linear mixed models

2009-10-28 Thread emilio . virgos
dear colleagues, I want to use hierarchical partitioning methods to evaluate variance contributions of differente predictors within a generalized linear mixed model framework. I don't know if this is possible, because I can not found anything about this issue. My error is poisson and I, at

[R] R 2.10 under Windows XP: glitches and successes

2009-10-28 Thread Ross Boylan
I just installed 2.10 on XP; ESS is my primary interface. I seem to be able to access all the help files; under 2.8.1 I was having seemingly random problems accessing some help topics (including one day I could and a few days later I couldn't, and vice-versa). That's good. I noticed a few glitch

Re: [R] replacing in character column

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 5:19 PM, Mark Miller wrote: I have a small Excel data file with two columns of character variables, one column with a numeric variable and three rows. One of the character cells is blank and one of the numeric cells is blank. I read the data file with the following cod

Re: [R] Non-normal residuals.

2009-10-28 Thread Bert Gunter
Folks: If generalities -- with the attendant risk of occasional specific caveats and violations -- can be tolerated, then George Box's (paraphrased) comments of circa 40-50 years ago seem apropos: why do statisticians obsess over normality, to which most analyses -- i.e. inference (especially from

[R] Can I write Nothing to a variable?

2009-10-28 Thread Carl Witthoft
Just wondering if it's possible to have an item with no content at all. Here's what I was hoping to do, inside a larger function that acts on a 3-D array. I want to enter, as one of the arguments to the main function, the index over which I'm going to do some action. For example, if the actio

[R] replacing in character column

2009-10-28 Thread Mark Miller
I have a small Excel data file with two columns of character variables, one column with a numeric variable and three rows. One of the character cells is blank and one of the numeric cells is blank. I read the data file with the following code: library(RODBC) channel <- odbcConnectExcel('u:/t

Re: [R] Non-normal residuals.

2009-10-28 Thread David Scott
Kjetil Halvorsen wrote: On Wed, Oct 28, 2009 at 7:25 AM, David Scott wrote: Karl Ove Hufthammer wrote: On Tue, 27 Oct 2009 18:06:02 -0400 Ben Bolker wrote: If transforming your data brings you closer to satisfying the assumptions of your analytic methods and having a sensible analysis, then

[R] Help with read.fwf

2009-10-28 Thread Vadlamani, Satish {FLNA}
Hi All: I am trying to use read.fwf and encountering the following error below. Any ideas on what I can do? I tried to use read.table (and the default for read.table is space) and it works. I am not sure why read.fwf is not working test_data_frame = read.fwf(file="small.txt",widths=width_vec,he

Re: [R] Lost all script

2009-10-28 Thread Mark Difford
Hi David, >> Now when I turn on R again the script is now completely blank. This happened to me about 4--5 months ago under Vista. I cannot quite remember what I did but I think I got the script working by opening it in another editor (a hex editor would do) and removing either the first few byt

[R] R/Finance 2010: Applied Finance with R --- Call for Papers

2009-10-28 Thread Jeff Ryan
Call for Papers: R/Finance 2010: Applied Finance with R April 16 and 17, 2010 Chicago, IL, USA The second annual R/Finance conference for applied finance using R will be held this spring in Chicago, IL, USA on April 16 and 17, 2010. The two-day conference will cover topics including portfolio ma

Re: [R] How to union the elements in a list?

2009-10-28 Thread Bert Gunter
Righto! Thanks to Henrik and Martin for pointing this out. unlist() wins by a mile! So this _was_ instructive ... for me! Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: henrik.bengts...@gmail.com [mailto:henrik.bengts...@gmail.com] On Behalf

Re: [R] superscript in ylab

2009-10-28 Thread Peter Ehlers
S Ellison wrote: "Lathouri, Maria" 10/28/09 6:02 PM >>> I want to have as label in y-axis Temperature (oC). First, look at ?plotmath and find the 'degree' symbol... Then look at the symbol for spacing. Then try ylab=expression(Temperature~degree*C) and then perhaps ylab=expression(Temper

Re: [R] Labelling individual points on 3D PCA scatterplot

2009-10-28 Thread Duncan Murdoch
On 10/28/2009 11:21 AM, trz wrote: Hi There, I'm attempting to plot 10 values on a three-dimensional PCA with text labels next to each point. While i have no trouble doing this on 2D plots using the 'text' or 'textxy' function, I cannot find a function to do this on a 3D plot. I am using princom

Re: [R] How to union the elements in a list?

2009-10-28 Thread Henrik Bengtsson
unlist(..., use.names=FALSE) is heaps faster than the default unlist(..., use.names=TRUE), cf. > z <- split(sample(1000,1e6,rep=TRUE),rep(1:1e5,10)) > system.time(y1 <- Reduce(union,z)) user system elapsed 5.980.005.89 > system.time(y2 <- unique(unlist(z))) user system elapsed

Re: [R] How to union the elements in a list?

2009-10-28 Thread Martin Morgan
Bert Gunter writes: > ... and just for amusement: unique(do.call(c,l)) > > The do.call and unlist approaches should be faster than Reduce; do.call > _may_ be marginally faster than unlist. Here's a timing comparison: For large named lists, unlist(l, use.names=FALSE) can have important performanc

Re: [R] How to union the elements in a list?

2009-10-28 Thread Bert Gunter
... and just for amusement: unique(do.call(c,l)) The do.call and unlist approaches should be faster than Reduce; do.call _may_ be marginally faster than unlist. Here's a timing comparison: > z <- split(sample(1000,1e6,rep=TRUE),rep(1:1e5,10)) > length(z) [1] 10 ## the comparisons: > system

Re: [R] superscript in ylab

2009-10-28 Thread S Ellison
>>> "Lathouri, Maria" 10/28/09 6:02 PM >>> >I want to have as label in y-axis Temperature (oC). First, look at ?plotmath and find the 'degree' symbol... Then look at the symbol for spacing. Then try ylab=expression(Temperature~degree*C) ***

Re: [R] How to union the elements in a list?

2009-10-28 Thread Ben Bolker
Peng Yu wrote: > > Suppose that I have a list of vectors. I want to compute the union of > all the vectors in the list. I could use 'for' loop to do so. But I'm > wondering what would be a better solution that does not need a 'for' > loop. > > l=list(a=c(1,3,4), b=c(1,3,6), c=c(1,3,7), ) >

Re: [R] How to union the elements in a list?

2009-10-28 Thread Benilton Carvalho
or unlist(l) and possibly you want a unique() on that... b On Oct 28, 2009, at 5:15 PM, Jorge Ivan Velez wrote: Hi Peng, Here is a suggestion: unique(do.call(c, l)) # [1] 1 3 4 6 7 Best regards, Jorge On Wed, Oct 28, 2009 at 3:07 PM, Peng Yu <> wrote: Suppose that I have a list of ve

Re: [R] Selecting rows according to a column

2009-10-28 Thread Peter Ehlers
William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson Sent: Wednesday, October 28, 2009 9:22 AM To: Gurpal Kalsi; r-help@r-project.org Subject: Re: [R] Selecting rows according to a column Hello, He

Re: [R] How to union the elements in a list?

2009-10-28 Thread Jorge Ivan Velez
Hi Peng, Here is a suggestion: unique(do.call(c, l)) # [1] 1 3 4 6 7 Best regards, Jorge On Wed, Oct 28, 2009 at 3:07 PM, Peng Yu <> wrote: > Suppose that I have a list of vectors. I want to compute the union of > all the vectors in the list. I could use 'for' loop to do so. But I'm > wonder

[R] How to union the elements in a list?

2009-10-28 Thread Peng Yu
Suppose that I have a list of vectors. I want to compute the union of all the vectors in the list. I could use 'for' loop to do so. But I'm wondering what would be a better solution that does not need a 'for' loop. l=list(a=c(1,3,4), b=c(1,3,6), c=c(1,3,7), ) _

Re: [R] wilcox.exact() problem

2009-10-28 Thread Peter Dalgaard
Achim Zeileis wrote: On Wed, 28 Oct 2009, David Croll wrote: Am I paranoid, or am I in search of an exactness statistics cannot deliver? Paranoid. ;-) With your sample size all solutions should be sufficiently close to exact. Well, the world could still be out to get him... It is required

Re: [R] variable labels to accompany data.frame

2009-10-28 Thread David Winsemius
As does Muenchen in RforSASSPSSusers.pdf and in the book that grew out of that effort: http://rforsasandspssusers.googlepages.com/RforSASSPSSusers.pdf http://www.amazon.com/SAS-SPSS-Users-Statistics-Computing/dp/0387094172/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1217456813&sr=8-1 http://rforsasan

[R] Unsuccessful in reproducing README file in package build .zip and R library installed package folder

2009-10-28 Thread morphwj
My OS is Windows XP. "Writing R Extensions", Section 1.1 states "‘README’ or ‘ChangeLog’ will be ignored by R, but may be useful to end-users."  I see examples of README files in packages grDevices folder afm and nlme folder mlbook. The README file was placed at the top level of the packag

Re: [R] variable labels to accompany data.frame

2009-10-28 Thread Ista Zahn
Alzola and Harrell discuss some of these issues in "An introduction to S and the Hmisc and Design Libraries". -ista On Wed, Oct 28, 2009 at 1:27 PM, Jacob Wegelin wrote: > > Often it is useful to keep a "codebook" to document the contents of a > dataset. (By "dataset" I mean > a rectangular stru

Re: [R] variable labels to accompany data.frame

2009-10-28 Thread David Winsemius
I find that Harrell's describe ( Hmisc) provides some of that desired functionality. When I am creating a paper codebook I will print the results of describe function fro a dataframe to create an overview snapshot and will post a copy of str(dfname) on the wall. As his help page says: "desc

Re: [R] column names of a correlation matrix

2009-10-28 Thread Tony Plate
Here's a simple example that might help you get what you want: set.seed(1) x <- matrix(rnorm(30), ncol=3, dimnames=list(NULL, letters[1:3])) (xc <- cor(x)) a b c a 1.000 -0.3767034 -0.7158385 b -0.3767034 1.000 0.6040273 c -0.7158385 0.6040273 1.000

[R] superscript in ylab

2009-10-28 Thread Lathouri, Maria
Dear all I am doing some plots in R. I want to have as label in y-axis Temperature (oC). I have used ylab=expression(paste({Temperature} ^o*C)) but what I get is TemperatureoC. How can I have a space between Temperature and the units and also the units to be in brackets? Many thanks Maria

Re: [R] how to model a numeric factor as a non-ordinal factor

2009-10-28 Thread David Winsemius
So is this factor ordered or not. Is it just in your model to create unordered strata? What does the Time variable look like now? summary(Time) Depending on how Time and Treatment are associated with the subjects you may choose different options. And are they sitting in a dataframe? -- Dav

Re: [R] wilcox.exact() problem

2009-10-28 Thread Achim Zeileis
On Wed, 28 Oct 2009, David Croll wrote: Dear Achim, let me thank you for this assurance! The sample size is too large (~4000 observations per group) to solve this problem exactly. The error message could maybe be improved, but the message is clear: This is too large to deal with. However

Re: [R] Why is package RandomFields not listed in the R 2.10.0 Packages list under Packages, Install package(s)...?

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 1:17 PM, David Winsemius wrote: It appearred to be available from within my Mac OSX system so I went to CRAN. Appears it fails the automated checks for Windows devices: http://cran.r-project.org/web/checks/check_results_RandomFields.html And looking at that compile chec

Re: [R] Why is package RandomFields not listed in the R 2.10.0 Packages list under Packages, Install package(s)...?

2009-10-28 Thread Duncan Murdoch
On 10/28/2009 12:41 PM, morp...@comcast.net wrote: The package list was accessed October 28, 10:13 am MST using Windows XP and mirror USA (CA 1). That list comes from CRAN. You can go there and follow the links through contributed packages until you get to it at http://cran.r-project.org/w

Re: [R] how to model a numeric factor as a non-ordinal factor

2009-10-28 Thread Peter Dalgaard
Mark Kimpel wrote: I am analyzing an experiment in which time is a factor, represented by numbers indicating time since last treatment, but in this particular case there is no reason to think that time has a numeric meaning in the sense that 24 would be greater than 6. We have no idea which genes

[R] variable labels to accompany data.frame

2009-10-28 Thread Jacob Wegelin
Often it is useful to keep a "codebook" to document the contents of a dataset. (By "dataset" I mean a rectangular structure such as a dataframe.) The codebook has as many rows as the dataset has columns (variables, fields). The columns (fields) of the codebook may include: • va

Re: [R] Reading data

2009-10-28 Thread Val
On Wed, Oct 28, 2009 at 1:08 PM, David Winsemius wrote: > > On Oct 28, 2009, at 12:21 PM, Val wrote: > > > > On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius > wrote: > >> >> On Oct 28, 2009, at 11:46 AM, Val wrote: >> >> Val, please take it slow, you are missing basic stuff here. >>>

Re: [R] Why is package RandomFields not listed in the R 2.10.0 Packages list under Packages, Install package(s)...?

2009-10-28 Thread David Winsemius
It appearred to be available from within my Mac OSX system so I went to CRAN. Appears it fails the automated checks for Windows devices: http://cran.r-project.org/web/checks/check_results_RandomFields.html You are supposed to direct such questions to the package maintainer. On Oct 28, 2009,

[R] how to model a numeric factor as a non-ordinal factor

2009-10-28 Thread Mark Kimpel
I am analyzing an experiment in which time is a factor, represented by numbers indicating time since last treatment, but in this particular case there is no reason to think that time has a numeric meaning in the sense that 24 would be greater than 6. We have no idea which genes will be increasing o

Re: [R] Reading data

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 12:21 PM, Val wrote: > > > On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius > wrote: > > On Oct 28, 2009, at 11:46 AM, Val wrote: > > Val, please take it slow, you are missing basic stuff here. > > (1) Windows Explorer may hide extensions; the 'Type' column should > read 'R

Re: [R] Is there a faster way to do it?

2009-10-28 Thread jim holtman
Here is a faster way of doing the replacement: (provide reproducible data next time) > x <- matrix(sample(6:9, 64, TRUE), 8) > x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]87767879 [2,]77867677 [3,]777696

Re: [R] Need help locating the longest series of consecutive numbers in a matrix

2009-10-28 Thread jim holtman
Use 'rle': > x <- rle(sample[,2]) > x Run Length Encoding lengths: int [1:9] 10 3 3 1 1 1 1 17 3 values : num [1:9] 0 1 0 1 0 1 0 1 0 > which.max(x$lengths[x$values==1]) [1] 4 > which.max(x$lengths * x$values) # makes use of the fact you are only using 0 > & 1 [1] 8 > cumsum(c(1, x$lengths))

[R] Is there a faster way to do it?

2009-10-28 Thread Marcio Resende
#Mdarts is a matrix 2343x788 #frequencia is a vector 2343x1 # 9 in Mdarts[fri,frj] stands for my missing values which i want to replace by the value in the vector frequencia Mdarts<-t(matrix(scan("C:/GWS/CNB/dartg.txt"),ncol=nindT,nrow=nm, byrow=T)) frequencia <- matrix(scan("C:/GWS/CNB/freq.txt

Re: [R] Creating a sparse matrix from a file

2009-10-28 Thread Pallavi P
Hi Martin, Unfortunately, the error is coming on the data set that I have right now. I was successfully able to display any field in the matrix and even the whole matrix when I tried the example code provided by you. However, it is failing on the dataset I am working on.I can share the file with y

Re: [R] ggplot2: stat_bin ..count.. with geom_text when NA is present

2009-10-28 Thread Bryan Hanson
Hadley, thanks - that was a permutation that I did not try (but should have thought of it). But... Now, when some observations are removed, you get the count on the plot (previously one did not), however, alas, a new problem: the value of .count.. includes the NA's or something similar. Revised

Re: [R] Selecting rows according to a column

2009-10-28 Thread Gurpal Kalsi
Thanks very much! Gurpal Centrica Energy. On Wed, Oct 28, 2009 at 4:31 PM, William Dunlap wrote: > > -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson > > Sent: Wednesday, October 28, 2009 9:22 AM > > To: Gurpal

[R] Why is package RandomFields not listed in the R 2.10.0 Packages list under Packages, Install package(s)...?

2009-10-28 Thread morphwj
The package list was accessed October 28, 10:13 am MST using Windows XP and mirror USA (CA 1). Bill Morphet, Ph.D. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.

Re: [R] New variables "remember" how they were created?

2009-10-28 Thread Adaikalavan Ramasamy
Your example is too complicated for me. But few points: 1) What do you mean by "instrument"? Do you mean variable? 2) diff(demand) is identical to demand[-1] - demand[-204] 3) system() is a built-in R function, so avoid using it as variable name 4) The variable "yd" is in the eqInvest formula

[R] Easy method to set user-mode virtual memory space in Windows Vista and 7

2009-10-28 Thread Kingsford Jones
I thought I'd share this with the list since it appears to provide a quick fix to some memory problems, and I haven't see it discussed in relation to R. To reallocate virtual memory from kernel-mode to user-mode in 32-bit Vista or Windows 7 one can use the increaseuserva boot option value. See htt

Re: [R] Selecting rows according to a column

2009-10-28 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson > Sent: Wednesday, October 28, 2009 9:22 AM > To: Gurpal Kalsi; r-help@r-project.org > Subject: Re: [R] Selecting rows according to a column > > Hello, > > Here's a

[R] Need help locating the longest series of consecutive numbers in a matrix

2009-10-28 Thread Staples, Angela Dawn
I need to determine the length of the longest series of consecutive numbers (1's to be specific) and the start time of that series. For example, in the following sample, the first column is "time" and the second column indicates the presence of the target behavior. I would like a function that wou

Re: [R] Selecting rows according to a column

2009-10-28 Thread Adaikalavan Ramasamy
Not very elegant but try: z <- data.frame(a = 1:5, b=10*(1:5), c = c("a", "a", "b", "b", "b") ) z[ cbind( 1:nrow(z), match( as.character(z$c) , colnames(z) ) ) ] If you have very few columns, you can use ifelse() too. Regards, Adai Gurpal Kalsi wrote: Hi, With a data such as: z = data.f

Re: [R] structural equation modeling

2009-10-28 Thread Ista Zahn
There is a package in beta testing now that looks interesting: http://openmx.psyc.virginia.edu/installing-openmx -Ista On Wed, Oct 28, 2009 at 10:37 AM, Robert Terwilliger wrote: > Dear R-help, > > I am interested in using structural equation modeling. > > Just getting started with it, but I'm

Re: [R] Selecting rows according to a column

2009-10-28 Thread Erik Iverson
Hello, Here's an idea: ifelse(z$c == "a", z$a, z$b) > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Gurpal Kalsi > Sent: Wednesday, October 28, 2009 11:15 AM > To: r-help@r-project.org > Subject: [R] Selecting rows accordin

Re: [R] Reading data

2009-10-28 Thread Val
On Wed, Oct 28, 2009 at 11:59 AM, David Winsemius wrote: > > On Oct 28, 2009, at 11:46 AM, Val wrote: > > Val, please take it slow, you are missing basic stuff here. >> >>> >>> (1) Windows Explorer may hide extensions; the 'Type' column should >>> read 'R file' anyway. >>> >>> >> * Yes I looked

Re: [R] Standard Time Stamps

2009-10-28 Thread Sunita Patil
Hello Jim Thanx a lot. Actually since long I was trying > dts = c("1989-09-28", "2001-01-15", "2004-08-30", "1990-02-09") > dts [1] "1989-09-28" "2001-01-15" "2004-08-30" "1990-02-09" > GMT = timeDate(dts, zone = "GMT", FinCenter = "GMT") > GMT GMT [1] [1989-09-28] [2001-01-15] [2004-08-30] [199

Re: [R] Standard Time Stamps

2009-10-28 Thread jim holtman
How about this: > x <- c("2008-09-12T23:48:07.747Z", "2008-09-12T20:35:07.747Z") > x.t <- as.POSIXct(x, format="%Y-%m-%dT%H:%M:%OS") > > x.t [1] "2008-09-12 23:48:07 EDT" "2008-09-12 20:35:07 EDT" > diff(x.t) Time difference of -3.216667 hours > On Wed, Oct 28, 2009 at 12:11 PM, Sunita22 wrote:

[R] Selecting rows according to a column

2009-10-28 Thread Gurpal Kalsi
Hi, With a data such as: > z = data.frame(a = 1:5, b=10*a, c = c("a", "a", "b", "b", "b") ) * a b c* *1* 10 *a* *2* 20 *a* 3 *30* *b* 4 *40* *b* 5 *50* *b* Can anyone suggest a way to select [1, 2, 30, 40, 50], ie. using column "c" to specify which column is selected for each row. Many th

[R] Standard Time Stamps

2009-10-28 Thread Sunita22
Hello I have a data set which contains a column of Standard Time Stamps (2008-09-12T23:48:07.747Z, 2008-09-12T20:35:07.747Z, etc) I need to find differences in consecutive time stamps and then need to plot a graph using it, can anyone guide me as to how to handle this type of data? Thanks in ad

Re: [R] Lost all script

2009-10-28 Thread Adaikalavan Ramasamy
To stop in Rgui mode, you can try pressing the ESC key. If you are using within emacs, change to R buffer and try C-c C-c to stop it. I am not sure how to recover the script (emacs usually makes a .R~ backup). Maybe if you still have the output printed to screen or terminal make a copy of it

Re: [R] Antropometrics with R

2009-10-28 Thread S Ellison
The gamlss package, by Mikis Stasinopoulos and available at http://www.gamlss.com/ as well as from CRAN, is also very flexible, allowing shape and scale adjustment. Steve E >>> David Winsemius 28/10/2009 14:18 >>> You might want to take a look at this article by WEI, PERE, KOENKER, AND HE.

Re: [R] Reading data

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 11:46 AM, Val wrote: Val, please take it slow, you are missing basic stuff here. (1) Windows Explorer may hide extensions; the 'Type' column should read 'R file' anyway. * Yes I looked at it and it only shows type. To check I downloaded another script with R extens

Re: [R] Lost all script

2009-10-28 Thread Duncan Murdoch
On 10/28/2009 11:37 AM, David Young wrote: Hi all, I just had a rather unpleasant experience. After considerable work I finally got a script working and set it to run. It had some memory allocation problems when I came back so I used Windows to stop it. During that process it told me that the

Re: [R] Reading data

2009-10-28 Thread Peter Ehlers
David Winsemius wrote: On Oct 28, 2009, at 10:55 AM, Val wrote: The working directory is getwd() [1] "C:/Documents and Settings/Val/My Documents" The data file(Rossi.dat) and the script(Rossi.R) are in "C:/Documents and Settings/Val/My Documents/R_data/prd" So you are not giving a prope

Re: [R] Data Partition Package

2009-10-28 Thread Xu
Thanks a lot. Have a nice day! Best, Pat On Wed, Oct 28, 2009 at 10:29 AM, Max Kuhn wrote: > There are a few. I'm partial to the function in the caret package: > createDataPartition. Also, there are functions there for > pre-processing on training sets and applying it to new data sets. > > For

[R] Labelling individual points on 3D PCA scatterplot

2009-10-28 Thread trz
Hi There, I'm attempting to plot 10 values on a three-dimensional PCA with text labels next to each point. While i have no trouble doing this on 2D plots using the 'text' or 'textxy' function, I cannot find a function to do this on a 3D plot. I am using princomp for my PCA: >PCA<-princomp(eucdat

Re: [R] cox regression extract strata as numeric

2009-10-28 Thread Terry Therneau
-- begin included message --- > (basehazzft.ln$stra[285]) [1] stra=2 134 Levels: stra=1 stra=10 stra=100 stra=101 stra=102 ... stra=99 > c(basehazzft.ln$stra[285]) [1] 47 while the desired value is 2, I get a 47. What am I doing wrong? I tried the as.numeric function but I have the same problem..

[R] Kruskal-Wallis test and kruskalmc

2009-10-28 Thread KEL
Dear all, I am using the Kruskal-Wallis test in R (kruskal.test()) to compare non-normally distributed observations for 5 different groups. I now want to perform multiple comparisons to identify the groups with significant differences in the mean ranks. On searching the forum I found a number of

Re: [R] Reading data

2009-10-28 Thread Val
Val, please take it slow, you are missing basic stuff here. > > (1) Windows Explorer may hide extensions; the 'Type' column should > read 'R file' anyway. > * Yes I looked at it and it only shows type. To check I downloaded another script with R extension "test.R" and the type column shows th

Re: [R] x11(title=' ')

2009-10-28 Thread Greg Snow
The general way to create a title for multiple plots on the same page is to first create some room for the title by setting the outer margins (using par(oma=...)), then use mtext or title with the outer=TRUE argument to place the overall title. -- Gregory (Greg) L. Snow Ph.D. Statistical Data

[R] Lost all script

2009-10-28 Thread David Young
Hi all, I just had a rather unpleasant experience. After considerable work I finally got a script working and set it to run. It had some memory allocation problems when I came back so I used Windows to stop it. During that process it told me that the script had been changed and asked if I wanted

Re: [R] how do I plot a regression curve with the data?

2009-10-28 Thread Kingsford Jones
On Wed, Oct 28, 2009 at 9:23 AM, Tom Gottfried wrote: > ?curve > > regards, > Tom and I was in the process of writing a curve example when I noticed Tom sent this. Here it is: set.seed(777) x <- runif(100, 0, 100) y <- 10*x + x^2 - .01*x^3 + rnorm(100, 0, 500) fit <- lm(y ~ x + I(x^2) + I(x^3))

Re: [R] Reading data

2009-10-28 Thread David Winsemius
On Oct 28, 2009, at 10:55 AM, Val wrote: The working directory is getwd() [1] "C:/Documents and Settings/Val/My Documents" The data file(Rossi.dat) and the script(Rossi.R) are in "C:/Documents and Settings/Val/My Documents/R_data/prd" So you are not giving a proper path when you issue the

Re: [R] Data Partition Package

2009-10-28 Thread Max Kuhn
There are a few. I'm partial to the function in the caret package: createDataPartition. Also, there are functions there for pre-processing on training sets and applying it to new data sets. For a somewhat dated summary of the packages, see: http://www.jstatsoft.org/v28/i05 also: http://c

Re: [R] Regex matching that gives byte offset?

2009-10-28 Thread Prof Brian Ripley
Do you mean like regexpr() (on the same help page)? Depending on your locale, you might actually prefer the character offset: if you want to match in a MBCS and have byte offsets you will need to work a bit harder if useBytes=TRUE is not sufficient for you. On Wed, 28 Oct 2009, Johannes Graum

Re: [R] how do I plot a regression curve with the data?

2009-10-28 Thread Tom Gottfried
?curve regards, Tom Ken Ervin schrieb: > I have a data set of 6 or so ordered pairs, and I've been able to graph > them and have decided to use a high-order polynomial regression. I've > used the following piece of code: > > regression <- function(x,y) { >x <- c(insert_numbers_here) >y

[R] Data Partition Package

2009-10-28 Thread Xu
Hi, Users, I am a new user. I am trying to partition data into training and test. Is there any R package or function that can partition dataset? Also, is there any package do crossvalidation? Any help will be appreciated. Best, Pat [[alternative HTML version deleted]] ___

[R] Question on Bias calculations and question on read.fwf

2009-10-28 Thread Vadlamani, Satish {FLNA}
Hi All: Bear with me on this longer e-mail. Questions: 1) Can you share with me on any example code that you may have that calculates bias of a statistical forecast in a time series? 2) Supposed I have the file in the fixed width format (details below). 1-62 character key 63-76 sales data point

  1   2   >