[R] Manipulate stock market data in R

2013-09-03 Thread Ira Sharenow
I am trying to manipulate data that an analyst has given me. What are the best possible libraries? I will have to solve many questions that another analyst will ask over time. The first is to compare predictions to actual prices. Predictions are made every day for every stock. For the last five

Re: [R] tm::stemDocument function not work

2013-09-03 Thread Pascal Oettli
Hello, Your example worked for me. R> sessionInfo() R version 3.0.1 Patched (2013-09-02 r63805) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_G

Re: [R] R CMD check Note: Non-standard file found at top level

2013-09-03 Thread S Subramanian
Thank you for the replies. As Prof Brian Ripley mentioned, in my case, (I was using the latest r devel) and "R CMD build pkgname" indeed put a directory called build with a file named vignette inside it. So I tried "R CMD build --no-build-vignettes pkgname" and the problem got solved. Thanks agai

[R] tm::stemDocument function not work

2013-09-03 Thread Ricardo Pietrobon
https://gist.github.com/rpietro/6430771 stemDocument function doesn't seem to be working. Tried to look up and a few people have reported the problem, but no solution that I could find. would appreciate any help __ R-help@r-project.org mailing list htt

Re: [R] Having problems with doing anything with my data sets

2013-09-03 Thread maxzakh
I really appreciate all the help and I am sorry that I did not post enough clarifying details. Turns out all that was wrong was the type of separator, I needed to use commas instead of white space haha. -- View this message in context: http://r.789695.n4.nabble.com/Having-problems-with-doing-an

Re: [R] Error in Parts of Speach Tagging using openNLP

2013-09-03 Thread David Winsemius
This was also posted on StackOverflow. Crossposting to R-help is discouraged. You are encouraged to read the Posting Guide and to learn how to post from gmail using plain text. -- David. On Sep 3, 2013, at 10:15 AM, Siddharth Arun wrote: > I have an Ubuntu Quantal 12.10 Server 64-bit instanc

Re: [R] How to assign names to global data frames created in a function

2013-09-03 Thread David Winsemius
On Sep 3, 2013, at 7:19 AM, Matt Strauser wrote: > I have several data frames containing similar data. I'd like to pass these > data frames to a function for processing. The function would create newly > named "global" data frames containing the processed data. I cannot figure > out how to assign

Re: [R] summary(object) not showing all values of a factor

2013-09-03 Thread Bert Gunter
These are **not** odd results. You just don't understand how linear models work, in particular, you need to understand contrasts for categorical factors. As this is not the place for a statistics tutorial, I suggest you read up on linear models or consult a local expert. Cheers, Bert On Tue, Se

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Hadley Wickham
>> It was my understanding that package authors are responsible for not >> breaking other CRAN packages without warning. For example, before I >> release a new version of plyr or ggplot2, I run R CMD check on every >> package that depends on my package. I then let the maintainers know if >> someth

[R] Contributing to R

2013-09-03 Thread Aleksey Vorona
Hi all, Could anyone describe what is the proper way to contribute to R? So far I was going over r-bugs and trying to write patches for bugs I can fix. My questions is should I also send an email to somebody? It seems that for some old bugs Bugzilla does not send emails. For example, I went over

Re: [R] [dfoptim] 'Error in fn(ginv(par), ...) : object 'alpha' not found'

2013-09-03 Thread Simon Zehnder
Hi Carlos, your problem is a wrong definition of your Likelihood function. You call symbols in the code (alpha, beta) which have no value assigned to. When L the long calculation in the last lines is assigned to L alpha and beta do not exist. The code below corrects it. But you have a problem w

Re: [R] R CMD check Note: Non-standard file found at top level

