Re: [R] 2D filled.contour plot with 1D histograms by axes

2013-03-09 Thread Jim Lemon
On 03/09/2013 04:05 AM, Jing Lu wrote: Hi everyone, I hope this question is beyond read the manual. My task is simple, just to plot the following, but the plot in the middle should be a filled.contour plot: http://gallery.r-enthusiasts.com/graph/Scatterplot_with_marginal_histograms_78

[R] quesion about lm function

2013-03-09 Thread meng
Hi all: My data is in the attachment. I want to analysis the mean difference of y between 2 sex. My code: result_lm-lm(y~factor(sex) + x1 + x2) summary(result_lm) The result of factor(sex)m 136.83, is the mean difference of y between 2 sex,and the corresponding p value is 0.07618. My

Re: [R] Calculation with date

2013-03-09 Thread R. Michael Weylandt
On Sat, Mar 9, 2013 at 11:41 AM, Christofer Bogaso bogaso.christo...@gmail.com wrote: Hello again, Let say I have an non-negative integer vector (which may be random): Vec - c(0, 13, 10, 4) And I have a date: Date - as.Date(Sys.time()) Date [1] 2013-03-09 Using these 2

Re: [R] quesion about lm function

2013-03-09 Thread R. Michael Weylandt
On Sat, Mar 9, 2013 at 10:35 AM, meng laomen...@163.com wrote: Hi all: My data is in the attachment. I want to analysis the mean difference of y between 2 sex. My code: result_lm-lm(y~factor(sex) + x1 + x2) summary(result_lm) The result of factor(sex)m 136.83, is the mean difference of y

Re: [R] Calculation with date

