Re: [R] Using 'cat' on data frame

2008-12-23 Thread Veslot Jacques
print(as.matrix(raw.count),quote=F) cat(as.character(raw.count$Var1)) Jacques VESLOT CEMAGREF - UR Hydrobiologie Route de Cézanne - CS 40061 13182 AIX-EN-PROVENCE Cedex 5, France Tél. + 0033 04 42 66 99 76 fax+ 0033 04 42 66 99 34 email jacques.ves...@cemagref.fr >-Me

[R] Using 'cat' on data frame

2008-12-23 Thread Gundala Viswanath
Dear all, I have the following data frame: > raw.count Var1 Freq 1 AA 707 2 AC14 3 AT 3 But why when printint it using 'cat',

Re: [R] Using SPSS Labels

2008-12-23 Thread Prof Brian Ripley
1) We didn't get the attachment. The allowed types are given in the posting guide and are pretty restrictive: the suggestion is to put binary files on the web for download. 2) We don't have the version information asked for in the posting guide. I would only expect this to work in foreign 0.8

Re: [R] imputing the numerical columns of a dataframe, returning the rest unchanged

2008-12-23 Thread Yihui Xie
Hi, ?sapply will tell you 'sapply' is a user-friendly version of 'lapply' by default returning a vector or matrix if appropriate. so 'x' has lost its class in sapply(); e.g. ## iris is a data.frame > str(iris) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5

Re: [R] Conditional Counting with Table

2008-12-23 Thread Gustavo Carvalho
Hello, Something like this should work: table(test$V1[!test$V2 %in% c("NM","QC")]) Cheers, Gustavo. On Wed, Dec 24, 2008 at 3:06 AM, Gundala Viswanath wrote: > Dear all, > > I have the following data frame: > > V1 V2 > aaachr1 > aaachr2 > aaaNM > aaaQC > aaachr10 > att

Re: [R] sem package fails when no of factors increase from 3 to 4

2008-12-23 Thread Xiaoxu LI
Dear Prof. FOX, Good starting values are very critical in real applying cases. If sem package could automatically delete one or some variables to fit an embedded small model, just to automatically provide good starting values, I think it could be more useful. Moreover, I think starting value searc

[R] Conditional Counting with Table

2008-12-23 Thread Gundala Viswanath
Dear all, I have the following data frame: V1 V2 aaachr1 aaachr2 aaaNM aaaQC aaachr10 att NM att chr7 What I want to do is to count the string (V1). But the condition of counting is: if the V2 of the string is "NM" or "QC" then the count is not increased. Henc

[R] Write a data frame to Oracle Data Base

2008-12-23 Thread usstata
Hi guys: When I use the ROracle package, I found the function 'dbWriteTable' can't work. The data frame can't be written to 10g Oracle Data Base. Here is what happened to me. >library(DBI) >library(ROracle) >drv <- Oracle() >con <- dbConnect(drv , 'uid','pw','db') >mm <- data.frame(CO2) > dbW

[R] Non-finite finite difference error

2008-12-23 Thread JS . Augustyn
Hello, I'm trying to use fitdistr() from the MASS package to fit a gamma distribution to a set of data. The data set is too large (1167 values) to reproduce in an email, but the summary statistics are: Min. 1st Qu. Median Mean 3rd Qu. Max. 116.7 266.7 666.7 1348.0 1642.0 16720.0 The call I'm

[R] Using SPSS Labels

2008-12-23 Thread Andrew Choens
I am trying to import a SPSS.sav file into R. The attached file is not technically the file I am trying to import, but does replicate my problem. The actual file is much too large to attach. No matter what I do, I can not get R (base or Hmisc) to apply the value labels in the .sav file to the dataf

Re: [R] How do I reload sessions from a non-default directory in OS X?

2008-12-23 Thread David Winsemius
On Dec 23, 2008, at 10:02 PM, David Winsemius wrote: On Dec 23, 2008, at 5:18 PM, Bill McNeill (UW) wrote: i use the GUI version of R on OS X. I launch it by double-clicking on the R icon. The process always starts in my home directory which means that the only .RData file that is ever r

