[R] problem with posting question: This post has NOT been accepted by the mailing list yet

2014-10-31 Thread Neda Nikiforova
Dear administrator, my name is Neda Nikiforova and I'm trying to post a question in R help . I subscribed the list but it gives me the following problem: This post has NOT been accepted by the mailing list yet Is it possible to risolve this problem as soon as possible? Thank you very much in a

Re: [R] Creating a new column from a series of columns

2014-10-31 Thread Jeff Newmiller
This method handles cases where multiple columns are "Yes". library(reshape2) ddl <- melt( dd, id.vars = "PLTID" ) ddl[ is.na( ddl$value ), "value" ] <- "" ddl <- ddl[ "Yes" == ddl$value, ] result <- merge( dd[ , "PLTID", drop=FALSE ] , ddl[ , c( "PLTID", "variable", "value" ) ]

Re: [R] Creating a new column from a series of columns

2014-10-31 Thread Jorge I Velez
Dear Dennis, Assuming that your data.frame() is called dd, the following should get you started: colnames(dd[,-1])[apply(dd[,-1], 1, function(x) which(x == 'Yes'))] HTH, Jorge.- On Sat, Nov 1, 2014 at 12:32 PM, Fisher Dennis wrote: > R 3.1.1 > OS X > > Colleagues, > I have a dataset containi

[R] Creating a new column from a series of columns

2014-10-31 Thread Fisher Dennis
R 3.1.1 OS X Colleagues, I have a dataset containing multiple columns indicating race for subjects in a clinical trial. A subset of the data (obtained with dput) is shown here: structure(list(PLTID = c(7157, 8138, 8150, 9112, 9114, 9115, 9124, 9133, 9141, 9144, 9148, 12110, 12111, 12116, 12134

Re: [R] grided files

2014-10-31 Thread jim holtman
Here is an example of how you might do it: > # read in all the data so you can break it apart. > # it looks like there is head and then 17 lines of data > data_in <- readLines("C:\\Users\\jh52822\\Downloads\\analysis_mly_avg_1998.txt") > indx <- 1L # start at the first line > all_data <- NULL >

Re: [R] converting individual data series to natural log (continuously compounded return)

2014-10-31 Thread daniel
Upananda, I don't know your fut data, next time would help a simple dput(fut). Taking into account the error message check the following: library(PerformanceAnalytics) df <- data.frame( sample(10)/100+100, seq(as.Date("2014-10-22"), as.Date("2014-10-31"), by="day")) str(df) Return.calculate(df, "

[R] grided files

2014-10-31 Thread Alemu Tadesse
Dear All, I have a file the sample of which is attached. I was trying to read the data and put it in a data frame. For example in this file, I have 1998 snow depth data and each block of data belongs to one month.Each data point belongs to a given latitude and longitude (which is in another fi

[R] converting individual data series to natural log (continuously compounded return)

2014-10-31 Thread Upananda Pani
Hi All, I want to convert my price data into natural log (continuously compounded return) by using Performance Analytics Package, I am getting the following error. rfut = Return.calculate(fut) Error in checkData(prices, method = "xts") : Please help me. With sincere regards, Upananda --

Re: [R] Sorting within a dataframe Thank you

2014-10-31 Thread dodie
Thank you. Original Message Subject: Re: Sorting within a dataframe From: "jfzeac [via R]" < ml-node+s789695n4699000...@n4.nabble.com > Date: Thu, October 30, 2014 8:57 am To: dodie < do...@statcourse.com > Hi, a = data[order(data$x),] If you reply to this email, yo

Re: [R] lat/log to meter

2014-10-31 Thread eliza botto
Thankyou MacQueen and clint. I figured out. :)cheers, Eliza > From: macque...@llnl.gov > To: eliza_bo...@hotmail.com; r-help@r-project.org > Subject: Re: [R] lat/log to meter > Date: Fri, 31 Oct 2014 16:14:30 + > > see spTransform() in the sp package > (and ask on R-Sig-Geo) > > There is als

Re: [R] lappy and xts get all indexes from a list ?

2014-10-31 Thread Joshua Ulrich
I do this a few times in the blotter package. Try: Dates <- unique(do.call(c,c(lapply(foo, index), use.names=FALSE, recursive=FALSE))) On Fri, Oct 31, 2014 at 11:44 AM, ce wrote: > Dear all, > > I have a list , and I want to get all indexes ( dates ) of xts objects in > one list: > > foo<-lis

[R] lappy and xts get all indexes from a list ?

2014-10-31 Thread ce
Dear all, I have a list , and I want to get all indexes ( dates ) of xts objects in one list: foo<-list(A = xts(seq(2),seq(Sys.Date(),Sys.Date()+2,length.out=2)), B = xts(seq(1),seq(Sys.Date()-2,Sys.Date()-1,length.out=1)) ) > foo $A [,1] 2014-10-311 2014-11-022 $B

Re: [R] lat/log to meter

2014-10-31 Thread MacQueen, Don
see spTransform() in the sp package (and ask on R-Sig-Geo) There is also a function in one of the spatial-related packages to convert lat/long in dms format to decimal, but I don¹t remember its name. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 9455

[R] 3D scatterplot and agreement among three methods in the same subject

2014-10-31 Thread Mario Petretta
Dear all, I use R 3.1.1 for Windows. I would like to use three-dimensional scatterplots to evaluate the agreement among 3 laboratory methods in a set of 30 subjects (all subjects was evaluated with each of the three methods), using a line of best fit (slope and intercept) and the line of identity

Re: [R] lat/log to meter

2014-10-31 Thread Clint Bowman
Eliza, Would transforming to UTM coordinates work? Clint Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Jeff Newmiller
Since both of you seem to have misinterpreted my response, consider the following for clarification: A <- matrix(1:1000, 1000, 10) B <- A[1:100, ] # my recommended solution t1 <- system.time({match(as.data.frame(t(B)), as.data.frame(t(A)))}) # similar to John's recommended solution t2 <- system

[R] lat/log to meter

2014-10-31 Thread eliza botto
Dear UseRs,Is there a way in R to convert latitude and longitude in degree.minute.second to meter? (e.g. 45'55'')Thankyou very much in Advance,Eliza [[alternative HTML version deleted]] __ R-help@r-project.

Re: [R] Knitr: how to find out from within a .Rmd file the output type?

2014-10-31 Thread Hadley Wickham
Try knitr::opts_knit$get('rmarkdown.pandoc.to') Hadley On Fri, Oct 31, 2014 at 6:56 AM, Michal Kvasnička wrote: > Hi. > > Is there a way how to find out from within a .Rmd file what output format > is generated? > > The reason is this: I write a paper in R markdown in RStudio. Sometimes I > gene

Re: [R] Knitr: how to find out from within a .Rmd file the output type?

2014-10-31 Thread Jeff Laake - NOAA Federal
This has worked for me to choose the type of code to use to create tables whether it is pdf or hml/word doc.type <- strsplit(rmarkdown:::default_output_format("20141014_Regex_Rmarkdown.Rmd")$name,"_")[[1]][1] where you would use your .rmd filename in place of 20141014_Regex_Rmarkdown.Rmd I haven

Re: [R] Knitr: how to find out from within a .Rmd file the output type?

2014-10-31 Thread Michal Kvasnička
Yes, markdown is not LaTex. However, RStudio run pandoc that can convert markdown to HTML, LaTeX, Word, and many other markup (or almost markup) languages. The conversion to the first three mentioned works automatically in RStudio. But you are right in one thing: perhaps it is not a matter of knit

Re: [R] RForcecom VERY SLOW on large data sets

2014-10-31 Thread Grant Rettke
On Thu, Oct 30, 2014 at 8:10 AM, Ryszard Czermiński wrote: > For comparison exporting the same table as csv using "report export" in > SalesForce > takes about 1 minute. > > Any ideas why? and how to make it faster? One idea is to export to CSV and load it yourself. _

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread John Fox
Dear Jeff, For curiosity, I compared your solution with the one I posted earlier this morning (when I was working on a slower computer, accounting for the somewhat different timings for my solution): snip -- > A <- matrix(1:1, 1, 10) > B <- A[1:1000, ] > > system.

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Charles Novaes de Santana
Thank you, Jeff, for your message. I did a search, but maybe my problem was that I didn't know the correct way to search my problem (in other words: my vocabulary in R/English is not good). Because of this I choose to send a message to the list the most detailed as possible, and with a first solu

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Jeff Newmiller
Thank you for the reproducible example, but posting in HTML can corrupt your example code so please learn to set your email client mail format appropriately when posting to this list. I think this [1] post, found with a quick Google search for "R match matrix", fits your situation perfectly. m

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Charles Novaes de Santana
Great!! It is perfect! Thank you, John, for this elegant and fast suggestion! Best, Charles On Fri, Oct 31, 2014 at 2:35 PM, John Fox wrote: > Dear Charles, > > How about the following? > > --- snip - > > > AA <- as.list(as.data.frame(t(A))) > > BB <- as.list(as.data.frame(t(B

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread John Fox
Dear Charles, How about the following? --- snip - > AA <- as.list(as.data.frame(t(A))) > BB <- as.list(as.data.frame(t(B))) > which(AA %in% BB) [1] 4 5 --- snip - This seems reasonably fast. For example: --- snip - > A <- matrix(1:1, 1,

Re: [R] Knitr: how to find out from within a .Rmd file the output type?

2014-10-31 Thread Jeff Newmiller
AFAIK markdown is syntactically incompatible with LaTeX, except for math mode expressions. That is why we have separate extensions Rmd and Rnw for the two types of files. I don't know where one could successfully make use of the variable you are asking about.

Re: [R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Charles Novaes de Santana
My apologies, because I sent the message before finishing it. i am very sorry about this. Please find below my message (I use to write the messages from the end to the beginning... sorry :)). Dear all, I am trying to compare two matrices, in order to find in which rows of a matrix A I can find th

[R] Comparing matrices in R - matrixB %in% matrixA

2014-10-31 Thread Charles Novaes de Santana
A = matrix(1:10,nrow=5) B = A[-c(1,2,3),]; So > A [,1] [,2] [1,]16 [2,]27 [3,]38 [4,]49 [5,]5 10 and > B [,1] [,2] [1,]49 [2,]5 10 I would like to compare A and B in order to find in which rows of A I can find the rows of B. Somethin

Re: [R] How to update R without losing packages

2014-10-31 Thread Jeff Newmiller
Read the comments at the bottom of that blog post. Note that copying your packages library and updating only works for minor version upgrades... there is no shortcut for a 2.x to 3.x upgrade. That is not your biggest problem though, since not all packages seem to make the jump (become unavailab

Re: [R] How to update R without losing packages

2014-10-31 Thread S Ellison
> A solution on the link below provides the steps of updating R without losing > packages in Unix. > http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html > > How could I do that on windows 7 platform? See the R Windows FAQ, FAQ 2.8. ***

Re: [R] change default installation of R

2014-10-31 Thread S Ellison
> I want to change R-3.1.1 to the default, so that when I type which R, I get > /usr/local/R-3.1.1 Change your PATH to include the R 3.1.1 directory instead of the version 2 directory? S *** This email and any attachments are

[R] Knitr: how to find out from within a .Rmd file the output type?

2014-10-31 Thread Michal Kvasnička
Hi. Is there a way how to find out from within a .Rmd file what output format is generated? The reason is this: I write a paper in R markdown in RStudio. Sometimes I generate .html, sometimes .pdf. My paper presents a table of regression models using stargazer function. I've got the following cod

[R] How to update R without losing packages

2014-10-31 Thread Kuma Raj
A solution on the link below provides the steps of updating R without losing packages in Unix. http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html How could I do that on windows 7 platform? Thanks __ R-help@r-project.org mailin

Re: [R] R and Newest version of Java

2014-10-31 Thread Paul Bivand
After updating Java, I have to run R CMD javareconf. On Windows 64-bit, the java default updater has in the past removed the 64-bit version as it updates that wanted for 32-bit browsers. The 64-bit version needed reinstalling manually. Paul Bivand On 28 October 2014 18:43, Prof Brian Ripley wrot

[R] R 3.1.2 is released

2014-10-31 Thread Peter Dalgaard
The build system rolled up R-3.1.2.tar.gz (codename "Pumpkin Helmet") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.1.2.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries f

[R] MLE

2014-10-31 Thread Parvin Dehghani
HiI have a probability mass function similar to pr(N=n)= integral(((2-x)^n)*(exp(ax-2))) - integral (((5-ax)^n)),   both integrals are defined over the interval(0,2) with respect to x. I am going to estimate the parameter (a) with method of maximum likelihood estimation. The loglikelihood   is :