2013-09-03 Thread Hadley Wickham
The note is telling you that you usually shouldn't have a file called build in the top level of your package. What's in the file and why is it there? Hadley On Tue, Sep 3, 2013 at 10:01 AM, S Subramanian wrote: > My R CMD check pkgname and R CMD build pkgname run without any notes or > warnings

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Ben Bolker
Hadley Wickham gmail.com> writes: > > >> It was my understanding that package authors are responsible for not > >> breaking other CRAN packages without warning. For example, before I > >> release a new version of plyr or ggplot2, I run R CMD check on every > >> package that depends on my packag

Re: [R] How to assign names to global data frames created in a function

2013-09-03 Thread Greg Snow
This is FAQ 7.21. The most important part of that FAQ is at the end where it says it is best not to do this and better to use lists. Having a function create (overwrite) objects in the global environment is dangerous and can lead to hard to find bugs. It would be better to have your function ret

Re: [R] Contributing to R

2013-09-03 Thread Ben Bolker
Aleksey Vorona gmail.com> writes: > > Hi all, > > Could anyone describe what is the proper way to contribute to R? So > far I was going over r-bugs and trying to write patches for bugs I can > fix. My questions is should I also send an email to somebody? > > It seems that for some old bugs Bug

Re: [R] Multivariate discrete HMMs

2013-09-03 Thread Rolf Turner
I am not familiar with the RHmm package, but in theory there should be no problem with discrete multivariate observations. However, in general in order to fit an HMM you need to specify a family of ***distributions*** for your observations (one distribution for each of the hidden states). Usuall

Re: [R] How to assign names to global data frames created in a function