Re: [R] How do I reload sessions from a non-default directory in OS X?

2008-12-23 Thread ronggui
You can use setwd() to change the working directory. Merry X-mas On Wed, Dec 24, 2008 at 6:18 AM, Bill McNeill (UW) wrote: > i use the GUI version of R on OS X. I launch it by double-clicking on the R > icon. The process always starts in my home directory which means that the > only .RData fil

Re: [R] How do I reload sessions from a non-default directory in OS X?

2008-12-23 Thread Charles C. Berry
In the R for Mac OS X FAQ (available in the Help menu) see 4.5.4 Misc Menu and 4.5.5 Workspace Menu This is an R-sig-mac question, so posting there would have been preferred. Chuck On Tue, 23 Dec 2008, Bill McNeill (UW) wrote: i use the GUI version of R on OS X

Re: [R] ggplot2's qplot() not rendering title descender

2008-12-23 Thread hadley wickham
Hi Mike, Yup, that's a bug that will be fixed in the next version. In the meantime one easy fix is to add an \n on the end of the title string. Hadley On Tue, Dec 23, 2008 at 7:02 PM, Mike Lawrence wrote: > On my machine (Mac OS 10.5.6, R 2.8.1) the following plot is drawn such that > a substa

Re: [R] Extract values based on indexes without looping?

2008-12-23 Thread Charles C. Berry
On Tue, 23 Dec 2008, Sean Zhang wrote: Dear R-Helpers: I am a entry level user of R. You need to read An Introduction to R particularly this section: 2.7 Index vectors; selecting and modifying subsets of a data set ... 2. A vector of positive integral qua

Re: [R] 4 questions regarding hypothesis testing, survey package, ts on samples, plotting

2008-12-23 Thread Ben Bolker
Khawaja, Aman wrote: > > I need to answer one of the question in my open source test is: What are > the four questions asked about the parameters in hypothesis testing? > > Please check the posting guide. * We don't answer homework questions ("open source" doesn't mean that other people answ

Re: [R] Extract values based on indexes without looping?

2008-12-23 Thread Jorge Ivan Velez
How about this? value.vec[which.vec] HTH, Jorge On Tue, Dec 23, 2008 at 9:52 PM, Sean Zhang wrote: > Dear R-Helpers: > > I am a entry level user of R. > > Have the following question. Many thanks in advance. > > > # value.vec stores values > value.vec <- c('a','b','c') > # which.vec stores t

Re: [R] Extract values based on indexes without looping?

2008-12-23 Thread David Winsemius
> sapply(which.vec, function(x){ value.vec[x] } ) [1] "c" "b" "b" "a" On Dec 23, 2008, at 9:52 PM, Sean Zhang wrote: # value.vec stores values value.vec <- c('a','b','c') # which.vec stores the locations/indexs of values in value.vec. which.vec <- c(3, 2, 2, 1) # How can I obtain the followin

[R] wavelet

2008-12-23 Thread stephen sefick
I would like to be able to preform a DWT and filter out everything except for 2^0 and then take that back into the time domain. Does anyone have any suggestions. I am using wmtsa to try and do this. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so litt

Re: [R] How do I reload sessions from a non-default directory in OS X?

2008-12-23 Thread David Winsemius
On Dec 23, 2008, at 5:18 PM, Bill McNeill (UW) wrote: i use the GUI version of R on OS X. I launch it by double-clicking on the R icon. The process always starts in my home directory which means that the only .RData file that is ever read in is the one in my home directory. I would inst

[R] Extract values based on indexes without looping?

2008-12-23 Thread Sean Zhang
Dear R-Helpers: I am a entry level user of R. Have the following question. Many thanks in advance. # value.vec stores values value.vec <- c('a','b','c') # which.vec stores the locations/indexs of values in value.vec. which.vec <- c(3, 2, 2, 1) # How can I obtain the following vector based on t

[R] 4 questions regarding hypothesis testing, survey package, ts on samples, plotting

