Re: [R] problem with NA and if

2008-07-03 Thread Andrew Robinson
Hi Keld you should read ?sum. sum(c(1,2,NA), na.rm=TRUE) Cheers Andrew On Fri, Jul 04, 2008 at 08:29:34AM +0200, Keld J?rn Simonsen wrote: > Hi > > I would like to sum a number of time series, some of them having NA's > > Standard action is here that if I sum a value with a NA, then the res

Re: [R] Recoding

2008-07-03 Thread Agustin Lobo
Thanks. This is a simple and efficient solution for the case in which the elements of the vector "values" are integers (which is often the case as in the example that came to my mind). Nevertheless, let me suggest having a more comprehensive function recode in base, as this is a very usual and we

[R] problem with NA and if

2008-07-03 Thread Keld Jørn Simonsen
Hi I would like to sum a number of time series, some of them having NA's Standard action is here that if I sum a value with a NA, then the result is NA. I would like it to just keep the value. I then try to: a = NA; if (a == NA) { a = 0} just to try it out, but it says Error in if (a == NA)

Re: [R] problem with lm and predict - no predictions made

2008-07-03 Thread Keld Jørn Simonsen
On Thu, Jul 03, 2008 at 12:47:26PM +0200, ONKELINX, Thierry wrote: > As long as you don't supply future values of usa.p to predict, it can't do > any predictions at all. Also note that lm probably doesn't takes the > timeseries info (the time part of it) into account. You're just regressing > us

Re: [R] by or tapply?

2008-07-03 Thread jim holtman
Is this close to what you want: > x E1 E2 E3 origin BASA 0 0 1 N BASO 0 0 1 N BRCO 0 0 1 U CAER 0 0 0 E CAGI 0 1 0 C CEFL 0 1 1 N > aggregate(x[,1:3], list(x[,4]), sum) Group.1 E1 E2 E3 1 C 0 1 0 2 E 0 0 0 3 N 0 1 3

[R] by or tapply?

2008-07-03 Thread Michael Denslow
Dear R-helpers, I have a data frame that is similar to the one below. The row names are species and the E1, E2, E3 columns are presence/absence for a given site. I have an additional column 'origin' which has information about the species. E1 E2 E3 origin BASA 0 0 1 N BASO 0 0 1

Re: [R] A regression problem using dummy variables

2008-07-03 Thread Ron Michael
"V&R's MASS book" can you give the full name of that book --- On Thu, 3/7/08, Bert Gunter <[EMAIL PROTECTED]> wrote: From: Bert Gunter <[EMAIL PROTECTED]> Subject: RE: [R] A regression problem using dummy variables To: [EMAIL PROTECTED] Cc: r-help@r-project.org Date: Thursday, 3 July, 2008, 9:21

Re: [R] apply with a division

2008-07-03 Thread Abhijit Dasgupta
Won't scale(x,center=F, scale=x[1,]) do the trick? -- Abhijit Quoting Gabor Grothendieck <[EMAIL PROTECTED]>: > This should work whether your data, x, is a data frame or a matrix: > > x / x[rep(1, nrow(x)),] > > > On Thu, Jul 3, 2008 at 6:04 PM, Greg Kettler <[EMAIL PROTECTED]> wrote: >> Hi, >

Re: [R] apply with a division

2008-07-03 Thread Gabor Grothendieck
This should work whether your data, x, is a data frame or a matrix: x / x[rep(1, nrow(x)),] On Thu, Jul 3, 2008 at 6:04 PM, Greg Kettler <[EMAIL PROTECTED]> wrote: > Hi, > I'd like to normalize a dataset by dividing each row by the first row. > Very simple, right? > I tried this: > >> expt.fluor

Re: [R] Tobit Estimation with Panel Data

2008-07-03 Thread Arne Henningsen
On Wednesday 02 July 2008 16:52:41 Arne Henningsen wrote: > Hi all! > > Do you know if there is any R function/package that can be used to > estimate "tobit" models with panel data (e.g. with random individual > effects)? > > In economics, a "tobit" model is a model with a dependent variable that i

Re: [R] apply with a division

2008-07-03 Thread Marc Schwartz
on 07/03/2008 05:04 PM Greg Kettler wrote: Hi, I'd like to normalize a dataset by dividing each row by the first row. Very simple, right? I tried this: expt.fluor X1 X2 X3 1 124 120 134 2 165 163 174 3 52 51 43 4 179 171 166 5 239 238 235 first.row <- expt.fluor[1,] normed <- apply(ex

Re: [R] 'as.Date' conversion of classes POSIX*t (problem/feature)?

