Re: [R] question about the lattice package

2009-11-13 Thread RICHARD M. HEIBERGER
The first step is to make Weather a factor. Then the levels would be displayed in the strip labels. The second step would be to change the level values to the actual strings you want to see. > tmp <- data.frame(Weather=1:3, x=rnorm(3), y=rnorm(3)) > xyplot(y ~ x | Weather, data=tmp) > tmp$Weathe

Re: [R] R and HDF5 Question

2009-11-13 Thread Berwin A Turlach
G'day Scott, On Fri, 13 Nov 2009 09:52:43 -0700 Scott MacDonald wrote: > I am trying to load an hdf5 file into R and running into some > problems. It's a while that I used hdf5 files and that package in R, but: > This builds fine. The library seems to load without issue, but no > data is retu

Re: [R] Silently loading an R package.

2009-11-13 Thread Yihui Xie
please read the 'Details' section of ?require To suppress messages during the loading of packages use 'suppressPackageStartupMessages': this will suppress all messages from R itself but not necessarily all those from package authors. Regards, Yihui -- Yihui Xie Phone: 515-294-6609

[R] Silently loading an R package.

2009-11-13 Thread Guillaume Yziquel
Hello. I've been working an a binding between OCaml and R (i.e. calling R from OCaml, mostly). See below for a taste of it. I'm currently wondering how to load a given R package silently. I tried require(xts, quietly = TRUE) but I still get some ugly output. Is it possible to squeeze

Re: [R] Licensing data sets

2009-11-13 Thread Deepayan Sarkar
On Fri, Nov 13, 2009 at 8:05 PM, Christian Lederer wrote: > Hi, > > i am working on a biosignal package which has a data set package > as dependency (e.g. for the examples). > This data set package will include patient data. > Of course, the patients will be asked for their informed > consent, and

Re: [R] All combination

2009-11-13 Thread David Winsemius
Besides the much more compact and probably more efficient approach of using permutation, here is another method: expand.grid(rep(list(c(1:3)), 3))[ lapply( apply( expand.grid(rep(list(c(1:3)), 3)), 1, unique), length) ==3 , ] On Nov 13, 2009, at 4:02 A

[R] Licensing data sets

2009-11-13 Thread Christian Lederer
Hi, i am working on a biosignal package which has a data set package as dependency (e.g. for the examples). This data set package will include patient data. Of course, the patients will be asked for their informed consent, and the data will be anonymized. I am not sure about the appropriate licen

Re: [R] help sample from large dataset - misleading error?

2009-11-13 Thread Jorge Ivan Velez
Thank you David for the clarification. You are absolutely right. Best, Jorge On Fri, Nov 13, 2009 at 9:30 PM, David Winsemius <> wrote: > > On Nov 13, 2009, at 7:46 PM, Jorge Ivan Velez wrote: > > Hi Rachel, >> >> Here is a suggestion: >> >> index <- sample(100) >> mysample <- gly[index, ] >>

Re: [R] Step Function Freezing R

2009-11-13 Thread J Dougherty
On Friday 13 November 2009 07:17:28 am Jgabriel wrote: > I can't fully answer all these questions, but I'll do my best - There > have not been any updates of Windows, and I did not update R during > the period, although I did reinstall it after the problem started. > There have been no changes to N

[R] Detecting invalid time zone names

2009-11-13 Thread Christian Lederer
Hi folks, i have to deal with data sets, which have a column with UTC seconds and a second column containing the timezone. However this timezone is not always valid in R, e.g. misspelled. Unfortunately, the date/time functions like ISOdatetime or as.POSIXlt silently accept invalid timezone argumen

Re: [R] vignettes: .png graphics or pre-compiled .pdf

2009-11-13 Thread Yihui Xie
I was reminded that the attachments were blocked by the list, so I send these links again: http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.Rnw http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.r http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.pdf Regards, Yihui -- Yihui Xie

Re: [R] refactoring in R

2009-11-13 Thread Peng Yu
I found the examples of how to change the code for each refactoring activity. Are there tools that can help automate this process? On Fri, Nov 13, 2009 at 9:16 PM, milton ruser wrote: > Hi Peng, > > If that information is preliminary, so I guess you > have a more clear problem and may be you are

Re: [R] refactoring in R

2009-11-13 Thread milton ruser
Hi Peng, If that information is preliminary, so I guess you have a more clear problem and may be you are able to state a minimally reproducible code/example with what you really need. Bests milton On Fri, Nov 13, 2009 at 9:30 PM, Peng Yu wrote: > I'm wondering if there are some tips for ref