2008-12-23 Thread Khawaja, Aman
I need to answer one of the question in my open source test is: What are the four questions asked about the parameters in hypothesis testing? Thanks. Aman - CONFIDENTIAL- This email and any files transmitted with it are confide...{{dropped:9}} __ R-he

[R] How do I reload sessions from a non-default directory in OS X?

2008-12-23 Thread Bill McNeill (UW)
i use the GUI version of R on OS X. I launch it by double-clicking on the R icon. The process always starts in my home directory which means that the only .RData file that is ever read in is the one in my home directory. I would instead like to have different R sessions saved in different direct

[R] ggplot2's qplot() not rendering title descender

2008-12-23 Thread Mike Lawrence
On my machine (Mac OS 10.5.6, R 2.8.1) the following plot is drawn such that a substantial portion of the descender of the title is covered by the plot: library(ggplot2) qplot(x=1:10,y=1:10,main='p q j g') -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University www.thatmik

[R] 4 questions regarding hypothesis testing, survey package, ts on samples, plotting

2008-12-23 Thread Khawaja, Aman
Please provide me the info on what are the 4 questions about the parameters in hypothesis testing Thanks. Aman - CONFIDENTIAL- This email and any files transmitted with it are confide...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.e

Re: [R] .C and 'temporaries'

2008-12-23 Thread Duncan Murdoch
On 23/12/2008 6:55 PM, Thomas Mang wrote: Hello, Before I get into troubles I ask here: I make a call to a C function using .C. What I would like to know is if the arguments in the .C call can also be 'temporary' objects. An example will illustrate this: # here we don't have a temporary Obj

Re: [R] beginner data.frame question

2008-12-23 Thread John Fox
Dear Kirk, Actually, co2 isn't a data frame but rather a "ts" (timeseries) object. A nice thing about R is that you can query and examine objects: > class(co2) [1] "ts" > str(co2) # structure of object Time-Series [1:468] from 1959 to 1998: 315 316 316 318 318 ... > unclass(co2) [1] 315.42 3

[R] .C and 'temporaries'

2008-12-23 Thread Thomas Mang
Hello, Before I get into troubles I ask here: I make a call to a C function using .C. What I would like to know is if the arguments in the .C call can also be 'temporary' objects. An example will illustrate this: # here we don't have a temporary Obj1 = 5 .C("Func", as.integer(Obj1 ), ...) #

Re: [R] beginner data.frame question

2008-12-23 Thread David Winsemius
> class(co2) [1] "ts" > is.data.frame(co2) [1] FALSE If you try these functions on your test.data I am guessing that the results will differ from above. -- David Winsemius On Dec 23, 2008, at 6:29 PM, Kirk Wythers wrote: I need some help understanding how on of the example data sets is for

[R] beginner data.frame question

2008-12-23 Thread Kirk Wythers
I need some help understanding how on of the example data sets is formatted in the basic R installation. If I load the Mona Loa CO2 data, with the command: > data(co2) I can view the data with: > co2 And the data are in the form of 11 rows labeled as years (1994-2004) and 12 columns labe

Re: [R] QCA adn Fuzzy

2008-12-23 Thread Adrian Dusa
Hi ronggui, I believe it is "dear Adrian and Prof. Gott" :) (at least I feel more comfortable being called directly) Thanks very much for this, I am developing a series of functions for fuzzy-set operations to be included in the next release of the QCA package, and your function seems to do a g

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread Frank E Harrell Jr
sp wrote: Dr. Harrell, Thanks for your patient replies. I've two more questions: 1) Is your book appropriate for beginners or is it more for advanced users? It is in the middle of those two. 2) f <- ols(y ~ rcs(x,3), data=mydata) Function(f) does not produce anything for me (i.e.) it's emp

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread sp
Dr. Harrell, Thanks for your patient replies. I've two more questions: 1) Is your book appropriate for beginners or is it more for advanced users? 2) f <- ols(y ~ rcs(x,3), data=mydata) Function(f) does not produce anything for me (i.e.) it's empty. Sincerely, sp --- On Tue, 12/23/08, Frank E

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread Frank E Harrell Jr
sp wrote: Sincere thanks for both the replies. 0. I agree, I'm waiting for my copy of a regression book to arrive. Meanwhile, I'm trying to read on google. 1. My bad, I'm using Gaussian noise. 2. I didn't have x^3 b/c that co-efficient happens to be zero in this fitting. That's strange.

