Re: [R] flag a record

2016-02-27 Thread Jim Lemon
Hi Ashta, This does not seem too difficult: DF$flag<-"n" for(thisname in unique(DF$Name)) { if(any(DF$year[DF$Name == thisname] %in% c(2014,2015) & DF$tag[DF$Name == thisname])) DF$flag[DF$Name == thisname]<-"y" } Jim On Sun, Feb 28, 2016 at 1:23 PM, Ashta wrote: > Hi all, > > I have a d

Re: [R] Why does match() treat NaN's as compables; Bug or Feature?

2016-02-27 Thread Bert Gunter
(on list, since others might not have gotten it either). OK, I get it now. It was I who misunderstood. But isn't the bug in the **misuse** of match() in ecdf() (by failing to specify the nomatch argument). Jeff says comparisons with NaN should return an unordered result, which NaN is afaics: > N

[R] flag a record

2016-02-27 Thread Ashta
Hi all, I have a data set represented by the following sample. I want flag records of an individual as "N", if if the tag column of an individual is equal to zero for the last two years. So in the following example, Alex1 records are flagged as "y", On the other hand Carla's records are fla

Re: [R] Why does match() treat NaN's as compables; Bug or Feature?

2016-02-27 Thread Jeff Newmiller
That is one valid point, but according to IEEE754 "a comparison with NaN always returns an unordered result" which it doesn't do unless the incomparables argument to match is specified. Ick. -- Sent from my phone. Please excuse my brevity. On February 27, 2016 3:34:34 PM PST, Bert Gunter wrote

Re: [R] Why does match() treat NaN's as compables; Bug or Feature?

2016-02-27 Thread Bert Gunter
If I understand you correctly, the "bug" is that you do not understand match(). See inline comment below and note carefully the "Value" section of ?match. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Be

[R] is this an R bug or a DBI bug?

2016-02-27 Thread Anthony Damico
this happens with both SQLite and MonetDBLite, so i assume it is not an RSQLite bug. notice the gc() in the no-crash version.. thanks # initiate R with "C:\Program Files\R\R-3.2.3\bin\x64\Rterm.exe" --max-mem-size=35M library(RSQLite) db <- dbConnect( SQLite() ) for( i in 1:1000

[R] Why does match() treat NaN's as compables; Bug or Feature?

2016-02-27 Thread Jason Thorpe
For some reason `match()` treats `NaN`'s as comparables by default: > x <- c(1,2,3,NaN,4,5) > match(x,x) [1] 1 2 3 4 5 6 which I can override when using `match()` directly: > match(x,x,incomparables=NaN) [1] 1 2 3 NA 5 6 but not necessarily when calling a function that uses `match()` inter

Re: [R] Using Fortran with MPI, RInside, and calling R functions

2016-02-27 Thread Erin Hodgess
Got it. thanks. On Sat, Feb 27, 2016 at 2:39 PM, peter dalgaard wrote: > Yeah, well, not much harm done, but once compilers are involved, r-devel > is usually preferred over r-help. > > -pd > > > On 27 Feb 2016, at 21:30 , Erin Hodgess wrote: > > > > Sorry...thought it was ok since it uses RI

Re: [R] Using Fortran with MPI, RInside, and calling R functions

2016-02-27 Thread peter dalgaard
Yeah, well, not much harm done, but once compilers are involved, r-devel is usually preferred over r-help. -pd > On 27 Feb 2016, at 21:30 , Erin Hodgess wrote: > > Sorry...thought it was ok since it uses RInside and Rcpp. > > > On Sat, Feb 27, 2016 at 2:15 PM, Jeff Newmiller > wrote: > >>

Re: [R] Using Fortran with MPI, RInside, and calling R functions

2016-02-27 Thread Erin Hodgess
Sorry...thought it was ok since it uses RInside and Rcpp. On Sat, Feb 27, 2016 at 2:15 PM, Jeff Newmiller wrote: > This is off topic here... wrong audience. Read the Posting Guide. > -- > Sent from my phone. Please excuse my brevity. > > On February 27, 2016 12:00:23 PM PST, Erin Hodgess < > er

