Re: [R] Head or Tails game

2012-08-06 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of darnold Sent: Friday, August 03, 2012 9:18 PM To: r-help@r-project.org Subject: Re: [R] Head or Tails game Wow! Some great responses! I am getting some great responses.

Re: [R] regexpr with accents

2012-08-06 Thread Rui Barradas
Hello, Works with me: d1 - data.frame(V1 = 1:3, V2 = c(some text = 9, some tèxt = 9, some other text = 9)) regexpr(some text = 9, d1$V2) [1] 1 -1 -1 attr(,match.length) [1] 13 -1 -1 regexpr(some tèxt = 9, d1$V2) [1] -1 1 -1 attr(,match.length) [1] -1 13 -1 d1$V1[regexpr(some text =

Re: [R] regexpr with accents

2012-08-06 Thread arun
HI, It works with me.  I am using R 2.15 on Ubuntu 12.04.  d1 - data.frame(V1 = 1:5, V2=c(some text = 9, some téxt=9,sóme tèxt=9,  söme text=9, some têxt=9)) d1 #  V1    V2 #1  1 some text = 9 #2  2   some téxt=9 #3  3   sóme tèxt=9 #4  4   söme text=9 #5  5   some têxt=9  

Re: [R] deleting columns from a dataframe where NA is more than 15 percent of the column length

2012-08-06 Thread Faz Jones
Thank you. It works great. Sent from my iPhone On Aug 5, 2012, at 9:08 PM, Jorge I Velez jorgeivanve...@gmail.com wrote: Hi Faz, Here is one way of doing it where x is your data frame: x[, colMeans(is.na(x)) = .15] HTH, Jorge.- On Sun, Aug 5, 2012 at 9:04 PM, Faz Jones wrote:

Re: [R] deleting columns from a dataframe where NA is more than 15 percent of the column length

2012-08-06 Thread Faz Jones
Thank you.. It was very informative and helpful. It works Sent from my iPhone On Aug 5, 2012, at 10:21 PM, arun smartpink...@yahoo.com wrote: HI, Try this: dat1-data.frame(x=c(NA,NA,rnorm(6,15),NA),y=c(NA,rnorm(8,15)),z=c(rnorm(7,15),NA,NA)) dat1[which(colMeans(is.na(dat1))=.15)]

Re: [R] Memory limit for Windows 64bit build of R

2012-08-06 Thread David Winsemius
On Aug 5, 2012, at 3:52 PM, alan.x.simp...@nab.com.au wrote: Dear all I have a Windows Server 2008 R2 Enterprise machine, with 64bit R installed running on 2 x Quad-core Intel Xeon 5500 processor with 24GB DDR3 1066 Mhz RAM. I am seeking to analyse very large data sets (perhaps as much

Re: [R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-06 Thread Nerea Lezama
Thank you very much John, can you read it now? Hello, I'd like to do next, see if you could help me please: I have a csv called datuak with a id called calee_id and a colunm called poids. I have another csv called datuak2 with the same id called calee_id, (although there are calee_id that are in

Re: [R] find date between two other dates

2012-08-06 Thread penguins
Thanks arun and Rui; 3 fantastic suggestions. The Season interval is not always a month so arun's suggestion works better for this dataset. I couldn't get the as.between function to work on arun's second suggestion, it only returned NAs. However, arun's first suggestion worked a treat! Many

Re: [R] Memory limit for Windows 64bit build of R

2012-08-06 Thread Uwe Ligges
On 06.08.2012 09:34, David Winsemius wrote: On Aug 5, 2012, at 3:52 PM, alan.x.simp...@nab.com.au wrote: Dear all I have a Windows Server 2008 R2 Enterprise machine, with 64bit R installed running on 2 x Quad-core Intel Xeon 5500 processor with 24GB DDR3 1066 Mhz RAM. I am seeking to

Re: [R] Memory limit for Windows 64bit build of R

2012-08-06 Thread Prof Brian Ripley
On 06/08/2012 09:42, Uwe Ligges wrote: On 06.08.2012 09:34, David Winsemius wrote: On Aug 5, 2012, at 3:52 PM, alan.x.simp...@nab.com.au wrote: Dear all I have a Windows Server 2008 R2 Enterprise machine, with 64bit R installed running on 2 x Quad-core Intel Xeon 5500 processor with 24GB

Re: [R] low resolution word map

2012-08-06 Thread Ray Brownrigg
On 2/08/2012 8:06 a.m., Thomas Steiner wrote: Hi Ray, 2012/7/31 Ray Brownrigg ray.brownr...@ecs.vuw.ac.nz: On 07/28/12 23:46, Thomas Steiner wrote: Hi, I'd like to have a low resolution word map in R. The maps package has this option, but if I use the argument, the map looses sense: Russia

[R] Odp: Problem with segmented function

2012-08-06 Thread Petr PIKAL
Hi Hi, I appreciate your help with the segmented function. I am relatively new to R. I followed the introduction of the 'segmented'-package by Vito Muggeo, but still it does not work. Here are the lines I wrote: data_test-data.frame(x=c(1:10),y=c(1,1,1,1,1,2,3,4,5,6))

Re: [R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-06 Thread Petr PIKAL
Hi It is better to use dput for presenting data for others. You probably want ?merge. Something like merge(datuak, datuak2, by = calee_id, all.x=TRUE) However calee_id seems to be a floating point number and it may be rounded so you shall beware of it. Regards Petr Thank you very much

Re: [R] no font could be found for family Arial

2012-08-06 Thread tibr
I hope the original poster fixed this a long time ago, but I had the same problem and here is how I fixed it: - go to the application Fontbook - check if the Arial font has duplicates, and delete them, even if they are set to Off - restart the computer. emmats wrote I was re-running some

Re: [R] line type lty

2012-08-06 Thread ravibioinfo
http://www.google.com/url?sa=trct=jq=lty+in+r+line+typessource=webcd=1ved=0CFQQFjAAurl=http%3A%2F%2Fstudents.washington.edu%2Fmclarkso%2Fdocuments%2Fline%2520styles%2520Ver2.pdfei=HYgfUMPgGYLJrQfWjIGYBwusg=AFQjCNGL8xBzLN2je0RQFc5e8Hk5eRnS9Q -- View this message in context:

[R] LDA for topic modeling in R

2012-08-06 Thread davyfeng
Hi, All, I am using the supervised lda function (slda) from 'lda' package in R for topic modeling (http://cran.r-project.org/web/packages/lda/index.html), my data is a collection of documents, and within which each doc has a label. There are about 97 different categories and 18K documents in

Re: [R] Package to remove collinear variables

2012-08-06 Thread Gabor Grothendieck
On Sat, Aug 4, 2012 at 11:27 PM, Roberto rmosce...@unitus.it wrote: Hi, I need to remove collinear variables to my Near-Infrared table of spectra. What package can I use? Something simple, because I am a novice about statistic. There many methods of assessing multicollinearlity but to

[R] regexpr with accents

2012-08-06 Thread Luca Meyer
Sorry but my previous email did not go through properly. Instead of the ? you should really read an egrave or #232 according to http://www.lookuptables.com/. So there are extended ASCII characters I need to deal with. I have tried d1$V1[regexpr(some tegravext = 9,d1$V2)0] - 9 and

Re: [R] regexpr with accents

2012-08-06 Thread Luca Meyer
Thanks Arun, It works all right, I just found out that my problem was not with accents but with the correct spelling of some text. Kind regards, Luca Il giorno 06/ago/2012, alle ore 15.01, arun ha scritto: Hi, Here, the string with in the quotes are read exactly like that. So,

Re: [R] Memory limit for Windows 64bit build of R

2012-08-06 Thread Jay Emerson
Alan, More RAM will definitely help. But if you have an object needing more than 2^31-1 ~ 2 billion elements, you'll hit a wall regardless. This could be particularly limiting for matrices. It is less limiting for data.frame objects (where each column could be 2 billion elements). But many R

[R] issue with nzchar() ?

2012-08-06 Thread Liviu Andronic
Dear all I'm a bit surprised by the results output from nzchar(). The help page says: nzchar is a fast way to find out if elements of a character vector are *non-empty strings*. (my emphasis. However, if you do x - c(letters, NA, '') nzchar(x) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

Re: [R] issue with nzchar() ?

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic landronim...@gmail.com wrote: string, something that I find strange. At best NA is the equivalent of an empty string. In this sense, if you Hmisc::describe() the vector you get, as I would expect, that in the context of character vectors NA and ''

[R] Identify points that lie within polygon

2012-08-06 Thread Ally
I have a complex 2D polygon with thousands of vertices, and I'd like to be able to identify points from a large set contained within the polygon, and was wondering if there might be an efficient way of doing this? Any advice would be useful! Here is a small example of what I mean: # make

Re: [R] Parallel runs of an external executable with snow in local

2012-08-06 Thread Xavier Portell/UPC
Thanks Uwe but, actually, I did so. Since #8220;filetorun.exe#8221; looks in the current folder for #8220;input.txt#8221;, I tried moving all needed files to a newly created temporary folder #8220;tmp.id#8221; (say, tmp.1) and running the executable. This works fine by doing it directly from

Re: [R] Identify points that lie within polygon

2012-08-06 Thread Rui Barradas
Hello, With your example run and click 10 black points inside the area. ploc - locator(n=10) points(ploc$x, ploc$y, pch = 19, col = green, cex = 1) Hope this helps, Rui Barradas Em 06-08-2012 16:05, Ally escreveu: I have a complex 2D polygon with thousands of vertices, and I'd like to be

Re: [R] issue with nzchar() ?

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 9:53 AM, Liviu Andronic landronim...@gmail.com wrote: On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic landronim...@gmail.com wrote: string, something that I find strange. At best NA is the equivalent of an empty string. Certainly not to my mind, unless you think that zero

[R] bibtex::read.bib -- extracting bibentry keys

2012-08-06 Thread Michael Friendly
I have two versions of a bibtex database which have gotten badly out of sync. I need to find find all the entries in bib2 which are not contained in bib1, according to their bibtex keys. But I can't figure out how to extract a list of the bibentry keys in these databases. A minor question: Is

Re: [R] Identify points that lie within polygon

2012-08-06 Thread Jeff Newmiller
This is off-topic (not about R), and a quick Web search of test within polygon yields many results, and adding R to the search when using Google provides hints about applying the algorithms in R. --- Jeff Newmiller

Re: [R] issue with nzchar() ?

2012-08-06 Thread Bert Gunter
Liviu: Well, as usual, to a certain extent this is arbitrary and the only issue is whether it is documented correctly. To me, NA (of whatever mode) means indeterminate or unknown, so since is known and of length 0, I would have expected NA as a return. But the point is, not what our particular

Re: [R] Identify points that lie within polygon

2012-08-06 Thread Ally
Thanks for the suggestion, got exactly what I needed from library(splancs) ?pip Alastair Jeff Newmiller wrote This is off-topic (not about R), and a quick Web search of test within polygon yields many results, and adding R to the search when using Google provides hints about applying

Re: [R] bibtex::read.bib -- extracting bibentry keys

2012-08-06 Thread Achim Zeileis
On Mon, 6 Aug 2012, Michael Friendly wrote: I have two versions of a bibtex database which have gotten badly out of sync. I need to find find all the entries in bib2 which are not contained in bib1, according to their bibtex keys. But I can't figure out how to extract a list of the bibentry

[R] test if elements of a character vector contain letters

2012-08-06 Thread Liviu Andronic
Dear all I'm pretty sure that I'm approaching the problem in a wrong way. Suppose the following character vector: (x[1:10] - paste(x[1:10], sample(1:10, 10), sep='')) [1] a10 b7 c2 d3 e6 f1 g5 h8 i9 j4 x [1] a10 b7 c2 d3 e6 f1 g5 h8 i9 j4 k l m n [15] o p q r s t

Re: [R] how to assing unique ID in a table and do regression

2012-08-06 Thread Rui Barradas
Sorry, forgot to Cc the list. Em 06-08-2012 17:29, Rui Barradas escreveu: Hello, I'm glad it helped. The result of function cut() is a factor variable so you can coerce it to integer, giving more normal names, or, if you want to keep track of the intervals the adjusted r2 belong to, got

Re: [R] more efficient way to parallel

2012-08-06 Thread Jie
After searching online, I found that clusterCall or foreach might be the solution. Best wishes, Jie On Sun, Aug 5, 2012 at 10:23 PM, Jie jimmycl...@gmail.com wrote: Dear All, Suppose I have a program as below: Outside is a loop for simulation (with random generated data), inside there are

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Bert Gunter
nzchar(x) !is.na(x) No? -- Bert On Mon, Aug 6, 2012 at 9:25 AM, Liviu Andronic landronim...@gmail.com wrote: Dear all I'm pretty sure that I'm approaching the problem in a wrong way. Suppose the following character vector: (x[1:10] - paste(x[1:10], sample(1:10, 10), sep='')) [1] a10 b7

Re: [R] more efficient way to parallel

2012-08-06 Thread John Kerpel
Not that I've had a chance to really look at the problem, but I've removed outer loops using parLapply from the parallel package. Works great. On Mon, Aug 6, 2012 at 11:41 AM, Jie jimmycl...@gmail.com wrote: After searching online, I found that clusterCall or foreach might be the solution.

Re: [R] more efficient way to parallel

2012-08-06 Thread Martin Morgan
On 08/06/2012 09:41 AM, Jie wrote: After searching online, I found that clusterCall or foreach might be the solution. Re-write your outer loop as an lapply, then on non-Windows use parallel::mclapply. Or on windows use makePSOCKcluster and parLapply. I ended with library(parallel)

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Rui Barradas
Hello, Fun as an exercise in vectorization. 30 times faster. Don't look, guess. Gave it up? Ok, here it is. is_letter - function(x, pattern=c(letters, LETTERS)){ sapply(x, function(y){ any(sapply(pattern, function(z) grepl(z, y, fixed=T))) }) } # test ascii codes, just one

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Martin Morgan
On 08/06/2012 09:51 AM, Rui Barradas wrote: Hello, Fun as an exercise in vectorization. 30 times faster. Don't look, guess. system.time(res0 - grepl([[:alpha:]], x)) user system elapsed 0.060 0.000 0.061 system.time(res1 - has_letter(x)) user system elapsed 3.728 0.008

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Marc Schwartz
Perhaps I am missing something, but why use sapply() when grepl() is already vectorized? is.letter - function(x) grepl([:alpha:], x) is.number - function(x) grepl([:digit:], x) x - c(letters, 1:26) x[1:10] - paste(x[1:10], sample(1:10, 10), sep='') x - rep(x, 1e3) str(x) chr [1:52000] a2

Re: [R] issue with nzchar() ?

2012-08-06 Thread David L Carlson
It would be nice to be able to trigger NA returning NA with an argument to the function, but you can easily get that result: ifelse(is.na(x), NA, nzchar(x)) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [13] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

[R] Tukey HSD not fully displayed in R console

2012-08-06 Thread ulrike
Dear all, I would like to test the differences in dependent variable X depending on 2 grouping variables of each 10 levels. I do this with a 2-way ANOVA, followed by a Tukey HSD test (TukeyHSD(x)). However, since a lot of combinations are possible with 2 grouping variables, each of 10 levels,

[R] OO code organization

2012-08-06 Thread Michael Meyer
Greetings,   I am using S4 classes and the code is organized by putting each class into a separate source file in a separate folder:   In Folder base/base.R:defines class base and does   setGeneric(showSelf, function(this) standardGeneric(showSelf) ) setMethod(showSelf,

Re: [R] find date between two other dates

2012-08-06 Thread arun
Hi, I run the second list of codes (is.between()) again from the sent mail.  It works fine for me.  I am using R 2.15 on Ubuntu 12.04.    sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale:  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C   [3]

Re: [R] regexpr with accents

2012-08-06 Thread arun
Hi, Here, the string with in the quotes are read exactly like that.  So, you may have to use the symbol instead of friendly or numeric from the link.  Or you have to convert those. d1 - data.frame(V1 = 1:4,     V2 = c(some text = 9, some tegravext = 9, some tèxt = 9, some t#232xt = 9))

[R] program of matrix

2012-08-06 Thread hafida
Hi can ANY body help me to programme this formula: c[lj] and c[l'j] are matrix A[j]^-1 is an invertible diagonal matrix g[ll']=i[ll'] - sum *#from j=1 to k#* c[lj]c[l'j]A[j]^-1 WHERE i[ll']= 1/n sum from i=1 to n z[il] z[il'] n,k,m are given. j=1...k,l,l'=1...m, it s

[R] cannot find function simpleRDA2

2012-08-06 Thread Lindsey Leigh Sloat
Hi, I am trying to run the command forward.sel.par, however I receive the error message: Error: could not find function 'simpleRDA2'. I have the vegan library loaded. The documentation on varpart has not helped me to understand why I cannot call this function. Maybe I am missing something obvious

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread arun
Hi, Not sure whether this is you wanted. x-letters   (x[1:10] - paste(x[1:10], sample(1:10, 10), sep=''))  x1-c(x,1:26) x1  [1] a4  b3  c5  d2  e9  f6  g1  h8  i10 j7  k   l  [13] m   n   o   p   q   r   s   t   u   v   w   x  [25] y   z   1   2   3   4   5   6   7   8   9   10 [37] 11  12 

[R] How to convert data to 'normal' if they are in the form of standard scientific notations?

2012-08-06 Thread HJ YAN
Dear R users I read two csv data files into R and called them Tem1 and Tem5. For the first column, data in Tem1 has 13 digits where in Tem5 there are 14 digits for each observation. Originally there are 'numerical' as can be seen in my code below. But how can I display/convert them using

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Marc Schwartz
On Aug 6, 2012, at 12:06 PM, Marc Schwartz marc_schwa...@me.com wrote: Perhaps I am missing something, but why use sapply() when grepl() is already vectorized? is.letter - function(x) grepl([:alpha:], x) is.number - function(x) grepl([:digit:], x) Sorry, typos in the above from my CP.

[R] Splitting Data Into Different Series

2012-08-06 Thread Henrique Andrade
Dear R Community, I'm trying to write a loop to split my data into different series. I need to make a new matrix (or series) according to the series code. For instance, every time the code column assumes the value 433 I need to save date, value, and code into the dados433 matrix. Please take a

[R] Fw: test if elements of a character vector contain letters

2012-08-06 Thread arun
- Forwarded Message - From: arun smartpink...@yahoo.com To: Liviu Andronic landronim...@gmail.com Cc: R help r-help@r-project.org Sent: Monday, August 6, 2012 12:56 PM Subject: Re: [R] test if elements of a character vector contain letters Hi, Not sure whether this is you wanted.

Re: [R] no font could be found for family Arial

2012-08-06 Thread David Winsemius
On Aug 6, 2012, at 2:01 AM, tibr wrote: I hope the original poster fixed this a long time ago, but I had the same problem and here is how I fixed it: - go to the application Fontbook - check if the Arial font has duplicates, and delete them, even if they are set to Off - restart the

Re: [R] trouble with looping for effect of sampling interval increase

2012-08-06 Thread Jean V Adams
You would make it much easier for R-help readers to solve your problem if you provided a small example data set with your code, so that we could reproduce your results and troubleshoot the issues. Jean Naidraug white@wright.edu wrote on 08/05/2012 09:08:25 AM: I've looked everywhere

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread David L Carlson
Only an extra set of brackets: is.letter - function(x) grepl([[:alpha:]], x) is.number - function(x) grepl([[:digit:]], x) Without them, the functions are fast, but wrong. x [1] a8 b5 c10 d1 e6 f2 g4 h3 i7 j9 k l [13] m n o p q r s t u v w x [25] y z 1

Re: [R] bibtex::read.bib -- extracting bibentry keys

2012-08-06 Thread Michael Friendly
On 8/6/2012 11:54 AM, Achim Zeileis wrote: On Mon, 6 Aug 2012, Michael Friendly wrote: I have two versions of a bibtex database which have gotten badly out of sync. I need to find find all the entries in bib2 which are not contained in bib1, according to their bibtex keys. But I can't figure

Re: [R] sapply() and by()

2012-08-06 Thread Jean V Adams
Dominic, It's great that you provided some example data, but a much smaller data frame would have sufficed. For example, 10 randomly selected rows from your data ... LF - structure(list(Serra.da.Foladoira = c(27.335652173913, 25.4632608695652, 24.464652173913, 22.550652173913,

Re: [R] sapply() and by()

2012-08-06 Thread David Winsemius
On Aug 6, 2012, at 7:34 AM, Dominic Roye wrote: Hello everyone, I have a dataset with 5 colums (4 colums with thresholds of weather stations and one with month - data of 5 years). Now I would like to calculate the average for each month. I tried this unsuccessfully: lf.med -

Re: [R] How to convert data to 'normal' if they are in the form of standard scientific notations?

2012-08-06 Thread Jean V Adams
HJ, You don't provide any reproducible code, so I had to make up my own. dat - data.frame(a=letters[1:5], x=c(20110911001084, 20110911001084, 20110911001084, 20110911001084, 20110911001084), y=c(2.10004e+12, 2.10004e+12, 2.10004e+12, 2.10004e+12, 2.10004e+12)) In my example,

Re: [R] program of matrix

2012-08-06 Thread David Winsemius
On Aug 6, 2012, at 8:04 AM, hafida wrote: Hi can ANY body help me to programme this formula: c[lj] and c[l'j] are matrix A[j]^-1 is an invertible diagonal matrix g[ll']=i[ll'] - sum *#from j=1 to k#* c[lj]c[l'j]A[j]^-1 WHERE i[ll']= 1/n sum from i=1 to n z[il] z[il'] n,k,m are

Re: [R] Splitting Data Into Different Series

2012-08-06 Thread Rui Barradas
Hello, Try the following. split(data.frame(dados), dados[, code]) Also, it's better to have data like 'dados' in a data.frame, like this you would have dates of class Date, and numbers of classes numeric or integer: dados2 - data.frame(dados) dados2$date - as.Date(dados2$date)

Re: [R] program of matrix

2012-08-06 Thread David Winsemius
Well, I just posted the fourth copy to the list which I apologize for. (I meant to delete the response I wrote.) Re-re-posting an unclear message seems unwise on your part, 'hafida'. You are not following the advice in the footer to all messages and you are not following the advice in the

Re: [R] Tukey HSD not fully displayed in R console

2012-08-06 Thread John Kane
Would just saving the results onto an object saving it work? From the help page example summary(fm1 - aov(breaks ~ wool + tension, data = warpbreaks)) myresults- TukeyHSD(fm1, tension, ordered = TRUE) write.table (myresults, file = ksksk) John Kane Kingston ON Canada

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 6:42 PM, Bert Gunter gunter.ber...@gene.com wrote: nzchar(x) !is.na(x) No? It doesn't work for what I need: x [1] a10 b8 c9 d2 e3 f4 g1 h7 i6 j5 k l m n [15] o p q r s t u v w x y z 1 2 [29] 3 4 5 6 7 8 9 10 11 12

[R] Overlay Histogram

2012-08-06 Thread li li
Dear all, For two sets of random variables, say, x - rnorm(1000, 10, 10) and y - rnorm(1000. 3, 20). Is there any way to overlay the histograms (and density curves) of x and y on the plot of y vs. x? The histogram of x is on the x axis and that of y is on the y axis. The density curve here

Re: [R] Overlay Histogram

2012-08-06 Thread R. Michael Weylandt
See example(layout) for one idea. I think you might also want to look into rug plots. Best, Michael On Mon, Aug 6, 2012 at 2:40 PM, li li hannah@gmail.com wrote: Dear all, For two sets of random variables, say, x - rnorm(1000, 10, 10) and y - rnorm(1000. 3, 20). Is there any way to

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Yihui Xie
You probably mean grepl('[a-zA-Z]', x) Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Aug 6, 2012 at 3:29 PM, Liviu Andronic landronim...@gmail.com wrote: On Mon, Aug

Re: [R] program of matrix

2012-08-06 Thread hafida
A OK I MAKE A MISTAKE OK MR DAVID I WILL DO IT THANK YOU -- View this message in context: http://r.789695.n4.nabble.com/program-of-matrix-tp4639288p4639334.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] program of matrix

2012-08-06 Thread hafida
I CANT FIND ANY ANSWER MR DAVID -- View this message in context: http://r.789695.n4.nabble.com/program-of-matrix-tp4639288p4639332.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Splitting Data Into Different Series

2012-08-06 Thread Henrique Andrade
Dear Rui and Arun, Thanks a lot for your help. I will test all the proposed solutions ;-) Best regards, Henrique Andrade 2012/8/6 Rui Barradas ruipbarra...@sapo.pt: Hello, Try the following. split(data.frame(dados), dados[, code]) Also, it's better to have data like 'dados' in a

Re: [R] Splitting Data Into Different Series

2012-08-06 Thread arun
HI, You can subset the data  dados433-subset(dados,dados[,3]==433)  is.matrix(dados433) #[1] TRUE  dados433   date value  code 1 2012-01-01 0.56 433 2 2012-02-01 0.45 433 3 2012-03-01 0.21 433 4 2012-04-01 0.64 433 5 2012-05-01 0.36 433 6 2012-06-01 0.08 433

Re: [R] Overlay Histogram

2012-08-06 Thread arun
HI, #These links http://stackoverflow.com/questions/8545035/scatterplot-with-marginal-histograms-in-ggplot2 http://stackoverflow.com/questions/11022675/rotate-histogram-in-r-or-overlay-a-density-in-a-barplot #  might be helpful for you. A.K. - Original Message - From: li li

Re: [R] AR vs ARMA model

2012-08-06 Thread Jie
Please find some reference online or textbook. This must be contained in the model assessment part. AIC, BIC, rolling prediction/forecasting error might be what you want. Best wishes, Jie On Fri, Aug 3, 2012 at 4:07 AM, Soham soham.tommarvolorid...@gmail.comwrote: Hi I am trying to fit a time

Re: [R] program of matrix

2012-08-06 Thread David Winsemius
On Aug 6, 2012, at 11:16 AM, hafida wrote: I CANT FIND ANY ANSWER MR DAVID When I suggested that you learn to use the shift key, I was hoping for a sparing use of that key, such as at the beginning of sentences. The caps-lock key is different than the shift key. You are also posting to

Re: [R] cannot find function simpleRDA2

2012-08-06 Thread R. Michael Weylandt
Hi, simpleRDA2 is still in the vegan package, but it is not exported. I.e., the author only intends it for internal use and he doesn't make it available to end users directly. If you need to get at it, you can use getAnywhere(simpleRDA2) which will show it. If you need to make it available to

[R] Force evaluation of a symbol when a function is created

2012-08-06 Thread Schoenfeld, David Alan,Ph.D.,Biostatistics
I am porting a program in matlab to R, The problem is that Matlab has a feature where symbols that aren't arguments are evaluated immediately. That is: Y=3 F=@(x) x*Y Will yield a function such that F(2)=6. If later say. Y=4 then F(2) will still equal 6. R on the other hand has lazy

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread William Dunlap
You could use local(), as in F - local({ +Y - 3 +function(x) x * Y +}) F(7) [1] 21 Y - 19 F(5) [1] 15 Look into 'environments' for more. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From:

Re: [R] R: Help xts object Subset Date by Day of the Week

2012-08-06 Thread R. Michael Weylandt
On Sun, Aug 5, 2012 at 4:49 PM, Douglas Karabasz doug...@sigmamonster.com wrote: I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts) library(quantmod) library(lubridate) # Gets SPY data getSymbols(SPY) # Subset Prices

Re: [R] R: Help xts object Subset Date by Day of the Week

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 4:30 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Sun, Aug 5, 2012 at 4:49 PM, Douglas Karabasz doug...@sigmamonster.com wrote: I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts)

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote: is.letter - function(x) grepl([[:alpha:]], x) is.number - function(x) grepl([[:digit:]], x) This does exactly what I wanted: x [1] a10 b8 c9 d2 e3 f4 g1 h7 i6 j5 k l m n [15] o p q r s t u v

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread Bert Gunter
Thanks to both: Cute question, clever, informative answer. However, Bill, I don't think you **quite** answered him, although the modification needed is completely trivial. Of course, I could never have figured it out without your response. Anyway, I interpret the question as asking for the

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread William Dunlap
Both of those approaches require the function to be created at the same time that the environment containing some of its bindings is created. You can also take an existing function and assign a new environment to it. E.g., f - function(x) y * x ys - c(2,3,5,7,11) fs - lapply(ys,

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread Schoenfeld, David Alan,Ph.D.,Biostatistics
Thank you both, this was very helpful. I need to study environments more. Do either of you know a good source? -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, August 06, 2012 6:03 PM To: William Dunlap Cc: Schoenfeld, David Alan,Ph.D.,Biostatistics;

[R] Correct Place to Seek an R-Project Consultant?

2012-08-06 Thread Vik Rubenfeld
I would like to find out how to apply commands found in the bayesm package, to analyze data gathered via a choice-based conjoint study. Is there a web resource where I can seek an R-Project consultant experienced in this, who I could hire to walk me through the appropriate bayesm commands to

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 9:03 PM, Schoenfeld, David Alan,Ph.D.,Biostatistics dschoenf...@partners.org wrote: Thank you both, this was very helpful. I need to study environments more. Do either of you know a good source? Disclaimer: I really have no idea what I'm talking about. They are a

[R] GAM and interpolation?

2012-08-06 Thread Alex Hotmail
Hello fellow R users, I would need your help on GAM/GAMM models and interpolation on a marked spatial point process (cases and controls). I use the mgcv package to fit a GAMM model with a binary outcome, a parametric part (var1+..+varn), a spline used for the spatial variation, and a random

Re: [R] Force evaluation of a symbol when a function is created

2012-08-06 Thread arun
Hi, Try this:  F-function(x,type=local){Y=3  x*Y} F(3) #[1] 9  Y-4  F(3) #[1] 9  Y-5  F(3) #[1] 9 A.K. - Original Message - From: Schoenfeld, David Alan,Ph.D.,Biostatistics dschoenf...@partners.org To: 'r-help@r-project.org' r-help@r-project.org Cc: Sent: Monday, August 6, 2012 5:07

[R] Nested ANOVA

2012-08-06 Thread Archana Gawde
Hi, How do I do a Duncan Multiple Range Test, with Nested ANOVA. I am not sure how to write the nested variable within dmrt. Any suggestions? Archana [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] label_wrap_gen question

2012-08-06 Thread vd3000
Hi, all I am trying to use the label_wrap_gen function in this website. https://github.com/hadley/ggplot2/wiki/labeller I tried to make a long name like this Light and heavy good vehicles (diesel) -\nGVX f2 = facet_grid(vehicle ~ ., labeller=label_wrap_gen(width=15)) eventually, I got

Re: [R] line type lty

2012-08-06 Thread Pramod
lty =1 denotes the single continuous line lty = 2 denotes the broken line lty = 3 dotted line -- View this message in context: http://r.789695.n4.nabble.com/line-type-lty-tp3466345p4639365.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] How to convert data to 'normal' if they are in the form of standard scientific notations?

2012-08-06 Thread HJ YAN
Dear Jean Thanks a lot for your help. The reason I did not provide producible code is that my work started with reading in some large csv files, e.g. the data is not created by myself. But the data is from the same data provider so I would expect to receive data in exactly same data format. I

Re: [R] DAtes

2012-08-06 Thread Pramod
Well, i believe writing correct date format would have served the purpose. Suppose tfr contains Date as column and is a factor by class. tft$Date - as.Date(as.character(tfr$Date),%d/%m%Y) should give you the desired output. -- View this message in context:

Re: [R] Plotting Where People Live on a U.S. Map

2012-08-06 Thread Ricardo Pietrobon
Dan, google refine http://goo.gl/AeKml can actually transform zip codes into longitude/latitude - http://goo.gl/1HDWb will show you how to do this from street adresses, but it should also work from city names -- i think it will allocate a default long/lat for a city, but not sure of the exact

[R] shading line plot

2012-08-06 Thread Akhil dua
Hi everyone, I have a time series data set and I want to fill my line plot of this time series with different colors e.g I want to fill portion related to 1995-1996 with blue , portion related to 1996-1997 with orange and then portion related to 1997-1998 with red can anyone please help me.