2013-09-03 Thread arun
Hi, May be this helps you in getting started. set.seed(29)  df1<- as.data.frame(matrix(sample(1:20,5*10,replace=TRUE),5,10))  cond<- c("V1eq2","V8eq2","V6eq4orV8eq7") fun1<- function(df,prefix,cond){ lst1<- list(df[df$V1==2,],df[df$V8==2,],df[df$V6==4|df$V8==7,]) for(i in seq_along(cond)){  as

Re: [R] Assessing temporal correlation in GAM with irregular time steps

2013-09-03 Thread Worthington, Thomas A
Dear Gavin Thank you for the very detailed response. I had started to go down the route of fitting a correlation structure via gamm. I tried applying your code to my data but returned the error "Error in corCAR1(~ID | SiteCode1971) : parameter in CAR(1) structure must be between 0 and 1" I

Re: [R] optim evils

2013-09-03 Thread Rolf Turner
I don't think anyone can do much to help you unless you show us (a) your objective function "OF" and your starting value for "pars" --- which I do not see in your posting. Examples should be ***reproducible***!!! My personal experience with optim() has always been very good. cheers,

Re: [R] R CMD check Note: Non-standard file found at top level

2013-09-03 Thread Prof Brian Ripley
On 03/09/2013 21:50, Hadley Wickham wrote: The note is telling you that you usually shouldn't have a file called build in the top level of your package. What's in the file and why is it there? Under some circumstances R CMD build puts files in a directory called 'build', and in the last couple

[R] summary(object) not showing all values of a factor

2013-09-03 Thread Soumitro Dey
Dear all, I am encountering some odd results from the summary(object) command for coxph and hurdle models. In both cases the result of summary(object) function leaves out one of the categories of a categorical variable used in the model. It is typically the first category if sorted alphabetically.

[R] Having problems with doing anything with my data sets

2013-09-03 Thread maxzakh
I just installed R on my computer but I have greatly reduced functionality. For instance, when I import a data set, I cannot do anything to it: number summaries, any means tests, variance, etc. Literally all of the options that should be there are not. Can anyone help? I am so lost! -- View this

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Gabor Grothendieck
On Tue, Sep 3, 2013 at 10:49 AM, Kevin Wright wrote: > I have a package with more than 100 datasets, each of which has an > \examples{} section. On the plus side, these example test the "R > ecosystem" to make sure that everything is working (both my package and > others' packages). On the down

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Yihui Xie
Well, there is always trade-off. You can reinvent the whole universe so that it is well under your control, or stand on other people's shoulders and take the risk that they may fall one day. It is tricky to decide how much one should depend on others. I absolutely agree that automatic testing is a

Re: [R] remove rows with infinite/nan values from a zoo dataset

2013-09-03 Thread arun
Hi, No problem. In my previous post, I showed how to dput() your example dataset.  Please use dput() in the future. vec1<- c(3.369247e-04,0.00e+00,9.022183e-04,0.00e+00,-1.105819e-04,-Inf,1.191271e-04,1.681718e-04,NaN,1.150126e-04,1.031037e-03,2.710993e-04) indx<-seq(as.Date("2009-09-0

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Duncan Murdoch
On 03/09/2013 1:53 PM, Hadley Wickham wrote: > As a user of your package, I would find it irritating if example(foo) didn't > run anything. It would be more irritating (and would indicate sloppiness > on your part) if the examples failed when I cut and pasted them. These both > suggest leaving

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Hadley Wickham
> As a user of your package, I would find it irritating if example(foo) didn't > run anything. It would be more irritating (and would indicate sloppiness > on your part) if the examples failed when I cut and pasted them. These both > suggest leaving the examples running. > > As the author of you

Re: [R] Setting up 3D tensor product interactions in mgcv

2013-09-03 Thread Gavin Simpson
>From a reading of `?ti` It is sometimes useful to investigate smooth models with a main-effects + interactions structure, for example f_1(x) + f_2(z) + f_3(x,z) This functional ANOVA decomposition is supported by ‘ti’ terms, which produce tensor pro

Re: [R] Assessing temporal correlation in GAM with irregular time steps

2013-09-03 Thread Gavin Simpson
It is possible, but you can't use the discrete time or classical stochastic trend models (or evaluate using the ACF). Also, why do you care to do this with regard to DoY? The assumption of the model relates to the residuals, so you should check those for residual autocorrelation. As you are using

Re: [R] Having problems with doing anything with my data sets

2013-09-03 Thread Roy Mendelssohn - NOAA Federal
Hi: I know that it is frustrating when something like what you describe occurs, but realize that it is also frustrating for anyone on the list to try and help you, because there is no information to go on. What would help is information like: 1. Your OS and version 2. How you did the inst

Re: [R] Having problems with doing anything with my data sets

2013-09-03 Thread Sarah Goslee
Hi, Unless you've installed some sort of add-on GUI, R is a command-line-driven environment. Once you've imported your dataset (with read.table most commonly, but you don't give us enough information to know what you're doing), then an entire universe of commands is open to you, like summary(myda

[R] Permuting friendship nominations in a social network

2013-09-03 Thread hollymaya
I have a dataset of dyads (an edgelist) representing friendship nominations between egos and their nominated alters. The network is undirected so if ego is connected to alter, then there is a separate observation in the dataset for the reverse. I would like to randomly permute the friendships s

[R] Error in Parts of Speach Tagging using openNLP

2013-09-03 Thread Siddharth Arun
I have an Ubuntu Quantal 12.10 Server 64-bit instance. I am using openNLP for POS Tagging of sentences. I am using POS tagging using openNLP with “Parallel Lapply setup”. It is running fine in RStudio environment. But in Ubuntu environment it is showing the following error. *Error in do.call(c,

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Duncan Murdoch
On 03/09/2013 1:02 PM, Yihui Xie wrote: But "don't use those packages that cause you trouble" implies you will have to reinvent and maintain all the wheels by yourself? Isn't that a better alternative than having examples that don't work? What I do for long/complicated/time-consuming examples

[R] ANN: Course Data Mining with R in Spain

2013-09-03 Thread Soledad De Esteban Trivigno
Dear colleague: Registration is open for the course CLASSIFICATION AND REGRESSION TREES AND NEURAL NETWORKS WITH R - Second Edition. INSTRUCTORS: Dr. Llorenç Badiella (UAB, Spain), Dr. Joan Valls  (Biomedical Research Institute of Lleida, Spain) and Dr. Montserrat Martínez-Alonso (Biomedical Rese

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Yihui Xie
But "don't use those packages that cause you trouble" implies you will have to reinvent and maintain all the wheels by yourself? What I do for long/complicated/time-consuming examples is I move them to package websites or separate repositories. For example, I started to use Vistat to show examples

[R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Kevin Wright
I have a package with more than 100 datasets, each of which has an \examples{} section. On the plus side, these example test the "R ecosystem" to make sure that everything is working (both my package and others' packages). On the down side, changes in this ecosystem have caused repeated NOTEs and

[R] R CMD check Note: Non-standard file found at top level

2013-09-03 Thread S Subramanian
My R CMD check pkgname and R CMD build pkgname run without any notes or warnings or errors. However when i run R CMD check --as-cran-pkgname_version.tar.gz, i get the following note: * checking top-level files ... NOTE Non-standard file found at top level: 'build' Everything else is ok. What

[R] How to assign names to global data frames created in a function

2013-09-03 Thread Matt Strauser
I have several data frames containing similar data. I'd like to pass these data frames to a function for processing. The function would create newly named "global" data frames containing the processed data. I cannot figure out how to assign names to the data frames in Step 1 or Step 2 in the follow

[R] The new "rockchalk" R package (Free Webinar)

2013-09-03 Thread Ray DiGiacomo, Jr.
Hello R Users, Are you interested in making your regression analysis in R easier to explain to your colleagues and customers? This free one-hour webinar will provide a general introduction to rockchalk, an R package that provides a collection of functions that ease the presentation and interpreta

Re: [R] Rows with positive values

2013-09-03 Thread arun
Hi, set.seed(285) dat1<- as.data.frame(matrix(sample(c(-3:30),10*100,replace=TRUE),ncol=10)) dat2<- dat1[!rowSums(dat1<0),] head(dat1,3) #  V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 #1 21 19 16 24 11 -1  4 13 18  -3 #2  3 13 13 29 16 29 16 18 12  12 #3 13 22 14 25  9 19 13 30  6   6 head(dat2,3) #   V1 V2

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Duncan Murdoch
On 03/09/2013 10:49 AM, Kevin Wright wrote: I have a package with more than 100 datasets, each of which has an \examples{} section. On the plus side, these example test the "R ecosystem" to make sure that everything is working (both my package and others' packages). On the down side, changes in

[R] Error in Parts of Speach Tagging using openNLP

2013-09-03 Thread Siddharth Arun
I have an Ubuntu Quantal 12.10 Server 64-bit instance. I am using openNLP for POS Tagging of sentences. I am using POS tagging using openNLP with “Parallel Lapply setup”. It is running fine in RStudio environment. But in Ubuntu environment it is showing the following error. *Error in do.call(c,

Re: [R] Parts of Speach Tagging

2013-09-03 Thread Siddharth Arun
Thanks Tyler. It helped. On Sun, Aug 25, 2013 at 11:10 AM, Tyler Rinker wrote: > Have a look at ?Maxent_POS_Tag_Annotator The examples show you how to get > the tagPOS behavior. > > Cheers, > Tyler > > > Date: Sun, 25 Aug 2013 04:11:33 +0530 > > From: sid.aru...@gmail.com > > To: r-help@r-proje

Re: [R] Writing list into csv file

2013-09-03 Thread arun
Hi, Please use dput() to show the example dataset: Not sure this matches with your original example though.. lst1<- structure(list(Contrasts = structure(list(linear = c(-0.437, -0.378, -0.201, 0.271, 0.743), emax1 = c(-0.799, -0.17, 0.207, 0.362, 0.399), emax2 = c(-0.643, -0.361, 0.061, 0.413

Re: [R] reading files

2013-09-03 Thread arun
HI, ?list.files() list.files()  #created 4 files in my working directory #[1] "A_hubs.txt"    "A_nonhubs.txt" "B_hubs.txt"    "B_nonhubs.txt" #If you want to do wilcox.test in a pairwise manner: combn(list.files(),2) # [,1]    [,2] [,3]    [,4]   #[1,] "A_

Re: [R] Multiple regression (with interactions) by hand

2013-09-03 Thread Christoph Scherber
Dear all, But why are there such huge differences betwen solve() and ginv()? (see code below)? ## m1=lm(Ozone~Solar.R*Wind,airquality) # remove NA´s: airquality2=airquality[complete.cases(airquality$Ozone)& complete.cases(airquality$Solar.R)& complete.cases(airquality$Wind),] # create the mode

[R] ESEM in R

2013-09-03 Thread fronczyk
Hello R experts, Is there any possibility to perform exploratory structural equation modeling (ESEM) in R? Which package should I use? Thanks a lot for help, Krzysztof __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PL

[R] optim evils

2013-09-03 Thread Michael Meyer
Greetings, I am in great anguish as the routine stats::optim shows unexplicable behaviour of various sorts. For one it is immune to the choice of optimization method and seems to always do the same. The following trace log N = 21, M = 5 machine precision = 2.22045e-16 At X0, 0 variables are ex

[R] Enquiry for applying Self-Organizing Map for Time Series Prediction in R

2013-09-03 Thread YoungrangKang
Dear Sir/Madam Hi, my name is Youngrang Kang and I have started to study R for about a few months ago. I have used some Time Series Prediction (TSP) Models in R and I have found an interesting TSP Model, which is Self-Organizing Map(SOM) for TSP. I have read the articles on the R Package ¡®SOM

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread PIKAL Petr
Hi one option is use embed fff<-function(vec, n=3) apply(embed(vec,n),1,prod) apply(A,2, fff) Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Edouard Hardy > Sent: Tuesday, September 03, 2013 9:34 AM > To: R

Re: [R] Legend Help

2013-09-03 Thread PIKAL Petr
Hi put line legend("topright", legend=names(a)[3:9], lty=1, col=3:9) before dev.off() see ?legend for fine tuning. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Ma Teresa Martinez Soriano > Sent: Tuesday, S

[R] new bugs and new bundles Re: [Rd] R/Sweave/cairo/freetype bug fix.

2013-09-03 Thread Hin-Tak Leung
The most up-to-date version of freetype (2.5.0.1) have problems with at least two of the system fonts shipped with Mac OS X. So the "p1" in "2.5.0.1p1": cairo-1.12.16+freetype-2.5.0.1p1_macosx.tar.bz2 cairo-1.12.16+freetype-2.5.0.1p1_windows.tar.bz2 means "2.5.0.1" + 274207eb9a0e3bb20edf30e9a62

[R] reading files

2013-09-03 Thread anupam sinha
Dear all, I need help with some coding. I have a directory with files like these: A_hubs A_nonhubs B_hubs B_nonhubs : : Each of these files have the following header and content: GENE TIS_DEG TOT_SVTIS_SVTIS_DISO ensg1 20 12 4 40 . . and so on..

Re: [R] POSIXlt and months

2013-09-03 Thread Gabor Grothendieck
On Tue, Sep 3, 2013 at 7:31 AM, Terry Therneau wrote: > The help page for as.POSIXlt suggests using it as a way to extract month, > day, and year. > However, I can't find any documentation on the results and am a bit > surprised by the month portion. > > An example, run about 6:21 AM on Sept 3. >

[R] POSIXlt and months

2013-09-03 Thread Terry Therneau
The help page for as.POSIXlt suggests using it as a way to extract month, day, and year. However, I can't find any documentation on the results and am a bit surprised by the month portion. An example, run about 6:21 AM on Sept 3. > unlist(unclass(as.POSIXlt(Sys.time( sec min

[R] [dfoptim] 'Error in fn(ginv(par), ...) : object 'alpha' not found'

2013-09-03 Thread Carlos Nasher
Dear R helpers, I have problems to properly define a Likelihood function. Thanks to your help my basic model is running quite well, but I have problems to get the enhanced version (now incorporating covariates) running. Within my likelihood function I define a variable 'alpha'. When I want to opt

Re: [R] help

2013-09-03 Thread Terry Therneau
The tt function is documented for coxph, and you are using cph. They are not the same. On 09/03/2013 05:00 AM, r-help-requ...@r-project.org wrote: tt<- function(x) { obrien<- function(x) { r<- rank(x) (r - 0.5)/(0.5 + length(r) - r)

Re: [R] Multiple regression (with interactions) by hand

2013-09-03 Thread Joshua Wiley
Hi Christoph, Use this matrix expression instead: solve(crossprod(X)) %*% t(X) %*% Y Note that: all.equal(crossprod(X), t(X) %*% X) Cheers, Joshua On Tue, Sep 3, 2013 at 2:51 AM, Christoph Scherber wrote: > Dear all, > > I´ve played around with the "airquality" dataset, trying to solve th

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Gerrit Eichner
Ok, here is a bandmatrix solution "by hand": leftmatrix <- matrix( c( rep( 1, k), rep( 0, nrow(A) - k + 1)), byrow = TRUE, ncol = nrow(A), nrow = nrow(A) - k + 1) Gerrit Thank you very much for your answer. Unfortunately, I cannot use any package... Er, ... this is qui

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Gerrit Eichner
Thank you very much for your answer. Unfortunately, I cannot use any package... Er, ... this is quite unusual! (Is this is homework?) Do you have a solution ? Well, take a look at the resulting bandmatrix leftmatrix. Yould can certainly build it yourself "by hand" somehow. I used the Matrix pa

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Edouard Hardy
Thank you very much for your answer. Unfortunately, I cannot use any package... Do you have a solution ? Thank you in advance Edouard Hardy On Tue, Sep 3, 2013 at 11:49 AM, Gerrit Eichner < gerrit.eich...@math.uni-giessen.de> wrote: > Hello, Edouard, > > taking logs of A's elements (so that *

[R] Multiple regression (with interactions) by hand

2013-09-03 Thread Christoph Scherber
Dear all, I´ve played around with the "airquality" dataset, trying to solve the matrix equations of a simple multiple regression by hand; however, my matrix multiplications don´t lead to the estimates returned by coef(). What have I done wrong here? ## m1=lm(Ozone~Solar.R*Wind,airquality) # re

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Gerrit Eichner
Hello, Edouard, taking logs of A's elements (so that * turns into +, so to say), using a left-multiplication with a certain band matrix of the package Matrix, and exponentiating the result again could provide a solution (see below). I know have the following problem: I have a matrix : A = 1

[R] Legend Help

2013-09-03 Thread Mª Teresa Martinez Soriano
Hi to everyone and thanks for this service. I have a doubt with legend, I have seen ?legend, but I don't get the way to write in my code the legend that I want, This is my code: for( i in 1:4)} pdf(paste("plotImputed", i,".pdf",sep="")) plot(a[,6], type="l", main=paste( "I

[R] Product of certain rows in a matrix without loop

2013-09-03 Thread Edouard Hardy
Hello everybody. Thank you again to Bert and Arun for their help on my previous question. I know have the following problem: I have a matrix : A = 1 2 3 4 5 6 7 8 9 9 8 7 4 5 6 3 2 1 And I would like to have : B = 1*4*7 2*5*8 3*6*9 4*7*9 5*8*8 6*9*7 7*9*4 8*8*5 9*7*6 9*4*3 8*5*2

Re: [R] Question about the prediction plot in pls package

2013-09-03 Thread Euna Jeong
Thank you very much! On Tue, Sep 3, 2013 at 3:18 PM, Bjørn-Helge Mevik wrote: > Euna Jeong writes: > > > R> plot(gas1, ncomp=2, asp = 1, line = TRUE) > > > > This shows only the cross-validated predictions. > > If you add the argument which = c("train", "validation") (see > ?predplot.mvr), you