Re: [R] Using Fortran with MPI, RInside, and calling R functions

2016-02-27 Thread Jeff Newmiller
This is off topic here... wrong audience. Read the Posting Guide. -- Sent from my phone. Please excuse my brevity. On February 27, 2016 12:00:23 PM PST, Erin Hodgess wrote: >Hello again. > >This time, I would like to add MPI to my Fortran program. Here are the >Fortran and C++ codes: > >prog

[R] Using Fortran with MPI, RInside, and calling R functions

2016-02-27 Thread Erin Hodgess
Hello again. This time, I would like to add MPI to my Fortran program. Here are the Fortran and C++ codes: program buzzy use iso_c_binding implicit none include '/opt/openmpi/include/mpif.h' integer :: rank,size,ierror,tag,status(MPI_STATUS_SIZE), i,np integer :: argc = 100

Re: [R] Predicting correlated responses using canonical correlations in multivariate least squares

2016-02-27 Thread Michael Friendly
On 2/27/2016 1:34 PM, Michael Friendly wrote: You might also find that an HE plot (library (heplots)) is illuminating. Follow-up: Try the following with your example library(heplots) hs.mod <- lm(cbind(y1, y2) ~ x1 + x2, data=hs.r) heplot(hs.mod, fill=TRUE) uv.mod <- lm(cbind(u1, u2) ~ v1 +

Re: [R] Predicting correlated responses using canonical correlations in multivariate least squares

2016-02-27 Thread Michael Friendly
Hi Alex, Thanks for the detailed explanation and the reproducible example. But it is still not clear exactly what you wish to accomplish. You know how to calculate the scores on the canonical variates. These could be considered 'predicted scores', but in canonical space. What's wrong with that?

Re: [R] Convert list to data frame

2016-02-27 Thread Jeff Newmiller
I think the advice about the file format is an track, but you imply modifying the file as a solution but that is probably not the best approach. Using a decent text editor that shows you what invisible characters are in the file can guide you in adjusting the arguments to read.table. for example

Re: [R] Convert list to data frame

2016-02-27 Thread David Winsemius
> On Feb 27, 2016, at 6:04 AM, > wrote: > > Hi, > > I read data from file as follows > > Data<-read.table("file.txt",header=T,sep="\t") > > mode(Data) > list > > I want to convert data to data frame, It is already a dataframe. That is the class of object that read.table returns. > I tr

Re: [R] Convert list to data frame

2016-02-27 Thread Karim Mezhoud
To known the format of your object, please use class(Data) str(Data) Be sure to have regular space between strings in your file.txt. Karim On Sat, Feb 27, 2016 at 3:56 PM, Ivan Calandra wrote: > Hi, > > I have seen this question a few days/weeks ago... > > Data.frames are special list, so it's

Re: [R] Convert list to data frame

2016-02-27 Thread Ivan Calandra
Hi, I have seen this question a few days/weeks ago... Data.frames are special list, so it's normal. Read the help for read.table(), especially the "value" section (where the output of the function is described). And read also some introductory material, where the different data types are expla

[R] Convert list to data frame

2016-02-27 Thread asma.rabe
Hi, I read data from file as follows Data<-read.table("file.txt",header=T,sep="\t") mode(Data) list I want to convert data to data frame, I tried the following: as.data.frame(Data) data.frame(Data) But the Data did not change When I tried as.data.frame(unlist(Data)) The Data converted to a

Re: [R] rgrass7 problem

2016-02-27 Thread Roger Bivand
Carolina Arias Muñoz gmail.com> writes: > > Hello > > I am trying to use "readRAST" in GRASS, but I am keep getting the same > error: > > *Error: 'checkCRSArgs' is not an exported object from 'namespace:rgdal'* > > Probably a problem of the rgdal library? Speculation of this kind is never se

[R] Predicting correlated responses using canonical correlations in multivariate least squares

2016-02-27 Thread doorz
I have a considerable interest in trying to improve the predictions from 10+ highly correlated predictors to two (2) highly correlated responses. OLS does not allow me to take into account the correlation between the responses. Multivariate can take into account the correlations between the pr