2008-07-03 Thread Gabor Grothendieck
In the development version of R the output changes to: > x1 = as.POSIXlt("2008-01-02 00:58:00") > > x2 = as.POSIXct("2008-01-02 00:58:00") > > as.Date(x1); as.Date(x2) [1] "2008-01-02" [1] "2008-01-02" > > R.version.string [1] "R version 2.8.0 Under development (unstable) (2008-06-28 r46012)" O

Re: [R] Ternaryplot function

2008-07-03 Thread Rolf Turner
On 4/07/2008, at 10:49 AM, theBenjamin wrote: I am new to R, so this is most likely a dumb question. I just installed the vcb package, but when I try to use a function from it (ternaryplot) I get an error message saying 'could not find function: ternaryplot'. I'm pretty confident that

[R] 'as.Date' conversion of classes POSIX*t (problem/feature)?

2008-07-03 Thread Angel Spassov
Hi, I'm working with objects of classes "Date","POSIXlt" and "POSIXct" and still having some Date/Time-related concepts unclear. In the documentation of "as.Date" one can find: "The 'as.Date' methods accept ... '"POSIXlt"' and '"POSIXct"'. (The last are converted to days by ignoring the time afte

[R] Ternaryplot function

2008-07-03 Thread theBenjamin
I am new to R, so this is most likely a dumb question. I just installed the vcb package, but when I try to use a function from it (ternaryplot) I get an error message saying 'could not find function: ternaryplot'. I'm pretty confident that my script is correct, so I'm assuming that I did not pro

Re: [R] Exporting a Graph that has lines()

2008-07-03 Thread R_Learner
You guys are completely right...my lines were off the graph. I was also using points() in addition to lines, so it seems like it needs a pre-specified range unlike plot(). Thanks! Peter Dalgaard wrote: > > R_Learner wrote: >> I'm trying to export a graph (any form is good). I'm trying to expor

Re: [R] Installing R into home directory?

2008-07-03 Thread p_connolly
On Tue, 01-Jul-2008 at 09:46AM +0100, Steve Cadman wrote: |> I've been trying to install R into a user's home directory for them |> by compiling from source code, on a machine for which neither of us |> has administrative access. I've run configure using the --prefix |> option to specify their ho

Re: [R] First attempt to use R

2008-07-03 Thread Gabor Grothendieck
On Thu, Jul 3, 2008 at 5:09 PM, Ted <[EMAIL PROTECTED]> wrote: > While I am not a novice when it comes to statistics, this will be the first > time I have used R, apart from some intial play. I have normally written my > own code for statistical analysis in C++ or fortran, for a number of reasons

Re: [R] lines() warning message

2008-07-03 Thread Peter Dalgaard
Ranney, Steven wrote: Hmm. After checking my data, both the Spawner and Mtempcv columns are of equal lengths. While I could be wrong, recycling doesn't seem to be the issue. Notice that you have two "Spawner": One in the data, and one in newdata. These are probably not of the same length.

Re: [R] L1 nonlinear approximation

2008-07-03 Thread roger koenker
?nlrq in the quantreg package, for some values of the word "constrained" ... url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678

Re: [R] lines() warning message

2008-07-03 Thread Ranney, Steven
Hmm. After checking my data, both the Spawner and Mtempcv columns are of equal lengths. While I could be wrong, recycling doesn't seem to be the issue. As a relatively new user of R, I tried to adjust the newdata= issue by adding Mtempcv to the newdata= call (i.e., predict(mod2, list(Spawner

Re: [R] apply with a division

2008-07-03 Thread Henrique Dallazuanna
Try this: sweep(x, 2, as.numeric(x[1,]), FUN="/") On Thu, Jul 3, 2008 at 7:04 PM, Greg Kettler <[EMAIL PROTECTED]> wrote: > Hi, > I'd like to normalize a dataset by dividing each row by the first row. > Very simple, right? > I tried this: > > > expt.fluor > X1 X2 X3 > 1 124 120 134 > 2 165 16

[R] L1 nonlinear approximation

2008-07-03 Thread Tine Mlac
Hi! Does anyone knows a solver or R package for L1 nonlinear constrained approximation besides constrOptim or optim and Nelder-Mead method? Bye, Tine ps.: L1 means L1-norm => sum of absolute values. __ R-help@r-project.org mailing list https://st

Re: [R] First attempt to use R

2008-07-03 Thread Roland Rau
Hi Ted, hopefully the following information gets you started: Ted wrote: What I want to do is extract time series data from a database(say, PostgreSQL or MySQL - I routinely use both), analyse it, and put a selection of the statistical results into specific tables. Check the following docume

[R] apply with a division

2008-07-03 Thread Greg Kettler
Hi, I'd like to normalize a dataset by dividing each row by the first row. Very simple, right? I tried this: > expt.fluor X1 X2 X3 1 124 120 134 2 165 163 174 3 52 51 43 4 179 171 166 5 239 238 235 >first.row <- expt.fluor[1,] > normed <- apply(expt.fluor, 1, function(r) {r / first.row}) >

