Re: [R] simulated correlated vectors

2009-11-13 Thread Karl Ove Hufthammer
On Thu, 12 Nov 2009 08:10:12 -0800 (PST) carol white wht_...@yahoo.com wrote: Having a vector x of float type without any assumption of its distribution (mean, variance etc), how to generate another vector that is correlated with x? Define an arbitrary function 'f', where 'f' may have a

[R] survreg function in survival package

2009-11-13 Thread carol white
Hi, Is it normal to get intercept in the list of covariates in the output of survreg function with standard error, z, p.value etc? Does it mean that intercept was fitted with the covariates? Does Value column represent coefficients or some thing else? Regards,

Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP

2009-11-13 Thread Karl Ove Hufthammer
On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 ychu066 @aucklanduni.ac.nz wrote: And I also want to save each histogram in each separate pdf file using the following codes ?. png(hist.png[i]) dev.off() Try png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer

Re: [R] Problem building R 2.10.0 - Matrix package

2009-11-13 Thread Martin Maechler
Thank you, Russ, but ... RPH == R P Herrold herr...@owlriver.com on Thu, 12 Nov 2009 14:13:26 -0500 (EST) writes: TA == Thomas Adams thomas.ad...@noaa.gov TA Attached is the output file from building R 2.10.0 on RedHat Linux. I TA have never previously experienced any

Re: [R] XML: Reading transition matrices into R

2009-11-13 Thread stefan.d...@gmail.com
Thank you so much You really helped me a lot! Best from R'dam, Stefan On Fri, Nov 13, 2009 at 2:14 AM, Duncan Temple Lang dun...@wald.ucdavis.edu wrote: stefan.d...@gmail.com wrote: Hello, thanks a lot. This is a form which I can work with in R. Another question, which I hope is not

[R] All combination

2009-11-13 Thread RON70
Please consider the following : expand.grid(rep(list(c(1:3)), 3)) Var1 Var2 Var3 1 111 2 211 3 311 4 121 5 221 6 321 7 131 8 231 9 331 10112 11212 1231

Re: [R] All combination

2009-11-13 Thread Dimitris Rizopoulos
have a look at function permutations from package 'e1071', e.g., library(e1071) permutations(3) I hope it helps. Best, Dimitris RON70 wrote: Please consider the following : expand.grid(rep(list(c(1:3)), 3)) Var1 Var2 Var3 1 111 2 211 3 311 4 1

Re: [R] dfbetas vs dfbeta