Re: [R] shrink list by mathed entries

2009-11-13 Thread David Winsemius
On Nov 13, 2009, at 11:19 AM, soeren.vo...@eawag.ch wrote: Hello a <- c("Mama", "Papa", "Papa; Mama", "", "Sammy; Mama; Papa") a <- strsplit(a, "; ") mama <- rep(F, length(a)) mama[sapply(a, function(x) { sum(x=="Mama") }, simplify=T) > 0] <- T papa <- rep(F, length(a)) papa[sapply(a, function

Re: [R] replace a whole word with sub()

2009-11-13 Thread Patrick Connolly
On Fri, 13-Nov-2009 at 03:13PM +, Giulio Di Giovanni wrote: |> |> |> |> Dear all, |> |> |> |> I cannot figure out how to solve a small problem (well, not for me), surely somebody can help me in few seconds. |> |> |> |> I have a series of strings in a vector X of the type "xxx",

Re: [R] vignettes: .png graphics or pre-compiled .pdf

2009-11-13 Thread Yihui Xie
Hi Michael, I have a dirty solution as attached to use png() for Sweave. HTH. Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA On Fri, Nov 13, 2009 at 10:02 AM, Michael Friendly wrote: > In a p

Re: [R] help sample from large dataset - misleading error?

2009-11-13 Thread David Winsemius
On Nov 13, 2009, at 7:46 PM, Jorge Ivan Velez wrote: Hi Rachel, Here is a suggestion: index <- sample(100) mysample <- gly[index, ] mysample I doubt that was what he was hoping to get (which would be a permutation of 1:100 rather than a subsample). try: samp <- gly[ sample(nrow(gly), 1

[R] refactoring in R

2009-11-13 Thread Peng Yu
I'm wondering if there are some tips for refactoring in R. I found the following website, which is still preliminary. Is there any program that can help me do refactoring in R? http://www.r-developer.org/projects/show/refactoring __ R-help@r-project.org

Re: [R] cleanse columns and unwanted rows

2009-11-13 Thread David Winsemius
On Nov 13, 2009, at 2:32 PM, frenchcr wrote: hello folks, Im trying to clean out a large file with data i dont need. The column im manipulating in the file is called "legal status" Their are three kinds of rows i want to remove. Those that have "Private", "Private (Op", or "Unknown" in the l

Re: [R] need help formating plot axis to standard dollar formats

2009-11-13 Thread David Winsemius
?sprintf ?format # or the function format passes arguments to: ?formatC library(ggplot2) ?comma -- David On Nov 13, 2009, at 5:00 PM, Anderson, Chris wrote: I create a lot of plots with a dollar amount as the y-axis. How do I change the formatting so comma and $ are in place. Like $1000,0

Re: [R] help sample from large dataset - misleading error?

2009-11-13 Thread Jorge Ivan Velez
Hi Rachel, Here is a suggestion: index <- sample(100) mysample <- gly[index, ] mysample See ?sample for more information. HTH, Jorge On Fri, Nov 13, 2009 at 5:20 PM, Hayes, Rachel M <> wrote: > Hi All, > > > > I want to take a simple random sample from a large dataset, gly, but I'm > getting

Re: [R] spss imports--trouble with to.data.frame

2009-11-13 Thread Peter Ehlers
I can't really help you with your problem, but maybe importing with use.value.labels=FALSE will at least get rid of the 'duplicated levels' warnings. -Peter Ehlers Paul Johnson wrote: My students are working with several SPSS dataset provided by the European Social Survey. If you register your

Re: [R] cleanse columns and unwanted rows

2009-11-13 Thread rmailbox
?subset - Original message - From: "frenchcr" To: r-help@r-project.org Date: Fri, 13 Nov 2009 11:32:35 -0800 (PST) Subject: [R] cleanse columns and unwanted rows hello folks, Im trying to clean out a large file with data i dont need. The column im manipulating in the file is called

Re: [R] Change working directory

2009-11-13 Thread Don MacQueen
In R for Macintosh, there is a Preferences setting that will do this. You can also drag and drop a file onto the R icon and I believe it will change the working directory to the directory that contains the file. On unix-like systems, using the command line, it's whatever directory you start R

Re: [R] Step Function Freezing R

2009-11-13 Thread Jgabriel
Alright, here's the update: the IT guy insists that the RAM is not the problem. RAM, according to him, is "pretty black and white". There should be enough RAM on the system for the function to work, and he was the one who installed the extra RAM in the first place. Could there be another RAM issue

Re: [R] vector based command for equal values - if too slow

2009-11-13 Thread jorgusch
Hi, splitting is a good idea..it kills a loop...I keep forgetting this. I have to try out a bit, whether it covers it all, I'll let you know but thanks for a start. It is not really analysing, but exploring the data. I have some plots with sevendigits points and some things are weird and I try t

[R] cleanse columns and unwanted rows

2009-11-13 Thread frenchcr
hello folks, Im trying to clean out a large file with data i dont need. The column im manipulating in the file is called "legal status" Their are three kinds of rows i want to remove. Those that have "Private", "Private (Op", or "Unknown" in the legal_status column. I wrote this code but it sy

Re: [R] Non linear programming optimization (which package to use?)

2009-11-13 Thread Erwin Kalvelagen
Jerome Chong gmail.com> writes: > > Greetings, > > What I want to do is to perform regression the data set to get a > revenue function, and use that revenue function to find the maximum > point (maybe with some constraints applied). > The regressed revenue function would most likely be in a qua

[R] standardised effect sizes and confidence intervals for mixed-models

2009-11-13 Thread Weber, Sam
Hello everyone, I was wondering if anyone knows of an R package which will extract the standardised effect size (r) and 95% confidence intervals for a single continuous predictor in a mixed-effects model. For example, I have model<-lme(damage~car+depth+wet,random=~1|id,data=data) I need to fin

[R] about the pgmm in plm package (application and singularity)

2009-11-13 Thread S LIAO
Dear Sir or Madam: I am Shaojuan Liao, the 3rd year Ph.D. student from Econ Department, Virginia Tech. I don't know whether it is appropriate to ask you questions on the command pgmm. But I don't know how to deal with the case where all X are exogenous and all T time periods' X can be used a

[R] need help formating plot axis to standard dollar formats

2009-11-13 Thread Anderson, Chris
I create a lot of plots with a dollar amount as the y-axis. How do I change the formatting so comma and $ are in place. Like $1000,000 or to use common dollar abbreviations like 100K? Chris Anderson Data Analyst Medical Affairs wk: 925-677-4870 cell: 707-315-8486 Fax:925-677-4670 This elect

Re: [R] Problem plotting output from tree()

2009-11-13 Thread Ian Robertson
Prof. Ripley kindly pointed out to me that the "digits" parameter in text.tree() is intended to work on numeric labels. The values that I wanted to modify are not labels (at least not the ones so controlled), nor are they numeric. I have since figured out how to do what I want. The values I wa

[R] Analyze XML data

2009-11-13 Thread skyjo
I would like to analyze XML data from MLB's website. I do the following steps: library(XML) dat<-"http://gd2.mlb.com/components/game/mlb/year_2007/month_05/day_02/gid_2007_05_02_arimlb_lanmlb_1/inning/inning_1.xml"; example<- xmlTreeParse(dat, useInternalNodes=T) ex<-xpathApply(example, "//inning

[R] AR(2) modelling

2009-11-13 Thread Christophe Dutang
Hi useRs, I'm trying to fit a basic AR(2) model with the 'ar' function. And when I try to check the value of the coefficients, I could not find the same value as the 'ar' function. Here is my example: myserie <- c(212, 205, 210, 213, 217, 222, 216, 218, 220, 212, 215, 236) #plot(myserie, t

Re: [R] help sample from large dataset - misleading error?

2009-11-13 Thread Peter Ehlers
Rachel, The first thing to do when a function gives you trouble is to look at its help page. In the case of sample(), you will find that it requires a *vector* input. Is your gly a vector? -Peter Ehlers Hayes, Rachel M wrote: Hi All, I want to take a simple random sample from a large dat

[R] spss imports--trouble with to.data.frame

2009-11-13 Thread Paul Johnson
My students are working with several SPSS dataset provided by the European Social Survey. If you register your name, you can download it too. This is the 2004 data, for example: http://ess.nsd.uib.no/ess/round2/ I cannot give you the European Survey dataset, but you can download it for free if yo

[R] help sample from large dataset - misleading error?

2009-11-13 Thread Hayes, Rachel M
Hi All, I want to take a simple random sample from a large dataset, gly, but I'm getting an error message. Any help? dim(gly) [1] 112371 37 > s1 <- sample(gly,100) Error in `[.data.frame`(x, .Internal(sample(length(x), size, replace, : cannot take a sample larger than the popul

[R] Aov: SE's for split plot

2009-11-13 Thread Prew, Paul
Hello, Can anyone explain why the following message appears for the function model.tables, where se=T? In the V&R MASS text, p.285 the se=T option works for a split plot example that seems similar to my operation. But the model.tables documentation, in the Arguments section for "se", states

[R] Problem plotting output from tree()

2009-11-13 Thread Ian Robertson
I am using tree() in some classification work, and have been trying to suppress the number of significant digits shown in the output plot. There is a "digits" parameter that can be used in text.tree(), but I can't seem to make it have any effect. Here is some example code to illustrate what I m

Re: [R] Simple if else statement problem

2009-11-13 Thread anna_l
ok thanks guys for the help, indeed I assumed there was an explanation thank you duncan for giving it! -- View this message in context: http://old.nabble.com/Simple-if-else-statement-problem-tp26340336p26343665.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] when use which()

2009-11-13 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of > soeren.vo...@eawag.ch > Sent: Friday, November 13, 2009 12:24 PM > To: r-help@r-project.org > Subject: [R] when use which() > > Hello: > > # some code to assign with and wit

Re: [R] naive "collinear" weighted linear regression

2009-11-13 Thread tlumley
On Wed, 11 Nov 2009, David Winsemius wrote: On Nov 11, 2009, at 7:45 PM, Mauricio Calvao wrote: When I try: fit_mod <- lm(y~x,weights=1/error^2) I get Warning message: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : extra arguments weigths are just disregarded. (Ac

[R] when use which()

2009-11-13 Thread soeren . vogel
Hello: # some code to assign with and without "which" q <- 1:20; q[c(9, 12, 14)] <- NA r <- 1:20; r[c(8:9, 12:15)] <- NA s <- 1:20; s[c(8:9, 12:15)] <- NA r[q < 16] <- 0 s[which(q < 16)] <- 0 r;s # both: 0 0 0 0 0 0 0 0 NA 0 0 NA 0 NA 0 16 17 18 19 20 r <- 1:20; r[c(8:9, 12:15)] <- NA

Re: [R] LINEAR MIXED EFFECT

2009-11-13 Thread tlumley
On Fri, 13 Nov 2009, milton ruser wrote: Hi Ana, you did again :-) require(fortunes) fortune("dog") Firstly, don't call your matrix 'matrix'. Would you call your dog 'dog'? Anyway, it might clash with the function 'matrix'. -- Barry Rowlingson R-help (October 2004) if you call your dat

Re: [R] LINEAR MIXED EFFECT

2009-11-13 Thread milton ruser
Hi Ana, you did again :-) > require(fortunes) > fortune("dog") Firstly, don't call your matrix 'matrix'. Would you call your dog 'dog'? Anyway, it might clash with the function 'matrix'. -- Barry Rowlingson R-help (October 2004) if you call your data "data" you will crach data() function.

Re: [R] Simple if else statement problem

2009-11-13 Thread Peter Ehlers
anna_l wrote: Ok Jim it worked, thank you! it´s funny because it worked with the first syntax in some cases... No, it did not. R doesn't randomly work in different ways on different days. -Peter Ehlers anna_l wrote: Hello, I am getting an error with the following code: if( P2 > P1) + {

Re: [R] Utility function to rotate log files?

2009-11-13 Thread Henrique Dallazuanna
You can try something about like this: foo <- function() { unlink("file3.txt") file.rename("file2.txt", "file3.txt") file.rename("file1.txt", "file2.txt") sink("file1.txt") cat("test file1") sink() } On Fri, Nov 13, 2009 at 5:20 PM, Don MacQueen

[R] Utility function to rotate log files?

2009-11-13 Thread Don MacQueen
I am wondering if there is a CRAN package that includes a utility function that will "rotate" file names, in the same sense that operating systems sometimes rotate log files. Or maybe there's something in base R. That is, we have a set of file names, say file1, file2, file3, and when the func

Re: [R] How to quit unwanted execution immediately?

2009-11-13 Thread Uwe Ligges
[Going through some old and from what I see unanswered messages] R can or cannot response immediately depending on the underlying C sources. If the underlying source code is written carefully enough, there are more or less regular checks for events such as this one. If you are using some contri

Re: [R] sum(row1==y) if row2=x

2009-11-13 Thread Jorge Ivan Velez
Hi Knut, Try sum(subset(df, row1 == 3 & row2 == 2)[,1]) and nrow(subset( df, row1 == 3 & row2 == 2) ) HTH, Jorge On Fri, Nov 13, 2009 at 1:59 PM, Knut Krueger <> wrote: > Hi to all > is there any construct to sum > data=data.frame(row1=c(1,1,3,1,2,3,2,2,1,3,4,5,2,3,2,1) , >

Re: [R] sum(row1==y) if row2=x

2009-11-13 Thread Henrique Dallazuanna
Try this: sum(data[with(data, row1 == 3 & row2 == 2),1]) and sum(with(data, row1 == 3 & row2 == 2)) On Fri, Nov 13, 2009 at 4:59 PM, Knut Krueger wrote: > Hi to all > is there any construct to sum > data=data.frame(row1=c(1,1,3,1,2,3,2,2,1,3,4,5,2,3,2,1) , >                         row2=c(2,2

Re: [R] Escaping regular expressions

2009-11-13 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Hadley Wickham > Sent: Friday, November 13, 2009 5:34 AM > To: r-help > Subject: [R] Escaping regular expressions > > Hi all, > > Is there a method for escaping strings to be us

Re: [R] 'R CMD check' fails with "evaluation nested too deeply: infinite recursion"

2009-11-13 Thread Uwe Ligges
[Going through some old and from what I see unanswered messages No, you cannot have a cycle in Imports / Depends / LinkingTo otherwise you will run into an "the chicken or the egg" problem: That declaration means that the other packages must be loadable on installation, for example. You can tr

[R] sum(row1==y) if row2=x

2009-11-13 Thread Knut Krueger
Hi to all is there any construct to sum data=data.frame(row1=c(1,1,3,1,2,3,2,2,1,3,4,5,2,3,2,1) , row2=c(2,2,1,1,1,2,1,2,1,1,1,1,2,2,2,1) ) Means I would like to get all y of row1 if in row2 of the data.frame is an x f.e row1=3 and row2=2 so I would like to get 6 And is

Re: [R] change in default behavior of ?functionname in R 2.10?

2009-11-13 Thread Uwe Ligges
[Going through some old and from what I see unanswered messages This was a bug in the installer that nobody reported during the test phases (alpha / beta / release candidate). So please try out new R releases in order to help finding such bugs before release. The installer cannot be tested ea

Re: [R] roc plot with zero length labels error

2009-11-13 Thread Uwe Ligges
[Going through some old and from what I see unanswered messages Hard to tell what is going on without telling us the data. Works with the examples, so may be related to one of the objects scicomp5.model1, pred, T, or auc. > PLEASE do read the posting guide http://www.R-project.org/posting-g

[R] multivariate meta-analysis with the metafor package

2009-11-13 Thread Antonio.Gasparrini
Dear Wolfgang Viechtbauer and R users, I have few questions regarding the development of the package 'metafor. As you suggested , I post to the R-help mailing list. I read you're planning an extension of this method to the multivariate case. I think it would be a useful tool. I'm currently perf

Re: [R] random numbers in C

2009-11-13 Thread Duncan Murdoch
On 11/13/2009 11:41 AM, Thomas Unternaehrer wrote: I need some random numbers in my C program. Here a small example: #include void rand (int* n) { int len = *n; for (int i = 0; i < len; i++) Rprintf("%1.5f

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

2009-11-13 Thread Uwe Ligges
[Going through some old and from what I see unanswered messages See Writing R Extensions: The contents of subdirectory ./inst will be copied to top level during package installation (i.e. also for making binary packages). Best wishes, Uwe Ligges morp...@comcast.net wrote: My OS is Windows

Re: [R] Simple if else statement problem

2009-11-13 Thread Duncan Murdoch
On 11/13/2009 12:54 PM, anna_l wrote: Ok Jim it worked, thank you! it´s funny because it worked with the first syntax in some cases... If R knows the whole thing is incomplete, it will accept an else on its own line. If the first 4 lines make a complete statement, R will evaluate it, and not

Re: [R] linear model and by()

2009-11-13 Thread Ista Zahn
On Fri, Nov 13, 2009 at 11:49 AM, Sam Albers wrote: > No problem not use my data. For future reference, would it have been easier > to attach a .csv file and then include the appropriate read.csv command? I > realized that the easier one makes it to help, the easier it is to get a > response. > >

Re: [R] random numbers in C

2009-11-13 Thread Thomas Unternaehrer
Ups... I've overlooked that part. Thanks a lot for the fast response! On Fri, Nov 13, 2009 at 6:05 PM, Duncan Murdoch wrote: > On 11/13/2009 11:41 AM, Thomas Unternaehrer wrote: > >> I need some random numbers in my C program. Here a small example: >> >> >> //

Re: [R] why the same values cannot be judged to be the same in R

2009-11-13 Thread rusers.sh
Thanks all. "%in%" is what i need. 2009/11/13 jim holtman > I think you want to use '%in%' instead of '=='. Try debugging (or > understanding) what is happening by evaluating the subexpressions of > the compares you have in your original posting. Also take a look at > the 'recycling' of argum

Re: [R] package "tm" fails to remove "the" with remove stopwords

2009-11-13 Thread Sam Thomas
Mark, It looks like removeWords removed "the" in all instances except when "the" was the first word in your text. Maybe there is a parameter that needs to be set? I couldn't find anything on the help page. Here's an example of what I am seeing using the "crude" dataset #function re

Re: [R] Step Function Freezing R

2009-11-13 Thread Uwe Ligges
Jgabriel wrote: I can't fully answer all these questions, but I'll do my best - There have not been any updates of Windows, and I did not update R during the period, although I did reinstall it after the problem started. There have been no changes to Norton or any other software that uses syste

Re: [R] processing log file

2009-11-13 Thread Henrique Dallazuanna
You can use aggregate to get this too: aggregate(table.users[,c('UserName', 'Machine')], table.users['Date'], function(x)length(unique(x))) On Fri, Nov 13, 2009 at 3:01 PM, Jabez Wilson wrote: > Thanks, that's helpful because I can see the individuals and how many times > they accessed: > The '

Re: [R] Simple if else statement problem

2009-11-13 Thread anna_l
Ok Jim it worked, thank you! it´s funny because it worked with the first syntax in some cases... anna_l wrote: > > Hello, I am getting an error with the following code: > if( P2 > P1) > + { > + P<-P2 > + } >> else > Erro: unexpected 'else' in "else" >> { > + P<-P1 > + } > > I checked the synta

Re: [R] Trellis settings get lost when printing to pdf

2009-11-13 Thread Sundar Dorai-Raj
Did you make the changes before or after starting the device: library(lattice) ## before doesn't change the settings on the device: trellis.par.set(plot.symbol = list(col = "red")) trellis.device(pdf, file = "tmp.pdf") xyplot(1 ~ 1) dev.off() ## after does trellis.device(pdf, file = "tmp.pdf") tr

Re: [R] Simple if else statement problem

2009-11-13 Thread Jim Burke
Anna, I think the else needs to be on the same line as the curly bracket like this "} else". P1 <- 1 P2 <- 2 if( P2 > P1) { P<-P2 } else { P<-P1 } Good luck, Jim anna_l wrote: Hello, I am getting an error with the following code: if( P2 > P1) + { + P<-P2 + } else Erro: unexpe

Re: [R] Simple if else statement problem

2009-11-13 Thread Benilton Carvalho
align the else with the curly brackets if (yes){ be happy }else{ complain } b On Nov 13, 2009, at 3:33 PM, anna_l wrote: Hello, I am getting an error with the following code: if( P2 > P1) + { + P<-P2 + } else Erro: unexpected 'else' in "else" { + P<-P1 + } I checked the syntax so I don´

[R] Trellis settings get lost when printing to pdf

2009-11-13 Thread Joel Fürstenberg-Hägg
Hi all, I've got some problems when changing the trellis settings for the lattice plots. The plots look exactly as I want them to when calling show.settings() as well as when plotting them in the graphical window. But when printing to a pdf file, none of the settings are used!? Does anyone

[R] Simple if else statement problem

2009-11-13 Thread anna_l
Hello, I am getting an error with the following code: if( P2 > P1) + { + P<-P2 + } > else Erro: unexpected 'else' in "else" > { + P<-P1 + } I checked the syntax so I don´t understand, I have other if else statements with the same syntax working. Thanks in advance -- View this message in context:

[R] R installation on UNIX machine

2009-11-13 Thread Powers, Randall - BLS
Hello All, I have downloaded and untarred R 2.10.0 onto my SUN UNIX machine. When I run ./configure, it runs through a series of questions and stops at this (and I get this when I try the make command): checking for iconv.h... yes checking for iconv... in libiconv checking whether iconv accept

Re: [R] Step Function Freezing R

2009-11-13 Thread Jgabriel
I can't fully answer all these questions, but I'll do my best - There have not been any updates of Windows, and I did not update R during the period, although I did reinstall it after the problem started. There have been no changes to Norton or any other software that uses system resources in that

Re: [R] processing log file

2009-11-13 Thread Jabez Wilson
Thanks, that's helpful because I can see the individuals and how many times they accessed: The 'plyr' solution of Karl Ove Hufthammer gives me the exact summary statistics that I'm looking for.   Jab --- On Fri, 13/11/09, markle...@verizon.net wrote: From: markle...@verizon.net Subject: Re:

[R] R and HDF5 Question

2009-11-13 Thread Scott MacDonald
Hello All, I just signed up to this list, so I apologize if this question has been asked before. I am trying to load an hdf5 file into R and running into some problems. Here are the steps I took to configure my environment: * R 2.10.0 (x64) on Mac OS X 10.6 * hdf5 1.8.3 installed via mac

Re: [R] linear model and by()

2009-11-13 Thread Sam Albers
> Hello R list, >> >> This is a question for anyone who has used the by() command. I would like >> to >> perform a regression on a data frame by several factors. Using by() I >> think >> that I have able to perform this using the following: >> >> lm.r <- by(master, list(Sectionf=Sectionf, startd=s

Re: [R] package "tm" fails to remove "the" with remove stopwords

2009-11-13 Thread Mark Kimpel
Sam, Thanks for the example. Removing stop words after the DocumentTermMatrix has been created works fine if one is working with single words, but what if one is creating a dtm of possible combinations of words? Wouldn't one want to remove them from the corpus? Mark Mark W. Kimpel MD ** Neuroin

[R] Problems by saving Rprofile.site under vista

2009-11-13 Thread anna_l
Hello, I am trying to save some changes I have done on the Rprofile.site under vista and it doesn´t let me save the file saying that it can´t create the following file (Rprofile.site) and that I should check the pathfile or the file name. -- View this message in context: http://old.nabble.com

[R] random numbers in C

2009-11-13 Thread Thomas Unternaehrer
I need some random numbers in my C program. Here a small example: #include void rand (int* n) { int len = *n; for (int i = 0; i < len; i++) Rprintf("%1.5f ", unif_rand()); } dyn.load("rand.dll") .C("rand",

Re: [R] How to show all the functions and classes that are defined in a library?

2009-11-13 Thread hadley wickham
On Fri, Nov 13, 2009 at 9:53 AM, Peng Yu wrote: > library(some_library_name) Try help(package = some_library_name) Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] p-value > 1

2009-11-13 Thread Ista Zahn
The maintainer's email address is listed in the package documentation... as I think is the case with all CRAN packages. -Ista On Fri, Nov 13, 2009 at 11:20 AM, amor Gandhi wrote: > Thank you for your reply. > > The only contact address of the maintainer is > http://www-stat.stanford.edu/~tibs/SA

Re: [R] p-value > 1

2009-11-13 Thread amor Gandhi
Thank you for your reply. The only contact address of the maintainer is http://www-stat.stanford.edu/~tibs/SAM However, one find no contact when one visit this page. I am not a mathematician, therefore, it is strange for me to get probability bigger that 1, if it is like that should I trust

[R] shrink list by mathed entries

2009-11-13 Thread Soeren . Vogel
Hello a <- c("Mama", "Papa", "Papa; Mama", "", "Sammy; Mama; Papa") a <- strsplit(a, "; ") mama <- rep(F, length(a)) mama[sapply(a, function(x) { sum(x=="Mama") }, simplify=T) > 0] <- T papa <- rep(F, length(a)) papa[sapply(a, function(x) { sum(x=="Papa") }, simplify=T) > 0] <- T # ... more varia

Re: [R] vignettes: .png graphics or pre-compiled .pdf

2009-11-13 Thread Achim Zeileis
On Fri, 13 Nov 2009, Michael Friendly wrote: In a package I'm working on there is a vignette with a number of graphs that result in huge .pdf files, so the .pdf for the vignette is around 17 Mb. If these graphs are converted to .png, and the .tex file is compiled with pdflatex, the resulting

Re: [R] How to show all the functions and classes that are defined in a library?

2009-11-13 Thread Romain Francois
On 11/13/2009 04:53 PM, Peng Yu wrote: library(some_library_name) Suppose I load a library. You mean "package" right ? A library is a set of packages I'm wondering what command I should use to list all the functions, classes and variables defined in the library. Check ?ls : > ls( "packag

[R] Craddock-Flood Test in R?

2009-11-13 Thread soeren . vogel
Hello The "Craddock-Flood Test" is recommended for large tables with small degrees of freedom and low-frequency cells. Is there an R procedure and/or package which does the test? Thank you for your help! Sören Vogel -- Sören Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag, Dept. SIAM http

[R] vignettes: .png graphics or pre-compiled .pdf

2009-11-13 Thread Michael Friendly
In a package I'm working on there is a vignette with a number of graphs that result in huge .pdf files, so the .pdf for the vignette is around 17 Mb. If these graphs are converted to .png, and the .tex file is compiled with pdflatex, the resulting .pdf is ~1 Mb. I'm reluctant to put the .Rnw f

[R] How to show all the functions and classes that are defined in a library?

2009-11-13 Thread Peng Yu
library(some_library_name) Suppose I load a library. I'm wondering what command I should use to list all the functions, classes and variables defined in the library. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

[R] NetCDF output in R

2009-11-13 Thread nana
Dear Users, I have corrected the errors. Many thanks. For this error, > [1] "put.var.ncdf: warning: you asked to write 1440 values, but the passed > data array has 37440 entries!" I added start= c(1,1,1), count=c(length(lons),length(lats),length(nt)) in the put.var.ncdf function. so put.var.n

Re: [R] replace a whole word with sub()

2009-11-13 Thread Prof Brian Ripley
Do you want to replace the whole word or the whole string? If the latter, use sub("^Ig.*", "0", x) (Matching is greedy, so .* matches are many characters as possible, here the rest of the string.) If 'whole word', we need a precise definition of word, but sub("^Ig\\w*", "0", x) is one con

Re: [R] How can this code be improved?

2009-11-13 Thread Richard R. Liu
Jim, Dennis, Once again, thanks for all your suggestions. After developing a more R-like version of the script I terminated the running one after 976 (of 1697) reports had been processed. At that point, the script had been running for approx. 33.5 hours! Here is the new version: library(fileha

Re: [R] replace a whole word with sub()

2009-11-13 Thread Adaikalavan Ramasamy
Isn't this more straightforward? w <- grep("^Ig", vec) vec[w] <- "0" Regards, Adai Giulio Di Giovanni wrote: Dear all, I cannot figure out how to solve a small problem (well, not for me), surely somebody can help me in few seconds. I have a series of strings in a vector X of t

Re: [R] replace a whole word with sub()

2009-11-13 Thread Gabor Grothendieck
Here are two ways: > s <- c("xxx", "yyy", "zzz", "IgA", "IgG", "kkk", "IgM", "aaa") > > sub("^Ig.*", "0", s) [1] "xxx" "yyy" "zzz" "0" "0" "kkk" "0" "aaa" > > replace(s, grepl("^Ig", s), "0") [1] "xxx" "yyy" "zzz" "0" "0" "kkk" "0" "aaa" On Fri, Nov 13, 2009 at 10:13 AM, Giulio Di Gi

Re: [R] replace a whole word with sub()

2009-11-13 Thread Marc Schwartz
On Nov 13, 2009, at 9:13 AM, Giulio Di Giovanni wrote: Dear all, I cannot figure out how to solve a small problem (well, not for me), surely somebody can help me in few seconds. I have a series of strings in a vector X of the type "xxx", "yyy", "zzz", "IgA", "IgG", "kkk", "IgM", "

[R] replace a whole word with sub()

2009-11-13 Thread Giulio Di Giovanni
Dear all, I cannot figure out how to solve a small problem (well, not for me), surely somebody can help me in few seconds. I have a series of strings in a vector X of the type "xxx", "yyy", "zzz", "IgA", "IgG", "kkk", "IgM", "aaa". I want to substitute every ENTIRE string beginning

[R] format help()

2009-11-13 Thread gabriel singer
Hi everybody, probably a really stupid question. I updated to 2.10 recently and was surprised that the help function comes in a different format, i.e. in the "old-style" as single pages for each function. I know I can use the html format in a browser, but would prefer the "in-between" format w

Re: [R] Help with complicated regular expression

2009-11-13 Thread Gabor Grothendieck
\w+ will match one or more word characters and \s* will match 0 or more spacing characters so if this must the described text must be the complete expression then: grepl("^\\w+\\s*\\(\\s*\\w+\\s*\\)$", x) or if its ok for other text to appear before and after as long as the indicated text is amon

Re: [R] Escaping regular expressions

2009-11-13 Thread Gabor Grothendieck
This is not minimal (it will escape every non-word character) but is short and the needlessly escaped ones should do no harm (though you might want to double check that assumption on a few examples): gsub("(\\W)", "\\1", x) On Fri, Nov 13, 2009 at 8:33 AM, Hadley Wickham wrote: > Hi all, > >

Re: [R] Change working directory

2009-11-13 Thread stephen sefick
.Rprofile is executed everytime you start up R On Fri, Nov 13, 2009 at 8:34 AM, anna_l wrote: > > Hello, I am using setwd() to change the working directory but I have to enter > it everytime I open R, is there a way to set this permanently as a working > directory? Thanx =^D > > -- > View this me

  1   2   >