[R] For loop

2008-07-03 Thread laila khalfan
HiI have a specific sample coming from a gamma(alpha,theta1) distribution and then divided into two parts first part follows a gamma(alpha,theta1) the second is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and theta2 which I found. Now I would like to simulate those estimat

Re: [R] subset function within a function

2008-07-03 Thread Henrique Dallazuanna
I think that you can use split fot this, see ?split On Thu, Jul 3, 2008 at 6:25 PM, Lana Schaffer <[EMAIL PROTECTED]> wrote: > Hi, > I am using this subset statement and it works > outside a function. > LIS[[i]]<- lapply(LI, subset, select=cov[[i]]) > However, wrapped inside a function this stat

Re: [R] what can we do when R gives no response

2008-07-03 Thread Carl Witthoft
Have you tried running in debug mode? If there's a simple hang, or some internal loop is fouling up, it might show up in a hurry. Remember, once inside your script, to set debug for nlminb as well (two levels of debug) Carl __ R-help@r-project.o

Re: [R] Removing or overwriting an XML subtree

2008-07-03 Thread Steffen Neumann
Hi Martin, thanks for your reply, I'll give it a try. My current problem is to map my problem to your suggestion of modifying the tree *at parsing time*. (Of course) my problem is more complex than my first example, sorry for any confusion caused. The XML looks more like this: stuff

[R] subset function within a function

2008-07-03 Thread Lana Schaffer
Hi, I am using this subset statement and it works outside a function. LIS[[i]]<- lapply(LI, subset, select=cov[[i]]) However, wrapped inside a function this statement produces the same values for every LIS[[1]] which is only the first subset of LI. Does anyone know why is not working correctly ins

[R] First attempt to use R

2008-07-03 Thread Ted
While I am not a novice when it comes to statistics, this will be the first time I have used R, apart from some intial play. I have normally written my own code for statistical analysis in C++ or fortran, for a number of reasons (in part contingent on what the boss was willing to pay for), and

Re: [R] Installation of packages via GUI, Mac OS X

2008-07-03 Thread Don MacQueen
I'd suggest taking this question to the R-sig-mac mailing list (List-Subscribe: ,) and you will get asked for more information, including at least the output of sessionInfo(), and probably also the version number of t

Re: [R] lines() warning message

2008-07-03 Thread Peter Dalgaard
Ranney, Steven wrote: I have data that looks like Year,Recruit,Spawner,Mtempcv 1958,4532,775,0.24125 1959,22996,2310,0.16319 1960,628,2990,0.46056 1961,879,1400,0.33028 1962,14747,1130,0.22618 1963,13205,790,0.20596 1964,31793,1195,0.19229 1965,10621,981,0.20363 1966,22271,870,0.3452 1967,8736,1

Re: [R] Exporting a Graph that has lines()

2008-07-03 Thread Peter Dalgaard
R_Learner wrote: I'm trying to export a graph (any form is good). I'm trying to export one that uses plot() then lines(). however, it seems that the jpeg format and the pdf format only takes the first line plot, and doesn't even consider the additional plots. My code is the following: ou

Re: [R] Can't install package Matrix on solaris.

2008-07-03 Thread Martin Maechler
> "BDR" == Prof Brian Ripley <[EMAIL PROTECTED]> > on Thu, 3 Jul 2008 13:25:54 +0100 (BST) writes: BDR> You need to use BDR> 1) GNU make (see the DESCRIPTION file). BDR> 2) the compiler used to install R. Finding cc as /usr/ucb/cc indicates a BDR> likely path error:

[R] lines() warning message

2008-07-03 Thread Ranney, Steven
I have data that looks like Year,Recruit,Spawner,Mtempcv 1958,4532,775,0.24125 1959,22996,2310,0.16319 1960,628,2990,0.46056 1961,879,1400,0.33028 1962,14747,1130,0.22618 1963,13205,790,0.20596 1964,31793,1195,0.19229 1965,10621,981,0.20363 1966,22271,870,0.3452 1967,8736,1104,0.27511 1968,8761,88

[R] Installation of packages via GUI, Mac OS X

2008-07-03 Thread David Afshartous
All, I'm running R v2.7.1 on Mac OS X. When I go to the R package installer GUI, I am not prompted to select a repository. The usual screen is there but the columns for package, installed version, and repository version are all populated via blank entries. If I select "Get List" the error bel

Re: [R] as.Date() clarification