2013-03-09 Thread Rui Barradas
Hello, I don't believe there's such a function, but you can write one. Date - as.Date(Sys.time()) New_Vec - c(2013-03-01, 2014-04-01, 2014-01-01, 2013-07-01) New_Vec - as.Date(New_Vec) Vec - c(0, 13, 10, 4) plusmonths - function(x, y){ s - as.integer(format(x, %m)) + y yx -

Re: [R] Calculation with date

2013-03-09 Thread arun
Hi, You could try this: library(lubridate)  res-as.Date(dmy(format(Date-8, %d-%m-%Y))+months(Vec)) res #[1] 2013-03-01 2014-04-01 2014-01-01 2013-07-01 A.K. - Original Message - From: Christofer Bogaso bogaso.christo...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Saturday,

[R] grouping followed by finding frequent patterns in R

2013-03-09 Thread Dhiman Biswas
I have a data in the following form : CIN TRN_TYP 90799541 90799542 90799543 90799544 90799545 90799544 90799545 90799546 90799547 90799548 90799549 90799549 .. .. .. there are 100 types of

[R] Finding where a string drops below a certain value

2013-03-09 Thread Williams,Caroline
Dear R-helpers, I am stuck on a problem, and hope someone can help. I am trying to find the time point in a time series where the values drop below a baseline threshold, defined by the mean +/- standard deviation calculated on the last 6 time points of the series. Here is a simplified example:

Re: [R] grouping followed by finding frequent patterns in R

2013-03-09 Thread Bert Gunter
I **suggest** that you explain what you wish to accomplish using a reproducible example rather than telling us what packages you think you should use. I believe you are making things too complicated; e.g. what do you mean by frequent patterns? Moreover, basket format is rather unclear -- and may

Re: [R] R GUI frond has stopped working

2013-03-09 Thread Uwe Ligges
On 09.03.2013 00:53, lefelit wrote: Hi I found the source of the problem. The R would not let me update the survival and KernSmooth package at the R/library folder. I manually delete them and then download the latest version of them to proceed with the xcms installation. I work on a window 7

[R] lmer (LME4) and survey standard error

2013-03-09 Thread David Epstein
Hello, I am using lmer (LME4) to build a model from data for 19 different neighborhoods drawn, in part, from the American Communities Survey (ACS). The ACS data is static while other variables change over the five years under investigation. I am new to mixed effects models and was hoping that

Re: [R] optim hangs without warnings or error

2013-03-09 Thread Uwe Ligges
Katja, this seems to be a bug. I can reproduce this under 64-bit R-2.15.3 / R-prerelease for Windows. It works with the results given by Ben Bolker under 32-bit R for Windows. Will inspect shortly. Best, Uwe On 07.03.2013 21:08, Katja Hebestreit wrote: Hello, optim hangs for some

Re: [R] Finding where a string drops below a certain value

2013-03-09 Thread Rui Barradas
Hello, The following functions will return an index to the required values, not the values themselves. firstzero - function(x) which(x == 0)[1] lastone - function(x){ z - firstzero(x) if(z == 1) NULL else z - 1 } Hope this helps, Rui Barradas Em 09-03-2013 12:53,

Re: [R] Word Frequency for each row

2013-03-09 Thread arun
HI, library(stringr) dat1- read.table(text= ID, Data  1,I love oranges and apples   2,Oranges are good so we must eat them and also drik oranges   3,Apples are not that good like oranges so eat oranges ,sep=,,header=TRUE,stringsAsFactors=FALSE) #If you need to count both Oranges and oranges

Re: [R] Word Frequency for each row

2013-03-09 Thread Rui Barradas
Hello, This is why the posting guide says that you sholud provide a data example. Try the following. dat - read.table(text = ID, Data 1, I love oranges and apples 2,Oranges are good so we must eat them and also drik oranges 3,Apples are not that good like oranges so eat

Re: [R] Calculation with date

2013-03-09 Thread David Winsemius
On Mar 9, 2013, at 4:24 AM, Rui Barradas wrote: Hello, I don't believe there's such a function, but you can write one. I beg to disagree. The seq.Date function lets one create sequences by month. The only added twist in this case is to subract to the beginning of the current month: seq(

Re: [R] Word Frequency for each row

2013-03-09 Thread Sudip Chatterjee
Hi Rui and Arun, My apology, next time onwards I will post the data example as well. Things are working and I appreciate your time. Warm Regards On Sat, Mar 9, 2013 at 10:02 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, This is why the posting guide says that you sholud provide a

Re: [R] Word Frequency for each row

2013-03-09 Thread Sudip Chatterjee
Hi All, This is very helpful, but my data looks like this ID Data 1 I love oranges and apples 2Oranges are good so we must eat them and also drik oranges 3Apples are not that good like oranges so eat oranges I would like to count # of oranges in each row. How do I go

Re: [R] Feedback – Regarding R Programming Language Version 2.15.1 (2012-06-22) Usage

2013-03-09 Thread R. Michael Weylandt
Please do not massively cross-post and provide a reproducible example (search stack overflow or other sites for advice on how to do so) I _guarantee_ you R is not broken in this sense. MW On Sat, Mar 9, 2013 at 4:02 PM, Sujit Das reach.sujit...@gmail.com wrote: Dear Sir / Madam, I am using R

Re: [R] Feedback – Regarding R Programming Language Version 2.15.1 (2012-06-22) Usage

2013-03-09 Thread Barry Rowlingson
On Sat, Mar 9, 2013 at 5:11 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Please do not massively cross-post and provide a reproducible example (search stack overflow or other sites for advice on how to do so) I _guarantee_ you R is not broken in this sense. I would put money on

Re: [R] Feedback – Regarding R Programming Language Version 2.15.1 (2012-06-22) Usage

2013-03-09 Thread David Winsemius
Trimmed cross posted addresses (and I apologize for not noticing this when I was reviewing it in the moderation queue.) PLEASE READ THE POSTING GUIDE. Sujit Das. On Mar 9, 2013, at 8:02 AM, Sujit Das wrote: Dear Sir / Madam, I am using R Programming Language Version 2.15.1 (2012-06-22) for

Re: [R] R GUI frond has stopped working

2013-03-09 Thread Uwe Ligges
On 09.03.2013 18:22, lefelit wrote: Hi It is unlikely not to have the required permissions as I was working on my own pc as administrator. Fine, so start R by right-click and Run as Administrator or so, and it will work (unless the packages are already loaded before you start). Uwe

Re: [R] Zoo Data

2013-03-09 Thread arun
HI Jakob, If your data is based on 30 min interval, this should work: dat1-read.table(text= TIME, Value1, Value2 01.08.2011 02:30:00, 4.4, 4.7 01.09.2011 03:00:00, 4.2, 4.3 01.11.2011 01:00:00, 3.5, 4.3 01.12.2011 01:40:00, 3.4, 4.5 01.01.2012 02:00:00, 4.8, 5.3 01.02.2012 02:30:00, 4.9,

[R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread Alexandre Sieira
I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric: date1 = 20130301 date2 = 20130302 d1 = as.Date(date1, format=%Y%m%d, tz=GMT)

Re: [R] R GUI frond has stopped working

2013-03-09 Thread lefelit
Hi It is unlikely not to have the required permissions as I was working on my own pc as administrator. The packages kernSmooth and survival are loaded with the R software in the library folder. This is the sequence of the installation process source(http://bioconductor.org/biocLite.R;) Warning

Re: [R] 2D filled.contour plot with 1D histograms by axes

2013-03-09 Thread Greg Snow
Instead of read the manual, how about read the answers that you have already received. Or tell us why those answers are not good enough. Or you can read the manual on the .filled.contour function (which is on the same page as filled.contour). On Fri, Mar 8, 2013 at 10:05 AM, Jing Lu

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread David Winsemius
On Mar 9, 2013, at 9:24 AM, Alexandre Sieira wrote: I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric: date1 = 20130301

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread R. Michael Weylandt
On Sat, Mar 9, 2013 at 6:50 PM, David Winsemius dwinsem...@comcast.net wrote: I was unable to find the reason for the original coercion in the help(for) page or the R Language Definition entry regarding for-loops. On the hunch that coercion via as.vector might be occurring, Behaviorally,

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread Peter Ehlers
On 2013-03-09 11:14, R. Michael Weylandt wrote: On Sat, Mar 9, 2013 at 6:50 PM, David Winsemius dwinsem...@comcast.net wrote: I was unable to find the reason for the original coercion in the help(for) page or the R Language Definition entry regarding for-loops. On the hunch that coercion via

[R] Changing default order of plots in par

2013-03-09 Thread Brian Smith
Hi, I wanted to change the order of how the plots appear in a multiplot scenario. For example, in the code below: # pdf('test.pdf',width=8,height=8) par(mfrow = c(2,2)) for(i in 1:2){ v1 - sample(1:1000,50) v2 - sample(1:1000,50) mat - cbind(v1,v2) plot(v1,v2) boxplot(mat) }

Re: [R] R GUI frond has stopped working

2013-03-09 Thread Jeff Newmiller
I have found life to be considerably simpler since I have stopped using Run-As-Administrator. If you use it at any point with R, various files throughout your filesystem become accessible only when you use RAA again... it is like heroin... use begets more use. If you restrict your use of admin

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread luke-tierney
R's for loop is only designed to iterato over primitive types. The help file says of the seq argument: seq: An expression evaluating to a vector (including a list and an expression) or to a pairlist or ‘NULL’. A factor value will be coerced to a character vector. [This

Re: [R] Changing default order of plots in par

2013-03-09 Thread Rui Barradas
Hello, Instead of mfrow use mfcol and the order becomes col by col. Hope this helps, Rui Barradas Em 09-03-2013 20:55, Brian Smith escreveu: Hi, I wanted to change the order of how the plots appear in a multiplot scenario. For example, in the code below: #

Re: [R] Changing default order of plots in par

2013-03-09 Thread Brian Smith
Thanks Rui! That worked. On Sat, Mar 9, 2013 at 4:22 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Instead of mfrow use mfcol and the order becomes col by col. Hope this helps, Rui Barradas Em 09-03-2013 20:55, Brian Smith escreveu: Hi, I wanted to change the order of how the

Re: [R] Tobit Fixed Effects

2013-03-09 Thread Felipe Nunes
Dear all, I'm using censReg 0.5-16 to run a random effects model in a panel data, but R is having an error. I have already transformed my data using 'plm'. Can someone help me understanding why? This is the model and the error: R tob1 - censReg(transfers.cap ~ ifdm + gdp.cap + coa.power +

Re: [R] Word Frequency for each row

2013-03-09 Thread Tyler Rinker
I think the qdap package's termco (termo count) function will do what you want. Read the specifics as spacing around the word matters.      library(qdap);        termco(DATA$state, 1:nrow(DATA), c(it))      Date: Fri, 8 Mar 2013 21:34:31 +0530

Re: [R] Word Frequency for each row

2013-03-09 Thread Tyler Rinker
I see you provided sample data.  Here it is with that: library(qdap) termco(dat$Data, dat$ID, c( oranges )) From: tyler_rin...@hotmail.com To: sudipanal...@gmail.com; r-help@r-project.org Date: Sat, 9 Mar 2013 17:20:24 -0500 Subject: Re: [R] Word

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread David Winsemius
On Mar 9, 2013, at 1:10 PM, luke-tier...@uiowa.edu wrote: R's for loop is only designed to iterato over primitive types. The help file says of the seq argument: seq: An expression evaluating to a vector (including a list and an expression) or to a pairlist or ‘NULL’. A factor

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread luke-tierney
On Sat, 9 Mar 2013, Alexandre Sieira wrote: Thanks for the clarification, Luke. That is really counter-intuitive behavior. I 100% agree with you that the for documentation should state that assumption explicitly. I would also like to suggest changing the for implementation to issue a warning

Re: [R] read.table freezes the computer

2013-03-09 Thread Ben Bolker
Jie jimmycloud at gmail.com writes: [snip] I have a txt file to read into R. The size of it is about 500MB. This txt file is produced by calling write.table(M, file = xxx.txt), where M is a large matrix After running MM = read.table(xxx.txt), the R gui keeps a cpu core/thread fully

Re: [R] lmer (LME4) and survey standard error

2013-03-09 Thread Ben Bolker
David Epstein davideps at umich.edu writes: [snip] I am using lmer (LME4) to build a model from data for 19 different neighborhoods drawn, in part, from the American Communities Survey (ACS). The ACS data is static while other variables change over the five years under investigation. I am

Re: [R] get current plot dimensions?

2013-03-09 Thread Not To Miss
Learned a new trick. thanks! Zech On Fri, Mar 8, 2013 at 6:41 PM, William Dunlap wdun...@tibco.com wrote: Try using the combination plot.new() ; par(new=TRUE) to advance to the next position in the layout before querying par(pin). Be sure to actually plot something after the

Re: [R] get current plot dimensions?

2013-03-09 Thread William Dunlap
par(mfrow) and, apparently layout(), set things up for the next plot but don't change the settings for the current plot. Hence you need to start a new plot to look at the settings for it. If you don't call par(new=TRUE) then the subsequent call to plot() (which calls the equivalent of

[R] EEG data for time series

2013-03-09 Thread Erin Hodgess
Dear R People: I have a data set with EEG data. There are 128 measurements per second for 16 locations. What is the best way to handle these series, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown

Re: [R] EEG data for time series

2013-03-09 Thread David Winsemius
On Mar 9, 2013, at 7:36 PM, Erin Hodgess wrote: Dear R People: I have a data set with EEG data. There are 128 measurements per second for 16 locations. What is the best way to handle these series, please? Have you done a search of Markmail with the term: EEG? -- David Winsemius

Re: [R] max row

2013-03-09 Thread arun
HI, Using c11- 0.01 c12- 0.01 c1- 0.10 c2- 0.10 One possible problem is that: dim(res5) #[1] 513  20 res6-aggregate(.~m1+n1+m+n,data=res5[,c(1:6,9:12,21:24)] ,max) #Error in `[.data.frame`(res5, , c(1:6, 9:12, 21:24)) :  # undefined columns selected A.K.

Re: [R] EEG data for time series

2013-03-09 Thread Bert Gunter
(Sorry, failed to cc the list) On Sat, Mar 9, 2013 at 10:11 PM, Bert Gunter bgun...@gene.com wrote: Erin: If this is a question about statistical methodology for such complex data, then all I can say is: surely you jest! -- it's off topic and farfetched, to say the least, to expect useful

[R] list + lapply insead of matrix + apply

2013-03-09 Thread ishi soichi
I need to develop a simple list manipulation. Although it seems easier to do it in matrix form, but I need it in list form. I have a matrix x - matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) for list form example, the conversion is x.list - lapply(seq_len(nrow(x)), function(i) x[i,])

Re: [R] list + lapply insead of matrix + apply

2013-03-09 Thread ishi soichi
there is a typo. lapply(x.list, calcnorm, x.list) should be lapply(x.list, calcnorm2, x.list) sorry. 2013/3/10 ishi soichi soichi...@gmail.com I need to develop a simple list manipulation. Although it seems easier to do it in matrix form, but I need it in list form. I have a matrix

Re: [R] list + lapply insead of matrix + apply

2013-03-09 Thread arun
Hi, For the first case: lst2-lapply(x.list, calcnorm2, x.list)  lapply(lst2,function(x) do.call(c,x)) #[[1]] #[1]  0.0 31.75257 #[[2]] #[1] 31.75257  0.0 A.K. For the second case:  lst1-as.list(data.frame(t(apply(x,1,calcnorm2.const,x  names(lst1)- NULL  lst1 #[[1]] #[1]  

Re: [R] list + lapply insead of matrix + apply

2013-03-09 Thread ishi soichi
Thanks! You saved me a lot! 2013/3/10 arun smartpink...@yahoo.com Hi, For the first case: lst2-lapply(x.list, calcnorm2, x.list) lapply(lst2,function(x) do.call(c,x)) #[[1]] #[1] 0.0 31.75257 #[[2]] #[1] 31.75257 0.0 A.K. For the second case:

Re: [R] quesion about lm function

2013-03-09 Thread meng
But I don't want the original mean y ,but the corrected mean y of analysis of covariant. Also,the difference of original mean y is not 136.83,which is the difference of the corrected meany. ÔÚ 2013-03-09 20:11:11£¬R. Michael Weylandt michael.weyla...@gmail.com дµÀ£º On Sat, Mar 9,

Re: [R] How to transpose it in a fast way?

2013-03-09 Thread jim holtman
Did you check out the 'colbycol' package. On Fri, Mar 8, 2013 at 5:46 PM, Martin Morgan mtmor...@fhcrc.org wrote: On 03/08/2013 06:01 AM, Jan van der Laan wrote: You could use the fact that scan reads the data rowwise, and the fact that arrays are stored columnwise: # generate a small

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread Alexandre Sieira
Thanks for the clarification, Luke. That is really counter-intuitive behavior. I 100% agree with you that the for documentation should state that assumption explicitly. I would also like to suggest changing the for implementation to issue a warning if the seq argument is a vector of a

[R] RGL plot not working right..

2013-03-09 Thread C
Hi .. i'm Carey.. trying to figure out how to get this vol surface correct.. not sure where i'm going wrong.. http://pastebin.com/mmA4m4FJ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] quesion about lm function

2013-03-09 Thread meng
Thanks for your reply. But the mean y of sex(f) and sex(m) can't be negative since the min and max of y is 1632.5 and 6410.6 respectively. And your code's result: sex(f): -1255.56 sex(m):-1118.73 The above result isn't correct since they are negative. Thanks At 2013-03-10