[R] tidyquant error downloading symbols for Index

2017-08-06 Thread Sparks, John James
Hi R Helpers, I recently tried to take advantage of the ability to download all the tickers in the S 500 using the functionality of tidyquant, but it threw an error. For summary, the set of commands that I ran was library(tidyquant) tq_index_options() tq_index("SP500") sessionInfo() R

[R] Looping Through QuantMod Objects

2017-08-02 Thread Sparks, John James
Dear R Helpers, I have run into a problem trying to perform a number of actions on a set of quantmod data objects through a loop and I am hoping that this is an easy problem for someone else as opposed to very difficult for me. The example task is to get the first three objects of the quarterly

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-18 Thread Sparks, John James
Bruce, Do you think that you could post the final solution to the problem? That way it would be stored with this thread and the next person who has the same problem would be able to locate the FINAL solution. --JJS On Mon, April 17, 2017 12:47 pm, BR_email wrote: > TO _ALL_: > THANK YOU.

[R] cforest Single Tree Output for Categorical Variable

2017-01-13 Thread Sparks, John James
Hello R Helpers, I am building a random forest using the cforest method in the party package. I then want to have a look at the characteristics of a few of the trees. I get the output for one of the trees by executing pt <- party:::prettytree(cforest@ensemble[[3]],

[R] Pull Stock Symbol Out of String

2014-04-08 Thread Sparks, John James
Dear R Helpers, My regex skills are beginner to intermediate and banging around the web has not resulted in a solution to the problem below so I hope that one of you who has mad skills can help me out. I want to extract the stock ticker--AMT-- out of the string American Tower Corporation

Re: [R] Grap Element from Web Page

2013-08-16 Thread Sparks, John James
prone to error. On Thu, Aug 15, 2013 at 12:48 PM, Sparks, John James jspa...@uic.eduwrote: Thanks so much for looking into this for me. Unfortunately, I get an error when I execute your code. Is there a library that you loaded that I haven't? require(scrapeR) require(XML) require(RCurl

Re: [R] Grap Element from Web Page

2013-08-14 Thread Sparks, John James
On Wed, Aug 14, 2013 at 1:34 PM, Sparks, John James jspa...@uic.edu wrote: Dear R Helpers, I would like to pull the CIK number from the web page http://www.sec.gov/cgi-bin/browse-edgar?CIK=MSFTFind=Searchowner=excludeaction=getcompany If you put this web page into your browser you

[R] Grap Element from Web Page

2013-08-13 Thread Sparks, John James
Dear R Helpers, I would like to pull the CIK number from the web page http://www.sec.gov/cgi-bin/browse-edgar?CIK=MSFTFind=Searchowner=excludeaction=getcompany If you put this web page into your browser you will see the CIK number in red on the left side of the page near the top. When I try

[R] T test for Single Mean

2013-06-19 Thread Sparks, John James
Dear R Helpers, I am stuck on some syntax and I thought that I was following one of the examples that I found out there quite faithfully. I just want to know how to do a t test on a single mean for whether or not it is greater than a specific value. So I am using the data set sleep and I want

[R] Refer to Data Frame Name Inside a List

2013-06-04 Thread Sparks, John James
Dear R Helpers, I have a fairly complicated list of data frames. To give you an idea of the structure, the top of the str output is shown below. How do I refer to the data.frame name for each data.frame in the list? That is, how can I pull the terms Advertising2007, AirFreightDelivery2007,

[R] Selecting A List of Columns

2013-05-17 Thread Sparks, John James
Dear R Helpers, I need help with a slightly unusual situation in which I am trying to select some columns from a data frame. I know how to use the subset statement with column names as in: x=as.data.frame(matrix(c(1,2,3, 1,2,3, 1,2,2, 1,2,2,

[R] To List or Not To List

2013-05-16 Thread Sparks, John James
Dear R Helpers, A few weeks ago I asked for some help on how to accomplish modifications to data in a set of data frames. As part of that request I mentioned that I realized that one way to accomplish my goal was to put the data frames together in a list but that I was looking for a way to do it

[R] Adding Column to Data Frames Using a Loop

2013-05-01 Thread Sparks, John James
Dear R Helpers, I am trying to do calculations on multiple data frames and do not want to create a list of them to go through each one. I know that lists have many wonderful advantages, but I believe the better thing is to work df by df for my particular situation. For background, I have

[R] Function for Data Frame

2013-04-29 Thread Sparks, John James
Dear R Helpers, I have about 20 data frames that I need to do a series of data scrubbing steps to. I have the list of data frames in a list so that I can use lapply. I am trying to build a function that will do the data scrubbing that I need. However, I am new to functions and there is

[R] Remove Rows Based on Factor

2013-04-15 Thread Sparks, John James
Dear R Helpers, I did a search for deleting rows based on conditions but wasn't able to find an example that addressed the error that I am getting. I am hoping that this is a simple syntax phenomenon that somebody else knows off the top of their head. My apologies for not providing a

[R] Create New Column Inside Data Frame for Many Data Frames

2013-04-14 Thread Sparks, John James
Dear R Helpers, I have a large number of data frames and I need to create a new column inside each data frame. Because there is a large number, I need to loop through this, but I don't know the syntax of assigning a new column name dynamically. Below is a simple example of what I need to do.

[R] Try Giving Invalid Argument Type Error

2012-05-19 Thread Sparks, John James
Dear R Helpers, I am getting an error message from the try function that I don't understand so I am hoping that someone can help. I am scraping from web pages, but sometimes they disappear. When that happens I need to control for it with some sort of function. This web page is parsed without a

Re: [R] quantmod getOptionChain Not Work

2012-04-08 Thread Sparks, John James
a 'good-enough' hack for now  # Also, what is table 9 on this page?  CALLS - optURL[[10]]  PUTS - optURL[[14]]  list(calls = CALLS, puts = PUTS, symbol = Symbols) } ### On Sun, Mar 4, 2012 at 2:18 PM, Sparks, John James jspa...@uic.edu

[R] quantmod getOptionChain Not Work

2012-03-04 Thread Sparks, John James
Dear R Helpers, I am still having trouble with the getOptionChain command in quantmod. I have the latest version of quantmod, etc. so I was under the impression that the problem was solved with updates to the package. If someone could let me know what I need to install in order to make this

[R] Trouble with Paste and Quotes and List Objects

2011-06-18 Thread Sparks, John James
Dear R Helpers, I have a list that contains a number of objects, each of them financial statement data from quantmod (although I don't think that knowledge of quantmod is necessary to help with this problem). str(listfinobj) chr [1:4815] A.f AA.f AACC.f AAME.f AAN.f AAON.f AAP.f AAPL.f AAT.f

[R] Trouble Combining With Paste

2011-05-25 Thread Sparks, John James
Dear R Helpers, I am having trouble combining some pieces of programming that work fine individually, but fall down when I try to get them to work together. The end goal is to take a data frame, and if any of the variables has more than 10 values, then use cut2 to reduce the number of

[R] Thiel's Uncertainty Coefficient

2011-05-25 Thread Sparks, John James
Dear R Helpers, I was looking at the email help threads in trying to find a calculation in R of Thiel's uncertainty coefficient. One of the writers offered to send the function in custom code to the inquirer. Can I get a copy of that code, or does anyone know if the calculation is now available

[R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Sparks, John James
Dear R Helpers, First, I apologize for asking for help on the first of my topics. I have been looking at the posts and pages for apply, tapply etc, and I know that the solution to this must be ridiculously easy, but I just can't seem to get my brain around it. If I want to produce a set of

[R] Apply or Tapply to Build Set of Tables

2011-05-23 Thread Sparks, John James
Dear R Helpers, First, I apologize for asking for help on the first of my topics. I have been looking at the posts and pages for apply, tapply etc, and I know that the solution to this must be ridiculously easy, but I just can't seem to get my brain around it. If I want to produce a set of

Re: [R] Find String Between Characters

2011-05-15 Thread Sparks, John James
you want: mmm-http://www.sec.gov/cgi-bin/browse-edgar?action=getcompanyCIK=320193owner=excludecount=40; num - sub(^.*CIK=([0-9]+).*, \\1, mmm) num [1] 320193 On Sat, May 14, 2011 at 8:20 PM, Sparks, John James jspa...@uic.edu wrote: Dear R Helpers, I am trying to isolate a set

[R] Changing Attribute With Paste

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to adjust the attribute of an R object pulled from quantmod. Since I want to do this for many such objects, I was trying to make the adjustment programmatic. Unfortunately, I am having a huge amount of trouble using attr in combination with paste (and perhaps get,

[R] Identify Objects that end with .f (and all caps)

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to find a way to identify all the objects in my environment that are all caps and then end with .f. I can do the all caps part pretty easily, but I have tried a number of variations on the \ and can't get a recognition of that operator. As a simple example A.f-foo1

[R] Find String Between Characters

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to isolate a set of characters between two other characters in a long string file. I tried some of the examples on the R help pages and elsewhere, but I am not able to get it. Your help would be much appreciated. require(scrapeR)

[R] If Then Trouble

2011-04-24 Thread Sparks, John James
Dear R Helpers, I have another one of those problems involving a very simple step, but due to my inexperience I can't find a way to solve it. I had a look at a number of on-line references, but they don't speak to this problem. I have a variable with 20 values table (testY2$redgroups) 1

[R] Assign Character Value to Data Frame

2011-04-12 Thread Sparks, John James
Dear R Helpers, I am trying to write a character value to the row of a data frame and am running into a problem that I don't have when I do this for numeric arguments. For example, the following works just fine: test-data.frame(number=numeric(1)) test[1,]-.5 test number 10.5 But the

[R] Assign with Paste Problem

2011-04-12 Thread Sparks, John James
Dear R Helpers, I am trying to change the name of an object using the assign function. When I use paste on the new object but not the old, everything is fine: The new object is a direct copy of the old object. When I use a paste for both the new and the old object, however, the new object is

[R] Replacing Period in String

2011-03-20 Thread Sparks, John James
Dear R Users, I am working with gsub for the first time. I am trying to remove some characters from a string. I have hit the problem where the period is the shorthand for 'everything' in the R language when what I want to remove is the actual periods. In the example below, I simply want to

[R] quantmod Some Single Letter Tickers Not getFin

2011-03-17 Thread Sparks, John James
Hi, I have been learning the quantmod package over the last several days. I went to check some of my data pulls against other sources and was surprised to find that a few tickers that have single characters do not successfully scrape from Google Finance using getFin(). Particularly

[R] Set a Numeric Field To Blank

2011-02-08 Thread Sparks, John James
Hi, I have one of those questions that I suspect is very simple, but hard to classify, so I have been searching for quite some time and am not able to find it. If I have a data frame and I want to change all the values of one of the columns to blanks, what is the syntax? I tried a few different

[R] Picking Part of Large R Object

2010-08-01 Thread Sparks, John James
Dear All, I have imported an HTML document to R (called tables) and wish to select certain pieces of it for processing. The first few lines of the object appear as follows: tables [[1]] table id=fs-table class=gf-table rgt thead trth class=lm lft nwp In Millions of USD (except for per

[R] ScrapeR Unanticipated XML objects

2010-08-01 Thread Sparks, John James
Dear All, I have come across a very surprising result as I have started to learn how to use R to pull data from the web for analysis. I am trying to isolate that table headers for the quarterly income statement (qtrinc) that I pulled from Google finance. I executed the following commands after