2009-11-13 Thread Peter Dalgaard
alphaace wrote: Hi, I've looked around but can't find a clear answer to the difference for these two? Any help? Thanks! One is a scaled version of the other, at least for lm objects: stats:::dfbetas.lm function (model, infl = lm.influence(model, do.coef = TRUE), ...) { xxi -

Re: [R] R package for reading / writing 3D file (. PLY)

2009-11-13 Thread kvarpun
Duncan Murdoch-2 wrote: On 11/12/2009 11:37 AM, kvarpun wrote: Duncan Murdoch-2 wrote: On 11/12/2009 4:56 AM, kvarpun wrote: Hi, Is there an R package that reads and writes 3D images having the extension PLY (PLY images of Stanford University)? Currently, I installed the

Re: [R] starting html help for a package?

2009-11-13 Thread Liviu Andronic
On 11/12/09, Duncan Murdoch murd...@stats.uwo.ca wrote: help(package=boot, help_type = html) The page displayed there was never an HTML page. In the future it probably should be, but it hasn't been implemented yet. At the moment is there a way to call the html help for a package, that is

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

2009-11-13 Thread 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 arguments and then you may understand what is happening: data2[(data2$x1

[R] processing log file

2009-11-13 Thread Jabez Wilson
Dear all, I'm trying to process a log file which logs the date, the username and the computer number accessed. The table looks like this: table.users Date UserName Machine 1  2008-11-25 John 641 2  2008-11-25    Clive 611 3  2008-11-25   Jeremy 641 4  2008-11-25 Walt  

[R] R, NIH and FDA

2009-11-13 Thread Federico Calboli
Dear All, I will soon be working with NIH and possibly FDA. Will I be able to use R or will I be forced to use SAS? Cheers, Federico -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St. Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20

[R] z-test with NAs

2009-11-13 Thread ms.com
Dear all I am learning R I am doing Z-test with package 'BSDA' here is my syntax and result: sdgr.ztest-z.test(growth[type=='SD' from_treeline=='above'], + growth[type=='SD' from_treeline=='below'],alternative = two.sided, + mu = 0, sigma.x =(sd(growth[type=='SD'

Re: [R] starting html help for a package?

2009-11-13 Thread Duncan Murdoch
Liviu Andronic wrote: On 11/12/09, Duncan Murdoch murd...@stats.uwo.ca wrote: help(package=boot, help_type = html) The page displayed there was never an HTML page. In the future it probably should be, but it hasn't been implemented yet. At the moment is there a way to call

Re: [R] how to pass matrices from C to R effectively

2009-11-13 Thread Duncan Murdoch
Hao Cen wrote: Hi Duncan, Thanks for your reply. I am not sure what you meant by tell your C function to use the memory that R sent to it. What R can pass to C is a pointer to an array and the array size, assuming we are taking about the .C mechanism. Did you mean my C function takes that array

Re: [R] processing log file

2009-11-13 Thread David Winsemius
On Nov 13, 2009, at 6:03 AM, Jabez Wilson wrote: Dear all, I'm trying to process a log file which logs the date, the username and the computer number accessed. The table looks like this: table.users Date UserName Machine 1 2008-11-25 John 641 2 2008-11-25Clive 611

Re: [R] Splus

2009-11-13 Thread Duncan Murdoch
ozgur gultekin wrote: I am modelling oil price data in s plus, but I have some problem in my code, especially while I am estimating my model (ARMA GARCH) and also I have some question too, anyone can help me about S-plus? I think it has same syntax with R You should call their tech support,

Re: [R] data frame subsets?

2009-11-13 Thread David Winsemius
On Nov 12, 2009, at 10:57 PM, Douglas M. Hultstrand wrote: Hello, I am trying to create data frame subsets based on binned temperature data. I have code working to create the bins (d.1 and d.2), but it takes two steps, I was wondering if I could merge into one step. See Below d n

Re: [R] survreg function in survival package

2009-11-13 Thread David Winsemius
On Nov 13, 2009, at 3:17 AM, carol white wrote: Hi, Is it normal to get intercept in the list of covariates in the output of survreg function with standard error, z, p.value etc? Does it mean that intercept was fitted with the covariates? Does Value column represent coefficients or some

[R] starting pdf help for a package? (was starting html help for a package?)

2009-11-13 Thread Liviu Andronic
Dear all A sequel to my previous post. On Fri, Nov 13, 2009 at 11:33 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: At some point in the future the package?info page will be able to be generated automatically, and I imagine it will end up containing the package info you saw.   It would make

Re: [R] R, NIH and FDA

2009-11-13 Thread Federico Calboli
On 13 Nov 2009, at 12:25, Barry Rowlingson wrote: Working with is different to Working for. Assuming they want to work with you then they want you for your abilities and skills, and if those skills are with R then you go ahead and use R. You don't employ a bricklayer to build a wall and then

Re: [R] processing log file

2009-11-13 Thread Karl Ove Hufthammer
On Fri, 13 Nov 2009 11:03:31 + (GMT) Jabez Wilson jabez...@yahoo.co.uk wrote: What I want to do is to find out how many unique users logged on each day, and how many individual machines where accessed per day. Use the 'plyr' package: library(plyr) ddply(table.users, .(Date), summarise,

Re: [R] R, NIH and FDA

2009-11-13 Thread Barry Rowlingson
On Fri, Nov 13, 2009 at 11:21 AM, Federico Calboli f.calb...@imperial.ac.uk wrote: Dear All, I will soon be working with NIH and possibly FDA. Will I be able to use R or will I be forced to use SAS? Working with is different to Working for. Assuming they want to work with you then they want

[R] Rarefaction Curve by Individuals not Sites - vegan (specaccum)

2009-11-13 Thread Rodrigo Aluizio
Hi List, I’m using the vegan function specaccum to produce a rarefaction curve. In the function’s help it says: “Function ‘specaccum’ finds species accumulation curves or the number of species for a certain number of sampled sites or individuals”. Well, I would like to finds this curve for

Re: [R] speech spectogram

2009-11-13 Thread Olivier Crouzet
Le Mon, 19 Oct 2009 12:00:16 +0530, rajesh j a écrit : Hi, I need to plot a spectogram for a speech signal. Is there a package that can do this? Late answer, but you should have a look at seewave package on CRAN. The function spectro() is what you need. Olivier. -- Olivier Crouzet,

[R] p-value 1

2009-11-13 Thread amor Gandhi
Dear all, I am trying to use SAMr-library(samr), it gives me p-value = 1.001, any idea why? Many thanks, Amor __ z gegen Massenmails. [[alternative HTML version deleted]] __

Re: [R] R, NIH and FDA

2009-11-13 Thread Frank E Harrell Jr
Federico Calboli wrote: Dear All, I will soon be working with NIH and possibly FDA. Will I be able to use R or will I be forced to use SAS? Cheers, Federico There are many R users are FDA, NIH, CDC, and other federal agencies. IT support tends to be a problem. Some agencies are using R

Re: [R] R, NIH and FDA

2009-11-13 Thread Karl Ove Hufthammer
On Fri, 13 Nov 2009 11:21:30 + Federico Calboli f.calb...@imperial.ac.uk wrote: I will soon be working with NIH and possibly FDA. Will I be able to use R or will I be forced to use SAS? You will (hopefully) be able to use R. See this document: http://www.r-project.org/doc/R-FDA.pdf --

Re: [R] Problem building R 2.10.0 - Matrix package

2009-11-13 Thread Thomas Adams
Martin, That's exactly right. I'm simply building R from source, downloaded from CRAN, and doing exactly what I have easily been able to do previously. I think I first encountered this problem with version 2.9.2 (if memory serves…). Tom Martin Maechler wrote: Thank you, Russ, but ...

Re: [R] Escaping regular expressions

2009-11-13 Thread Henrique Dallazuanna
Try the fixed argument: grep(.$^, c(Test.$^, Test), fixed = TRUE) On Fri, Nov 13, 2009 at 11:33 AM, Hadley Wickham had...@rice.edu wrote: Hi all, Is there a method for escaping strings to be used regular expressions?  i.e. if I have a user supplied string that I'd like to use as a fixed

[R] Escaping regular expressions

2009-11-13 Thread Hadley Wickham
Hi all, Is there a method for escaping strings to be used regular expressions? i.e. if I have a user supplied string that I'd like to use as a fixed component is there a method that will turn (e.g.) .$^ into \\.\\$\\^ ? Thanks, Hadley -- http://had.co.nz/

[R] Help with complicated regular expression

2009-11-13 Thread Dennis Fisher
Colleagues, I am using R (2.9.2, all platforms) to search for a complicated text string using regular expressions. I would appreciate any help you can provide. The string consists of the following elements: SOMEWORDWITHNOSPACES any number of spaces and/or tabs (

Re: [R] Help with complicated regular expression

2009-11-13 Thread Tony Plate
One of these should be a start. If there can be no extra text at the beginning or end, start with ^ and end with $. x - c(WORD ( 123), WORD(1 ), WORD\t ( 21\t), WORD \t ( 1 \t ), decoy((2)), more words in front(2)) grep([[:alpha:]]+[ \t]*\\([ \t]*[0-9]+[ \t]*\\), x) [1] 1 2 3 4 6

Re: [R] Help with complicated regular expression

2009-11-13 Thread Marc Schwartz
On Nov 13, 2009, at 8:12 AM, Dennis Fisher wrote: Colleagues, I am using R (2.9.2, all platforms) to search for a complicated text string using regular expressions. I would appreciate any help you can provide. The string consists of the following elements: SOMEWORDWITHNOSPACES

Re: [R] Help with complicated regular expression

2009-11-13 Thread jim holtman
try this: x - c('WORD(12 )', 'WORD[123)', 'WORD ( 123 )', WORD(xx), WORD(1)) grep([[:alnum:]]+[[:space:]]*\\([[:space:]]*[[:digit:]]+[[:space:]]*\\), x) [1] 1 3 5 On Fri, Nov 13, 2009 at 9:12 AM, Dennis Fisher fis...@plessthan.com wrote: Colleagues, I am using R (2.9.2, all

[R] Change working directory

2009-11-13 Thread anna_l
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 message in context: http://old.nabble.com/Change-working-directory-tp26337486p26337486.html Sent from the R

Re: [R] LINEAR MIXED EFFECT

2009-11-13 Thread ANARPCG
Douglas Bates-2 wrote: On Thu, Nov 12, 2009 at 10:14 AM, milton ruser milton.ru...@gmail.com wrote: Hi Ana, I am not quite sure if it is the problem, but if you call your data.frame as exp, you will crash exp() function... try use another name for your data.frame. By the way, I

Re: [R] Escaping regular expressions

2009-11-13 Thread Hadley Wickham
I want the user supplied string to be used as a component of a regular expression that I build up from other pieces that need actual regular expressions. Hadley On Fri, Nov 13, 2009 at 7:41 AM, Henrique Dallazuanna www...@gmail.com wrote: Try the fixed argument: grep(.$^, c(Test.$^, Test),

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 lippelann...@hotmail.com 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

Re: [R] p-value 1

2009-11-13 Thread Peter Dalgaard
amor Gandhi wrote: Dear all, I am trying to use SAMr-library(samr), it gives me p-value = 1.001, any idea why? Well, the package maintainer might be a better place to ask. (Bring an example if you do.) However, as a generic matter, the result is obviously nonsensical, and could be due to

Re: [R] Help with complicated regular expression

2009-11-13 Thread Romain Francois
Hello, The function you are looking for is grepl. Something like this perhaps: words - c(WORD ( 123),WORD(1), WORD\t ( 21\t) , WORD\t ( 21\t) ) grepl( [[:space:]]*[(][[:space:]]*[0-9]+[[:space:]]*[)], words ) [1] TRUE TRUE TRUE TRUE [[:space:]]* : any number of spaces or tabs

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 had...@rice.edu wrote:

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 among

[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 with

[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 with Ig with

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, aaa. I want

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 Giovanni perimessagg...@hotmail.com wrote: Dear all, I

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 the

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:

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

[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

[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

[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

[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

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(

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

[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 variables ... produces the

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

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 amorigan...@yahoo.de wrote: Thank you for your reply. The only contact address of the maintainer is

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 pengyu...@gmail.com 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

[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 R.h 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,

[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:

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 **

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=startd),

[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

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 markle...@verizon.net wrote: From:

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

[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

[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] 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

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´t

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: unexpected

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)

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 syntax so I don´t

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 jabez...@yahoo.co.uk wrote: Thanks, that's helpful because I can see the individuals and how many times

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

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: [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 jholt...@gmail.com 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

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 murd...@stats.uwo.cawrote: 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] linear model and by()

2009-11-13 Thread Ista Zahn
On Fri, Nov 13, 2009 at 11:49 AM, Sam Albers tonightstheni...@gmail.com wrote: snip 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

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

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] 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 R.h void rand (int* n) { int len = *n; for (int i = 0; i len; i++)

[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

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

[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

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 try

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 used

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 r...@krueger-family.de 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] 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

[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

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 m...@llnl.gov

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] 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] 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 data

[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 s - 1:20;

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.

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 without which

  1   2   >