2008-07-03 Thread Martin Maechler
> "PD" == Peter Dalgaard <[EMAIL PROTECTED]> > on Thu, 03 Jul 2008 12:07:41 +0200 writes: [..] PD> and the help page has the explanation. [..] PD> [By the way, there used to be a way to see the current help pages on the PD> web, but I can't remember how.

Re: [R] Recoding a variable

2008-07-03 Thread Peter Dalgaard
John Fox wrote: Dear Spencer, In addition to the approaches already suggested, there is the recode() function in the car package. Or this way: levels(ftpain) <- list( none="none", intermediate=c("mild", "medium"), severe="severe") Or this (not quite as general): level

[R] Exporting a Graph that has lines()

2008-07-03 Thread R_Learner
I'm trying to export a graph (any form is good). I'm trying to export one that uses plot() then lines(). however, it seems that the jpeg format and the pdf format only takes the first line plot, and doesn't even consider the additional plots. My code is the following: output_file<-paste(f

Re: [R] Thanks!

2008-07-03 Thread R_Learner
Haha I'll definitely keep that in mind...parse does complicated things. Marc Schwartz wrote: > > on 07/03/2008 10:35 AM R_Learner wrote: >> Thanks guys! >> I think [[ seems to be the easier way, but I also spent an hour (while my >> post was pending approval) to find that the following also wor

Re: [R] Recoding a variable

2008-07-03 Thread John Fox
Dear Spencer, In addition to the approaches already suggested, there is the recode() function in the car package. Regards, John John Fox, Professor Department of Sociology McMaster University Hamilton ON Canada L8S 4M4 web: socserv.mcmaster.ca/jf

Re: [R] Re membering the last time an event occurred within a dataframe

2008-07-03 Thread Jim Price
Many thanks; using Gabor's advice I'd used: with(myData, rep(time, evid)[cumsum(evid)]) but yours also works a treat Henrique. Thanks once again! Jim. Henrique Dallazuanna wrote: > > If I understand, try this: > > with(myData, factor(cumsum(evid), labels = which(evid == 1))) > > > On Th

[R] FW: For loop

2008-07-03 Thread laila khalfan
HiI have a specific sample coming from a gamma(alpha,theta1) distribution and then divided into two parts first part follows a gamma(alpha,theta1) the second is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and theta2 which I found. Now I would like to simulate those es

Re: [R] Recoding a variable

2008-07-03 Thread Stephan Kolassa
internet.use[internet.use=="Never" | internet.use=="Don't know"] <- 0 internet.use[internet.use!=0] <- 1 HTH, Stephan Spencer schrieb: Hi All, I'm relatively new to R. I have a variable, "internet use," which ranges from "Almost everyday, "Several times a week," "Several times a month," "S

Re: [R] Recoding a variable

2008-07-03 Thread jim holtman
Here is an example of a way to do it: > x <- sample(LETTERS[1:5], 20, TRUE) > x [1] "D" "E" "A" "B" "A" "E" "A" "E" "A" "E" "C" "D" "A" "E" "D" "E" "A" "C" "B" "B" > # new vector with "D" and "E" = 0 > new.x <- ifelse((x == "D") | (x == "E"), 0, 1) > cbind(x,new.x) x new.x [1,] "D" "0"

Re: [R] Relative Mortality Risk second part

2008-07-03 Thread Marc Schwartz
on 07/03/2008 12:59 PM José Ignacio Bustos Melo wrote: Hi everyone, We are looking for some data sets working with relative risk mortality. so, someone know where can I find the data.mgus dataset and the data.mgus? Using 1384 records from Minnesota. This data set are used in the : Robert A. K

Re: [R] Sunset in Dortmund

2008-07-03 Thread Johannes Huesing
Marc Schwartz <[EMAIL PROTECTED]> [Thu, Jul 03, 2008 at 05:57:01PM CEST]: >> >> Lots of train fans would pay extra for a hotel with such a view > > At the peril of taking this thread further astray, I agree, having been > one in my youth growing up in and around New York City in the 60's and >

[R] Recoding a variable

2008-07-03 Thread Spencer
Hi All, I'm relatively new to R. I have a variable, "internet use," which ranges from "Almost everyday, "Several times a week," "Several times a month," "Seldom," "Never," and "Don't know." I want to recode this data into a new variable, say "use.internet," such that I have a dichotomous var

Re: [R] *** significance with xtable

2008-07-03 Thread Marc Schwartz
on 07/03/2008 07:41 AM Bunny, lautloscrew.com wrote: Hello everybody, i used xtable to get some latex output, which worked pretty well with my latex document. But somewhere i missed the part where they explain how to get these nice significance indicating *** into my latex table. it just sto

Re: [R] Re membering the last time an event occurred within a dataframe

2008-07-03 Thread Duncan Murdoch
On 7/3/2008 2:19 PM, Jim Price wrote: All, I am constructing a pharmacokinetic dataset and have hit a snag. The dataset can be demonstrated in the following way: myData <- data.frame( evid = c(1, 0, 0, 0, 1, 0, 1, 1, 1, 0), time = 1:10, last.dose.time = c(1, 1, 1, 1, 5, 5, 7, 8, 9

Re: [R] Re membering the last time an event occurred within a dataframe

2008-07-03 Thread Henrique Dallazuanna
If I understand, try this: with(myData, factor(cumsum(evid), labels = which(evid == 1))) On Thu, Jul 3, 2008 at 3:19 PM, Jim Price <[EMAIL PROTECTED]> wrote: > > All, > > I am constructing a pharmacokinetic dataset and have hit a snag. The > dataset > can be demonstrated in the following way: >

Re: [R] Re membering the last time an event occurred within a dataframe

2008-07-03 Thread Gabor Grothendieck
Try: cumsum(myData$evid) On Thu, Jul 3, 2008 at 2:19 PM, Jim Price <[EMAIL PROTECTED]> wrote: > > All, > > I am constructing a pharmacokinetic dataset and have hit a snag. The dataset > can be demonstrated in the following way: > > > > myData <- data.frame( >evid = c(1, 0, 0, 0, 1, 0, 1,

Re: [R] R-help Digest, Vol 65, Issue 4

2008-07-03 Thread José Ignacio Bustos Melo
Hi everyone, We are looking for some data sets working with relative risk mortality. so, someone know where can I find the data.mgus dataset and the data.mgus? Using 1384 records from Minnesota. This data set are used in the : Robert A. Kyle, Terry M. Therneau, S. Vincent Rajkumar, Janice R. Of

[R] Re membering the last time an event occurred within a dataframe

2008-07-03 Thread Jim Price
All, I am constructing a pharmacokinetic dataset and have hit a snag. The dataset can be demonstrated in the following way: myData <- data.frame( evid = c(1, 0, 0, 0, 1, 0, 1, 1, 1, 0), time = 1:10, last.dose.time = c(1, 1, 1, 1, 5, 5, 7, 8, 9, 9) ) The evid field is

Re: [R] R-help Digest, Vol 65, Issue 4

2008-07-03 Thread José Ignacio Bustos Melo
Hi everyone, We are looking for some data sets working with relative risk mortality. so, someone know where can I find the data.mgus dataset and the data.mgus? Using 1384 records from Minnesota. Thank! O__ José Bustos M. c/ /'_ --- Master Apllied Stat Program (*) \(*) -- University

Re: [R] graph woes

2008-07-03 Thread Gabor Grothendieck
On Thu, Jul 3, 2008 at 1:14 PM, Patrick Jackson <[EMAIL PROTECTED]> wrote: >>> 1. the tick marks are not where I want them to be. I want them at >>> .1, 1, 10, and 100, but I'm get them at 0.1, 0.5, 1.0, 5.0, 10.0, >>> 50.0, 100.0 axTicks does not do anything since that function simply computes

[R] Relative Mortality Risk second part

2008-07-03 Thread José Ignacio Bustos Melo
Hi everyone, We are looking for some data sets working with relative risk mortality. so, someone know where can I find the data.mgus dataset and the data.mgus? Using 1384 records from Minnesota. This data set are used in the : Robert A. Kyle, Terry M. Therneau, S. Vincent Rajkumar, Janice R. Of

[R] For loop

2008-07-03 Thread laila khalfan
Hi I have a specific sample coming from a gamma(alpha,theta1) distribution and then divided into two parts first part follows a gamma(alpha,theta1) the second is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and theta2 which I found. Now I would like to simulate those estima

[R] Random effects and lme4

2008-07-03 Thread wmh
I'm running some multi-level binomial models with lme4 and have a question regarding the estimated random effects. Suppose I have nested data e.g. clinic and then patient within clinic. The standard deviations of the random effects at each level are roughly equal in a model for real life data. At

[R] Biostatistician Positions at Vanderbilt University

2008-07-03 Thread Frank E Harrell Jr
We have openings for biostatisticians at all levels: B.S., M.S., Assistant Professor, Associate Professor, and full Professor. Details are at http://biostat.mc.vanderbilt.edu/JobOpenings -- Frank E Harrell Jr Professor and Chair School of Medicine Department of

[R] graph woes

2008-07-03 Thread Patrick Jackson
-- Forwarded message -- From: Patrick Jackson <[EMAIL PROTECTED]> Date: Thu, Jul 3, 2008 at 11:40 AM Subject: Re: [R] graph woes To: Bert Gunter <[EMAIL PROTECTED]> Well I will try my best. I can supply with with links to what I presently have and what I want. I also can send yo

Re: [R] Lattice: reasons for not passing subscripted "col", "pch", "lty", "fill" to panel functions

2008-07-03 Thread Deepayan Sarkar
On 7/3/08, Vitalie Spinu <[EMAIL PROTECTED]> wrote: > Dear UseRs! > > I am really amazed by lattice capabilities but one thing is really beyond > my understanding. > I would like to have conditional plots with points inside each panel > colored by groups "gr1" and "pched" by "gr2": > > xyplot(A~

Re: [R] Sunset in Dortmund

2008-07-03 Thread Uwe Ligges
Nice to see many people are already that enthusiastic to visit Dortmund and useR! 2008 in August. Unfortunately, I have all my Dortmund sunset pictures stored in my machine at home, hence no way to share. ;-) Best wishes, Uwe Marc Schwartz wrote: on 07/03/2008 09:21 AM John Kane wrote: --

Re: [R] Thanks!

2008-07-03 Thread Marc Schwartz
on 07/03/2008 10:35 AM R_Learner wrote: Thanks guys! I think [[ seems to be the easier way, but I also spent an hour (while my post was pending approval) to find that the following also works: temp<- eval(parse(text=paste("data$column_title""))) To quote Thomas: > fortune("parse()") If the a

Re: [R] position legend below x-axis title

2008-07-03 Thread Greg Snow
Look at ?grconvertY, you can use this to convert from 'ndc' (normalized device coordinates) where 0 is the bottom of the device (window/page/...) to user coordinates that can be used in legend or other functions. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermoun

Re: [R] Sunset in Dortmund

2008-07-03 Thread Marc Schwartz
on 07/03/2008 09:21 AM John Kane wrote: --- On Wed, 7/2/08, Marc Schwartz <[EMAIL PROTECTED]> wrote: From: Marc Schwartz <[EMAIL PROTECTED]> Subject: Re: [R] Sunset in Dortmund To: [EMAIL PROTECTED] Cc: r-help@r-project.org Received: Wednesday, July 2, 2008, 3:58 PM on 07/02/2008 02:37 PM Joh

Re: [R] Fitting a curve to data

2008-07-03 Thread Greg Snow
Does something like this do what you want: data(ethanol, package='lattice') fit1 <- loess(NOx ~ E, data=ethanol, span=.6) predfun <- function(x){ tmp.df <- data.frame(E=x) predict(fit1, tmp.df) } integrate(predfun, 0.6, 1.2) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Cent

[R] Reproducibility and GUIs

2008-07-03 Thread roger koenker
For a paper on "Reproducible Econometric Research," Achim Zeileis and I would be interested in hearing from anyone with (positive) experience and/or suggestions about GUI-based data analysis from a reproducibility perspective. We omitted coverage of this topic in an initial draft on th

Re: [R] A regression problem using dummy variables

2008-07-03 Thread rlearner309
sorry, made a stupid mistake. I got it. thanks a lot! Peter Dalgaard wrote: > > rlearner309 wrote: >> I think it is zero, because you have lots of zeros there. It is not like >> continous variables. >> >> > Think again. The sum of products may be zero, but that is not the > covariance. And

Re: [R] read.table, NA assignment, and sep

2008-07-03 Thread Peter Dalgaard
Juliet Hannah wrote: > I place the following data in a file > > id rs835 rs169 rs174 > 1001 CC GG CC > 10032 CC GG CC > 10066 CC NA CC > > If I read it in as > tempDat <- read.table("tempDat.txt",na.strings="NA",header=TRUE) > > I get the fo

[R] Thanks!

2008-07-03 Thread R_Learner
Thanks guys! I think [[ seems to be the easier way, but I also spent an hour (while my post was pending approval) to find that the following also works: temp<- eval(parse(text=paste("data$column_title""))) Marc Schwartz wrote: > > on 07/02/2008 02:10 PM R_Learner wrote: >> raw <- read.csv(file

Re: [R] How to emulate perl style of reading files ?

2008-07-03 Thread Prof Brian Ripley
You use connections -- see the 'R Data Import/Export Manual'. Something like con <- file("test1", "r") while(length(a <- readLines(con, 1))) print(a) close(con) On Thu, 3 Jul 2008, Daren Tan wrote: I tried the following, obviously it didn't work. Hope you get my point, how to do it in R ? My

Re: [R] Sunset in Dortmund

2008-07-03 Thread John Kane
--- On Wed, 7/2/08, Marc Schwartz <[EMAIL PROTECTED]> wrote: > From: Marc Schwartz <[EMAIL PROTECTED]> > Subject: Re: [R] Sunset in Dortmund > To: [EMAIL PROTECTED] > Cc: r-help@r-project.org > Received: Wednesday, July 2, 2008, 3:58 PM > on 07/02/2008 02:37 PM Johannes Huesing wrote: > > Marc

[R] read.table, NA assignment, and sep

2008-07-03 Thread Juliet Hannah
I place the following data in a file id rs835 rs169 rs174 1001 CC GG CC 10032CC GG CC 10066CC NA CC If I read it in as tempDat <- read.table("tempDat.txt",na.strings="NA",header=TRUE) I get the following. id rs835 rs169 rs174 1 1001C

Re: [R] ggplot2: scaling and tick mark of x-axis

2008-07-03 Thread hadley wickham
Hi Henning, > It works, however i am not satisfied with the output. I would like to have > the x-axis starting at "2006-08-01" and ending at "2007-08-31" with tick > marks and labels and each 1st of the months. Unfortunately this is a deficiency in the date scale - there's no way to manually set

Re: [R] A regression problem using dummy variables

2008-07-03 Thread Bert Gunter
Contrasts for categorical variables are a technical issue in linear models. They are best understood (imo) as the choice of bases for the vector space of the model matrix. So how good is your linear algebra? A terse but I think very clear treatment of these issues can be found in the relevant chapt

Re: [R] Data size

2008-07-03 Thread John Kane
I don't think anyone knows. I do not think that there is any absolute numbers. It is dependent upon your machine memory and the type of data that you are working with. If you give us some indication of the amount and type of data that you have someone may be able to comment. --- On Thu, 7/3

Re: [R] Usage of rJava (.jcall) with Weka functions, any example?

2008-07-03 Thread Dumblauskas, Jerry
I don't know what Rweka is, but to see what is available in a java class type .jmethods("weka/filters/unsupervised/attribute/Remove") It will give a list of methods you can call. Since you didn't make a "New" instance of this class, you only have access to static methods -- I downloaded this an

Re: [R] PCA on image data

2008-07-03 Thread Monica Pisica
Hi, You have the values of the principal component in "scores" (for each "location" where you have a RGB reading) and the eigenvectors in "loadings", see ?princomp So your first pca component would be: comp1 <- pca$scores[,1] Now you can transform this in the matrix you need to display your

Re: [R] How to emulate perl style of reading files ?

2008-07-03 Thread Duncan Murdoch
On 7/3/2008 9:35 AM, Daren Tan wrote: I tried the following, obviously it didn't work. Hope you get my point, how to do it in R ? My objective is to read a large fasta file (but not storing the entire data into memory) , and compute some sequence composition statistics. while(a <- readLines("te

Re: [R] PCA on image data

2008-07-03 Thread Bio7
Dear Jorge, i think it works. I have to investigate it further but have a visible result from your suggestion. Thank you very much for your help! With kind regards Marcel Austenfeld -- View this message in context: http://www.nabble.com/PCA-on-image-data-tp18255217p18259659.html Sent from the

[R] cross-validation in rpart

2008-07-03 Thread Sam Stewart
Hello list, I'm having a problem with custom functions in rpart, and before I tear my hair out trying to fix it, I want to make sure it's actually a problem. It seems that, when you write custom functions for rpart (init, split and eval) then rpart no longer cross-validates the resulting tree to

[R] ggplot2: scaling and tick mark of x-axis

2008-07-03 Thread Henning Wildhagen
Dear list, i am trying to plot data in a way like this: Date<-seq(as.Date("2006-08-29"), as.Date("2007-08-28"), by="2 weeks") var<-rnorm(27, 1, 2500) err<-rnorm(27, 3000, 1000) df<-data.frame(cbind(Date, var, err)) library(ggplot2) g <- ggplot(df, aes(x=Date, y=var, min=(var - err), max=(

[R] How to emulate perl style of reading files ?

2008-07-03 Thread Daren Tan
I tried the following, obviously it didn't work. Hope you get my point, how to do it in R ? My objective is to read a large fasta file (but not storing the entire data into memory) , and compute some sequence composition statistics. while(a <- readLines("test1") != EOF) print(a) _

Re: [R] auto.key in xyplot in conjunction with panel.text

2008-07-03 Thread David Afshartous
Thanks! That works perfect. On 7/2/08 6:45 PM, "Deepayan Sarkar" <[EMAIL PROTECTED]> wrote: > On 7/2/08, David Afshartous <[EMAIL PROTECTED]> wrote: >> >> >> All, >> >> I can't seem to get auto.key to work properly in an xyplot that is employing >> panel.text. Specifically, I often chan

Re: [R] combining time series [was: (no subject)]

2008-07-03 Thread Gabor Grothendieck
I had missed the second question. It can be handled by na.approx, see ?na.approx: > library(zoo) > z1 <- zoo(1:14, 1:14) > z2 <- zoo(c(12:16, 19:23), c(2:6, 9:13)) > > na.approx(merge(z1, z2)) z1 z2 2 2 12 3 3 13 4 4 14 5 5 15 6 6 16 7 7 17 8 8 18 9 9 19 10 10 20 11 11 21 12 12

Re: [R] ggplot2 legend for vertical lines

2008-07-03 Thread hadley wickham
Hi Baptiste, I've fixed this problem in the development version and you can work around it in the cran version as follows: ggplot(dfr, aes(fact2, values)) + geom_point(aes(colour = fact)) + geom_vline(intercept = 5) (i.e. make sure the vline never sees that colour has been mapped to an aesthetic

[R] Data size

2008-07-03 Thread arghya ganguli
Can somebody please let me know what is the maximum number of rows and columns that R can handle in a datafile? Thanks & Regards, Arghya Ganguli __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

Re: [R] How do I paste double quotes arround a character string?

2008-07-03 Thread Philip James Smith
R Community: At the risk of getting my hands slapped by posting "too much" on the forum, I've described the strategy for reading only certain portions of huge .csv files below. I think that this very well could be of interest to others... I'm sure that I'm not alone in the need to read only

[R] combining time series [was: (no subject)]

2008-07-03 Thread Gabor Grothendieck
Try merge.zoo in the zoo package (see ?zoo, ?merge.zoo and the 3 zoo vignettes): > library(zoo) > z1 <- zoo(1:7, 1:7) > z2 <- zoo(12:16, 2:6) > > merge(z1, z2) z1 z2 1 1 NA 2 2 12 3 3 13 4 4 14 5 5 15 6 6 16 7 7 NA Please include a subject when posting for sake of the archives. On Thu,

Re: [R] How do I paste double quotes arround a character string?

2008-07-03 Thread Prof Brian Ripley
On Thu, 3 Jul 2008, [EMAIL PROTECTED] wrote: I agree with Brian Ripley's suggestions unix.cmd<-paste( "cut -d -f" , col.pos , " " , fn , sep = '') gnu.dat <- read.csv(pipe(unix.cmd)) It is the same conclusion as I came to myself, after reading your "correction to small typo" message. In shor

Re: [R] PCA on image data

2008-07-03 Thread Jorge Ivan Velez
Dear Marcel, I'm sorry for the misunderstanding. I think what you really need are the scores values provided by PCA. See ?princomp for details. Here's an example: # PCA prin.comp=princomp(USArrests, cor = TRUE) summary(prin.comp) # What do you have in prin.comp? names(prin.comp) # Extracting th

Re: [R] How do I paste double quotes arround a character string?

2008-07-03 Thread Ted Harding
I agree with Brian Ripley's suggestions unix.cmd<-paste( "cut -d -f" , col.pos , " " , fn , sep = '') gnu.dat <- read.csv(pipe(unix.cmd)) It is the same conclusion as I came to myself, after reading your "correction to small typo" message. In short, no quotes are needed by the Unix shell in the

Re: [R] how to automatically maximize the graph window (under XP) ?

2008-07-03 Thread Prof Brian Ripley
The Windows screen device is called windows(), not x11() (which is an alias for a cut-down version that is no longer needed). It is not possible to open it to fill the screen -- there is a deliberate size limit of 85% of the screen size (see the help page). Nor is it possible to maximize it p

Re: [R] PCA on image data

2008-07-03 Thread Bio7
Dear Jorge, As i've already written the princomp method works for me. But i'm interested to produce from the results a matrix which i can visualize (e.g the first pc) in an image application and which is then the source for a clustering algorithm. The background is that i've an application which

[R] *** significance with xtable

2008-07-03 Thread Bunny, lautloscrew.com
Hello everybody, i used xtable to get some latex output, which worked pretty well with my latex document. But somewhere i missed the part where they explain how to get these nice significance indicating *** into my latex table. it just stops right after Pr(> |t|) thanks in advance matth

Re: [R] Prediction with Bayesian Network?

2008-07-03 Thread Marco Scutari
On Tue, Jul 1, 2008 at 6:54 PM, stephanos <[EMAIL PROTECTED]> wrote: > > Hi, > > I am interested in using a bayesian network as a predictor (machine > learning); however, I can't get any of the implementations (deal, nblearn) > to learn & predict stuff. > Shouldn't there also be probabilites for ea

Re: [R] problem with lm and predict - no predictions made

2008-07-03 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 03.07.2008 09:41:17: > On Wed, Jul 02, 2008 at 08:55:54PM -0500, Erik Iverson wrote: > > Hello - > > > > Keld Jørn Simonsen wrote: > > >Hi > > > > > >I have a problem with lm and predict > > > > > >I have > > > > > >us > > > [1] 2789.53 3128.43 3255.03 3536.

Re: [R] Tobit Estimation with Panel Data

2008-07-03 Thread Terry Therneau
Adding true random effects to survreg is certainly on my list of useful additions, but one with no start date in sight. That said, one can get an alternate solution with survreg(Surv(time, status) ~ x1 + x2 + frailty.gaussian(id, method='aic')) Justification: one can view a random effe

  1   2   >