Re: [R] NetCDF within R: installation assistance

2008-12-23 Thread Prof Brian Ripley
On Tue, 23 Dec 2008, Ken Schmidt wrote: Greetings. I am attempting to add NetCDF libraries within R, and have failed. We have R version 2.8, and are running on a 64-bit Redhat Linux 2.6.18 kernel: Red Hat Enterprise Linux Client release 5.2 (Tikanga) Linux halfmoon.ncdc.noaa.gov 2.6.18-92.1

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread sp
Sincere thanks for both the replies. 0. I agree, I'm waiting for my copy of a regression book to arrive. Meanwhile, I'm trying to read on google. 1. My bad, I'm using Gaussian noise. 2. I didn't have x^3 b/c that co-efficient happens to be zero in this fitting. 3. I used lines() b/c I wanted t

[R] Tukey on interaction means after lmer

2008-12-23 Thread Lawrence Hanser
Dear Colleagues, I fit this model: mod1 <- lmer(x~category*comp+(1|id),data=impchiefsrm) where category has 4 levels and comp has 8 levels. These work: glht(mod1, linfct=mcp(category="Tukey") glht(mod1, linfct=mcp(comp="Tukey") What I'd like is (conceptually): glht(mod1, linfct=mcp(category:c

Re: [R] Interval censored Data in survreg() with zero values!

2008-12-23 Thread Achim Zeileis
On Tue, 23 Dec 2008, Geraldine Henningsen wrote: Hello, I have interval censored data, censored between (0, 100). I used the tobit function in the AER package which in turn backs on survreg. Actually I'm struggling with the distribution. Data is asymmetrically distributed, so first choice would

[R] NetCDF within R: installation assistance

2008-12-23 Thread Ken Schmidt
Greetings. I am attempting to add NetCDF libraries within R, and have failed. We have R version 2.8, and are running on a 64-bit Redhat Linux 2.6.18 kernel: Red Hat Enterprise Linux Client release 5.2 (Tikanga) Linux halfmoon.ncdc.noaa.gov 2.6.18-92.1.22.el5 #1 SMP Fri Dec 5 09:28:22 EST 200

Re: [R] quotation problem/dataframe names as function input argument.

2008-12-23 Thread David Winsemius
I think you are making it too hard. See if one of these is a path to the answer you seek: > get(dframe.vec) V1 V2 1 1 2 # > n.obs <- function(x) dim(x) > n.obs(get(dframe.vec)) [1] 1 2 #--- > ng.obs <- function(x) dim(get(x)) > ng.obs(dframe.vec) [1] 1 2 #- > ng1.obs <- funct

Re: [R] "assign" statement in S-Plus

2008-12-23 Thread Greg Snow
If I remember correctly, frame 1 is the evaluation frame that comes into existence with each evaluation, then goes away at the end of the evaluation. The main use of it is to get past the fact that S-PLUS searches the current functions variables, but not the ones the current function is nested

[R] quotation problem/dataframe names as function input argument.

2008-12-23 Thread Sean Zhang
Dear R friends: Can someone help me with the following problem? Many thanks in advance. # Problem Description: # I want to write functions which take a (character) vector of dataframe names as input argument. # For example, I want to extract the number of observations from a number of dataframes.

Re: [R] "assign" statement in S-Plus

2008-12-23 Thread Douglas Bates
On Tue, Dec 23, 2008 at 1:38 PM, David Winsemius wrote: > On Dec 23, 2008, at 1:41 PM, kathie wrote: >> >> Dear R users... >> >> I need to change the S+ code below to R code. >> >> I am wondering if there is a R statement equivalent for "assign" statement >> in S-plus. >> > > ?assign # T

Re: [R] Ordered Multidimensional Arrays

2008-12-23 Thread Whit Armstrong
I take a similar approach by storing my vcv's in a list w/ the date stored as a character vector "%y-%m-%d" as the list names. That way you can easily grab the vcv you need by casting your date to a string and using it to index the list. not sure if that will work for you. hth, Whit On Tue, De

Re: [R] Ordered Multidimensional Arrays

2008-12-23 Thread Patrick Burns
The old fashioned solution is to have the N x N x T array and use character strings of the dates as the dimnames on the third dimension. Is there something you think you need to do that is hard with such a setup? Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com

Re: [R] "assign" statement in S-Plus

2008-12-23 Thread David Winsemius
On Dec 23, 2008, at 1:41 PM, kathie wrote: Dear R users... I need to change the S+ code below to R code. I am wondering if there is a R statement equivalent for "assign" statement in S-plus. ?assign # prime <- functi

Re: [R] Interval censored Data in survreg() with zero values!

2008-12-23 Thread Don MacQueen
Surv() allows left, right, or interval censoring. Try left censoring instead of interval censoring. For the weibull or lognormal, think of your data as <=100 instead of [0,100]. -Don At 8:08 PM +0100 12/23/08, Geraldine Henningsen wrote: Hello, I have interval censored data, censored betwee

Re: [R] Error: cannot allocate vector of size 1.8 Gb

2008-12-23 Thread iamsilvermember
>What are you going to do with an agglomerative hierarchical clustering of 22283 objects? It will not be interpretible. As a matter of fact I was ask to do a clustering analysis on gene expression. Something http://www.ncbi.nlm.nih.gov/projects/geo/gds/analyze/analyze.cgi?datadir=UCorrelationUP

[R] Interval censored Data in survreg() with zero values!

2008-12-23 Thread Geraldine Henningsen
Hello, I have interval censored data, censored between (0, 100). I used the tobit function in the AER package which in turn backs on survreg. Actually I'm struggling with the distribution. Data is asymmetrically distributed, so first choice would be a Weibull distribution. Unfortunately the Wei

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread David Winsemius
I have to agree with Daniel Nordlund regarding not creating subsidiary problems when the main problem has been cracked. Nonetheless, ... might you be happier with the result of changing the last data.frame() call in calcProfit to c()? I get a matrix: > str(Results2) num [1:14, 1:16] 3.00e

[R] Ordered Multidimensional Arrays

2008-12-23 Thread Derek Schaeffer
Hi, I am inquiring as to what are the best practices with respect to storing and manipulating ordered multi-dimensional arrays. For example, suppose I have a sequence of time-varying covariance matrices of asset returns. The data is ordered, but the ordering is not necessarily regular (e.g. daily

Re: [R] Approximate Entropy?

2008-12-23 Thread Ben Bolker
Stephan Kolassa wrote: > > Dear guRus, > > is there a package that calculates the Approximate Entropy (ApEn) of a > time series? > > RSiteSearch only gave me a similar question in 2004, which appears not > to have been answered: > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/28830.html >

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread Bert Gunter
FWIW: Good advice below! -- after all, the first rule of optimizing code is: Don't! For the record (yet again), the apply() family of functions (and their packaged derivatives, of course) are "merely" vary carefully written for() loops: their main advantage is in code readability, not in efficien

Re: [R] Approximate Entropy?

2008-12-23 Thread Stephan Kolassa
Ben, thanks a lot for that! I have a (reasonably) good idea about what ApEn should be, and I'll try to understand your translation of Kaplan's Matlab code. Best, Stephan Ben Bolker schrieb: Stephan Kolassa wrote: Dear guRus, is there a package that calculates the Approximate Entropy (A

[R] "assign" statement in S-Plus

2008-12-23 Thread kathie
Dear R users... I need to change the S+ code below to R code. I am wondering if there is a R statement equivalent for "assign" statement in S-plus. prime <- function(x) { 1*(abs(x) < chuber) } assign("prime",prime,frame=

Re: [R] aggregate / tranpose data

2008-12-23 Thread Henrique Dallazuanna
More simple: aggregate(x$ZIP_CODE, list(CODE_NAME = x$CODE_NAME), paste, collapse = ",") On Tue, Dec 23, 2008 at 3:27 PM, Henrique Dallazuanna wrote: > Try this: > > do.call(rbind, >lapply(split(x, x$CODE_NAME), > function(cod) >

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread Daniel Nordlund
Avoiding multiple nested for loops (as requested in the subject) is usually a good idea, especially if you can take advantage of vectorized functions. You were able redesign your code to use a single for loop. I presume there was a substantial improvement in program speed. How much additional tim

[R] source() argument specification in packages

2008-12-23 Thread Seeliger . Curt
Folks, I am creating a small package which builds just fine but fails the check during the installation phase, as it can not find the files I am source()ing: cannot open file 'c:\PROGRA~1\R\R-28~1.0\library\nla\nlamets.r': No such file or directory The path to the files are predicated on

Re: [R] aggregate / tranpose data

2008-12-23 Thread Henrique Dallazuanna
Try this: do.call(rbind, lapply(split(x, x$CODE_NAME), function(cod) data.frame(CODE_NAME = unique(cod$CODE_NAME), ZIP_CODE = paste(cod$ZIP_CODE, collapse = ","))

[R] aggregate / tranpose data

2008-12-23 Thread Ferry
Dear R-Users, Suppose I have data in the following format: CODE_NAME ZIP_CODE John 12345 John 23456 John 34567 Jane 13242 Jane 22123 I want to transpose / convert it into: CODE_NAME ZIP_CODE John

Re: [R] Tabular output: from R to Excel or HTML

2008-12-23 Thread Stavros Macrakis
David, Tobias, Thanks for your pointers to the various HTML and OpenOffice tools. I will look into them. odfWeave looks particularly promising since "OpenOffice can be used to export the document to MS Word, rich text format, HTML, plain text or pdf formats." It looks as though I have to learn

Re: [R] sorting regression coefficients by p-value

2008-12-23 Thread Sharma, Dhruv
thanks David. Dhruv -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Tue 12/23/2008 12:40 AM To: Sharma, Dhruv Cc: r-help@r-project.org Subject: Re: [R] sorting regression coefficients by p-value Assuming that you are using the example in the lm help page

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread Brigid Mooney
-- Problem Description: (reproducible code below)

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread David Winsemius
On Dec 23, 2008, at 10:56 AM, Brigid Mooney wrote: Thank you again for your help. snip - With the 'apply' call, Results2 is of class list. Results2 <- apply(CombParam, 1, calcProfit, X, Y) --

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Peter Dalgaard
Prof Brian Ripley wrote: A Date object is not a vector. In released versions of R, data.frame() only knows how to replicate vectors and factors. That's a rather oblique way of saying that it actually does work with the unreleased version: > head(transform(airquality,Date=as.Date("1950-01

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread Brigid Mooney
Thank you again for your help. I updated the parsing at the beginning of the calcProfit function with: if (class(IterParam) == "numeric") { long <- IterParam["long"] short <- IterParam["short"] investment <- IterParam["investment"] stoploss <- IterParam["

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Prof Brian Ripley
On Tue, 23 Dec 2008, Tom La Bone wrote: Gavin Simpson wrote: It says that the two arguments have different numbers of observations. The reason for which should now be pretty obvious as you provided a single Date whereas airquality has 153 observations. Thanks. I did look at ?transform b

[R] Comparing Data and Simulation

2008-12-23 Thread Koen van Rhee
Hello, I've got a function f(x) with this function. For x in -2 : 2 i've generated a vector y with function values. There is also a data set and I've constructed an estimator which should find values similar to y. My question is, what is the best way to compare these vectors? A simple exampl

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread David Winsemius
On Dec 23, 2008, at 9:55 AM, Brigid Mooney wrote: I have used some of your advice in making some changes to my function and function call before reposting. Instead of nesting many 'for' loops, I have gotten to the point where I only have one.(Also, please note, I am pasting the funct

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Tom La Bone
Gavin Simpson wrote: > > > It says that the two arguments have different numbers of observations. > The reason for which should now be pretty obvious as you provided a > single Date whereas airquality has 153 observations. > Thanks. I did look at ?transform but I was a bit confused because t

Re: [R] How can I avoid nested 'for' loops or quicken the process?

2008-12-23 Thread Brigid Mooney
I have used some of your advice in making some changes to my function and function call before reposting. Instead of nesting many 'for' loops, I have gotten to the point where I only have one.(Also, please note, I am pasting the function calcProfit at the end of this message as it is a bit lon

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread Frank E Harrell Jr
In addition to David's excellent response, I'll add that your problems seem to be statistical and not programming ones. I recommend that you spend a significant amount of time with a good regression text or course before using the software. Also, with Design you can find out the algebraic for

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Philipp Pagel
> I would like to add a column to the airquality dataset that contains the date > 1950-01-01 in each row. This method does not appear to work: > > > attach(airquality) > > data1 <- transform(airquality,Date=as.Date("1950-01-01")) > > Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L,

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Gabor Grothendieck
or not using transform at all: data1 <- airquality data1$Date <- as.Date("1950-01-01") # or in just one line: data1 <- replace(airquality, "Date", as.Date("1950-01-01")) On Tue, Dec 23, 2008 at 9:06 AM, Gavin Simpson wrote: > On Tue, 2008-12-23 at 05:24 -0800, Tom La Bone wrote: >> I would li

Re: [R] Using transform to add a date column to a dataframe

2008-12-23 Thread Gavin Simpson
On Tue, 2008-12-23 at 05:24 -0800, Tom La Bone wrote: > I would like to add a column to the airquality dataset that contains the date > 1950-01-01 in each row. This method does not appear to work: > > > attach(airquality) > > data1 <- transform(airquality,Date=as.Date("1950-01-01")) > > Error in

[R] Using transform to add a date column to a dataframe

2008-12-23 Thread Tom La Bone
I would like to add a column to the airquality dataset that contains the date 1950-01-01 in each row. This method does not appear to work: > attach(airquality) > data1 <- transform(airquality,Date=as.Date("1950-01-01")) Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L, 23L, 19L, :

Re: [R] newbie problem using Design.rcs

2008-12-23 Thread David Winsemius
On Dec 22, 2008, at 11:38 PM, sp wrote: Hi, I read data from a file. I'm trying to understand how to use Design.rcs by using simple test data first. I use 1000 integer values (1,...,1000) for x (the predictor) with some noise (x+.02*x) and I set the response variable y=x. Then, I try rcs

[R] Approximate Entropy?

2008-12-23 Thread Stephan Kolassa
Dear guRus, is there a package that calculates the Approximate Entropy (ApEn) of a time series? RSiteSearch only gave me a similar question in 2004, which appears not to have been answered: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/28830.html RSeek.org didn't yield any results at all.

[R] Borders for rectangles in lattice plot key

2008-12-23 Thread Richard . Cotton
Hopefully an easy question. When drawing a rectangles in a lattice plot key, how do you omit the black borders? Here is an example adapted from one on the xyplot help page: bar.cols <- c("red", "blue") key.list <- list( space="top", rectangles=list(col=bar.cols), text=list(c("foo", "ba

Re: [R] Error: cannot allocate vector of size 1.8 Gb

2008-12-23 Thread Prof Brian Ripley
On Mon, 22 Dec 2008, iamsilvermember wrote: dim(data) [1] 2228319 dm=dist(data, method = "euclidean", diag = FALSE, upper = FALSE, p = 2) Error: cannot allocate vector of size 1.8 Gb That would be an object of size 1.8Gb. See ?"Memory-limits" Hi Guys, thank you in advance for h

Re: [R] AR(2) coefficient interpretation

2008-12-23 Thread Prof Brian Ripley
You forgot to RTFM. From ?arima Different definitions of ARMA models have different signs for the AR and/or MA coefficients. The definition used here has 'X[t] = a[1]X[t-1] + ... + a[p]X[t-p] + e[t] + b[1]e[t-1] + ... + b[q]e[t-q]' and so the MA coefficients differ in sign