Re: [R] Help with vectors!

2015-09-09 Thread Rolf Turner
On 10/09/15 06:30, Frank Schwidom wrote: c( as.factor( VAS)) On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: # your data VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow", "Black","Green","Black") Better: as.numeric(factor(VAS)) See fortune(185). cheers

Re: [R] frequency tables

2015-09-09 Thread David Winsemius
On Sep 9, 2015, at 11:52 AM, Nick Petschek wrote: > Hi, > > I want to run frequency tables for multiple categorical variables, ideally > one in %, and the other as a count, and am unsure how to proceed. I would > like my output to be the following: > > | favorable | unfavorable | neutral

Re: [R] Help with vectors!

2015-09-09 Thread Frank Schwidom
Just for fun: > colSums( outer( VAS, VAS, '<')) [1] 3 3 0 3 7 8 8 0 3 0 On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vector > New_Vector<-numeric(length(V

Re: [R] intersection between two matrices based on two columns in R

2015-09-09 Thread Jeff Newmiller
Ergh... DYAC. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research E

Re: [R] grid with random or clustered distribution

2015-09-09 Thread SH
Thank you so much! I will try it! On Wed, Sep 9, 2015 at 3:27 PM, Sarah Goslee wrote: > > ### simulate landscapes with spatial autocorrelation ### > ### Sarah Goslee 2015-09-09 ### > ### Goslee 2006 PLANT ECOL

Re: [R] Handling NA's when you write your own code

2015-09-09 Thread Ott Toomet
Not quite sure what you mean with "dealing with NAs in use-specific code". Some functions handle these automatically, like lm(). If you write your own code, and want to handle NA-s somehow, you have to implement such checks yourself. You may also use the "complete.cases" function (but that does

[R] frequency tables

2015-09-09 Thread Nick Petschek
Hi, I want to run frequency tables for multiple categorical variables, ideally one in %, and the other as a count, and am unsure how to proceed. I would like my output to be the following: | favorable | unfavorable | neutral Q1 | 80% | 10%| 10% | Q2 | 70% |

[R] useR! 2016 Conference Announcement

2015-09-09 Thread Balasubramanian Narasimhan
We are happy to announce that the R user conference useR! 2016 is scheduled for June 27-30, 2016, and will take place at the campus of Stanford University, Stanford California, USA. Following the formats of previous conferences, the program will consist of a day of tutorials followed by thre

Re: [R] intersection between two matrices based on two columns in R

2015-09-09 Thread David Winsemius
On Sep 9, 2015, at 12:39 PM, Lida Zeighami wrote: > Hi there, > > I want to find the intersection between two different data frame or > matrices based on two columns. > for example in matrix A I have 5 columns, the first two columns are Id1 and > Id2 and I have the same columns in the other matr

Re: [R] intersection between two matrices based on two columns in R

2015-09-09 Thread Duncan Murdoch
On 09/09/2015 3:48 PM, Jeff Newmiller wrote: > Matrices and data frames are write different. For this you most likely want > to use days frames. ... > Sent from my phone. Please excuse my brevity. ... and your auto-correct. ;-) Duncan Murdoch __ R-h

Re: [R] intersection between two matrices based on two columns in R

2015-09-09 Thread Bert Gunter
I am not quite clear what you mean by "intersection", but I think ?merge is what you are looking for. Cheers, Bert P.S. Please post in plain text, not HTML (though here it didn't matter). Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom

Re: [R] intersection between two matrices based on two columns in R

2015-09-09 Thread Jeff Newmiller
Matrices and data frames are write different. For this you most likely want to use days frames. ?merge Using typical options merge gives you all columns from both data frames. You can choose to select specific columns by indexing the data frames before passing them to merge if you don't want t

[R] intersection between two matrices based on two columns in R

2015-09-09 Thread Lida Zeighami
Hi there, I want to find the intersection between two different data frame or matrices based on two columns. for example in matrix A I have 5 columns, the first two columns are Id1 and Id2 and I have the same columns in the other matrix B, (Id1, Id2 ,,,) how can I find the intersection between the

Re: [R] grid with random or clustered distribution

2015-09-09 Thread Sarah Goslee
### simulate landscapes with spatial autocorrelation ### ### Sarah Goslee 2015-09-09 ### ### Goslee 2006 PLANT ECOLOGY 187(2):203-212 ### library(gstat

Re: [R] Help with vectors!

2015-09-09 Thread Dan D
VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") c(factor(VAS)) # to give integer indexing to the colors --- This is very nice, Frank. And it can be easily adjusted to match the original criterion that the numbers match the order of appearance of the colors

[R] Handling NA's when you write your own code

2015-09-09 Thread Olu Ola via R-help
Hello, I have a dataset that have a couple of missing values and I DO NOT want to delete the observations with the missing values. I have read about na.action in dealing with missing values but I do not know how it applies to user-specific written code. Is there a code you can use with your dat

Re: [R] Help with vectors!

2015-09-09 Thread Frank Schwidom
c( as.factor( VAS)) On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vector > New_Vector<-numeric(length(VAS)) > > # brute force: > New_Vector[VAS=="White"]<-1 >

Re: [R] How to do global curve fitting in R

2015-09-09 Thread Jianling Fan
Thanks very much William, That's exactly what I need! It is so excellent to do it by a group-separation by [] syntax. Thanks again! Best regards, Jianling On 9 September 2015 at 11:15, William Dunlap wrote: > You can put all your data in one data.frame along with a column called, say, >

Re: [R] How to do global curve fitting in R

2015-09-09 Thread Bert Gunter
Well.. 1) To add to Duncan's comments, if you create a new "dataset" discrete factor column to indicate the dataset in the combined data, then you would fit the model dataset/(corrected denominator). 2) However, there **is** a statistical issue here, for if you have more than a "few" data sets, s

Re: [R] How to do global curve fitting in R

2015-09-09 Thread William Dunlap
You can put all your data in one data.frame along with a column called, say, 'group' that says which group each row is in. Then use the [] syntax in nls's formula argument to get group-specific estimates for some of the parameters. E.g., in the following there is a global parameter 'b' and a group

[R] Doing time series markov regime switching in R

2015-09-09 Thread Maxim Fomin
Dear all, I am doing business cycle research on industry data. One of methods to identify cycle is Markov regime switching. As I see, there is a MSwM package for the purposes which is pretty straightforward to use. However, some questions for me remain: 1) Are there any packages? This is relevant

Re: [R] How to do global curve fitting in R

2015-09-09 Thread Duncan Murdoch
On 09/09/2015 12:28 PM, Jianling Fan wrote: > Hi, Bert > > Thanks for your reply. > > I am fitting a logistic does response model with 3 parameters as : > y=a/(1+(x/x0)b), I have many sets of data. I can fit each of them for > the model. but I want them shared the parameter x0 and b, but varied >

Re: [R] How to do global curve fitting in R

2015-09-09 Thread Jianling Fan
Hi, Bert Thanks for your reply. I am fitting a logistic does response model with 3 parameters as : y=a/(1+(x/x0)b), I have many sets of data. I can fit each of them for the model. but I want them shared the parameter x0 and b, but varied for each a. I don't think it is a statistics problem. It

Re: [R] How to do global curve fitting in R

2015-09-09 Thread Bert Gunter
Jianling: 1. What models are you trying to fit? Details matter, and it is impossible to give a good answer without specifics. 2. In general terms, to do this one combines all the data and allows for "appropriate" changes in the model parameters for the different groups. For example, different int

[R] How to do global curve fitting in R

2015-09-09 Thread Jianling Fan
Hello all, I am trying to fit my data to a nls model. I have many sets of data and each can fit well for the curve. but I want to fit them at once by sharing 2 of 3 parameters of the model. I know it is a typical global curve fitting problem, but I don't know how to do it by R? Does anyone know a

Re: [R] Pb with date time sequence with period<1sec

2015-09-09 Thread Sarah Goslee
Looks like R FAQ 7.31 to me. https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f On Wed, Sep 9, 2015 at 4:19 AM, DE wrote: > Hi, > > I'd like to create a date-time seq with a period of 0.05 s, over several > days. > > # try : > start<-strptime(nom_f

Re: [R] Seeking help

2015-09-09 Thread Duncan Murdoch
On 09/09/2015 8:11 AM, varun yadav wrote: Hi, I am working on Predictive analytics assignment This list isn't for help with homework. You should ask your instructor for help. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

[R] Seeking help

2015-09-09 Thread varun yadav
Hi, I am working on Predictive analytics assignment i which i need to predict winner of state election . Data set is not very big but have multiple files and as per my understanding only few of them are useful. Problem statement is "* Which party should be given chance by the people to rule Bihar

[R] Pb with date time sequence with period<1sec

2015-09-09 Thread DE
Hi, I'd like to create a date-time seq with a period of 0.05 s, over several days. # try : start<-strptime(nom_fich,format="%y%m%d") time<-seq(from=start, by=0.05, length.out = 86400*20*3) print(as.POSIXlt(time[2])$sec) # result is 0.0495 and not 0.05 as expected But If I am looking at the

Re: [R] grid with random or clustered distribution

2015-09-09 Thread SH
Hi Sarah, Thanks for your prompt responding. The methodology in the publication is very similar to what I plan to do. Yes, could you be willing to share the code if you don't mind? Thanks a lot again, Steve On Wed, Sep 9, 2015 at 9:11 AM, Sarah Goslee wrote: > You can use gstat, as in: > >

Re: [R] grid with random or clustered distribution

2015-09-09 Thread Sarah Goslee
You can use gstat, as in: https://www.researchgate.net/publication/43279659_Behavior_of_Vegetation_Sampling_Methods_in_the_Presence_of_Spatial_Autocorrelation If you need more detail, I can dig up the code. Sarah On Wed, Sep 9, 2015 at 8:49 AM, SH wrote: > Hi R-users, > > I hope this is not red

[R] grid with random or clustered distribution

2015-09-09 Thread SH
Hi R-users, I hope this is not redundant questions. I tried to search similar threads relevant to my questions but could not find. Any input would be greatly appreciated. I want to generate grid with binary values (1 or 0) in n1 by n2 (e.g., 100 by 100 or 200 by 500, etc.) given proportions of

Re: [R] Help with vectors!

2015-09-09 Thread Eik Vettorazzi
how about this: match(VAS,unique(VAS)) #or, preserving given order match(VAS,c("White","Yellow","Green","Black")) Cheers. Am 05.09.2015 um 23:14 schrieb Dan D: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vecto

Re: [R] Converting a .wav file into an mp3 file in R

2015-09-09 Thread Jim Lemon
Hi Dimitri, Have a look at SoX: http://sox.sourceforge.net/ Jim On Wed, Sep 9, 2015 at 6:28 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Hello, > > I know how to read in mp3 files, e.g., using tuneR. > But is it possible to read in a .wav file - as below and then compres

Re: [R] Task Views

2015-09-09 Thread Achim Zeileis
On Wed, 9 Sep 2015, Partha Sinha wrote: Dear All I am using R version R version 3.2.1 (2015-06-18) in windows 7. I have installed few task views like Timeseries and Graphics in R. 1. Is it possible to find out which "TASK Views" are installed in the system ? Not out of the box. The task view

Re: [R] help with reshape

2015-09-09 Thread Ivan Calandra
Hi David and Petr, Just a small update: I have installed R3.2.2 for Snow Leopard (from http://r.research.att.com/) and I still get the same problem. There is no available version of 3.3.0 for Snow Leopard so I will have to wait to check that. Ivan -- Ivan Calandra, PhD University of Reims C