Re: [R] finding components of an API

2017-05-28 Thread Robert Sherry
Erin, I do not think there is an R package that will enable you to get the data you would like from spotcrime.com. You could write code, in R, or some other language, to extract the data you want but that is going to be a changeling task and if the website changes its format then your code

Re: [R] lines those not started with "rs"

2017-01-30 Thread Robert Sherry
then my solution should work. Bob On 1/30/2017 9:44 AM, greg holly wrote: > Hi Robert; > > I do appreciate your advice. Only the first column of the data is > text. The rest columns are numeric. > > Regards, > > Greg > > On Mon, Jan 30, 2017 at 9:36 AM, Rober

Re: [R] lines those not started with "rs"

2017-01-30 Thread Robert Sherry
Greg, I am assuming that your data is in a text file. R is a good tool but not the tool I would use for this job. The tool I would use is grep. The following command should get you want you want: grep -v "^rs" Bob On 1/30/2017 9:23 AM, greg holly wrote: Hi all; I have a file

Re: [R] (no subject)

2017-01-30 Thread Robert Sherry
Here is one thought. Assign each month a value of 0, 1 or 2. Then do a simple linear regression analysis where the value of the month is the independent variable. You can also do multiple linear regression with the value you assigned to the month plus the other factors that you believe are

Re: [R] for loop in R

2017-01-12 Thread Robert Sherry
I only see one for loop in your code. I am wondering if you want a second for loop based upon the length of newdata. I would also think that you do not need the second call to set.seed. Bob On 1/12/2017 4:44 PM, Jennifer Sheng wrote: Dear friends, I am working on a double loop using for.

Re: [R] How to speed up my program

2016-04-01 Thread Robert Sherry
Hi Ragia, First, when you wrote mad, I assume you mean made. Also, when you say it is a multi core prog, does that mean it is using threads? running two or more items in parallel? By any chance are you using this package?

Re: [R] Open source project that needs performance optimizations

2016-03-27 Thread Robert Sherry
I am not up on the internals of R but there does seem some run for parallelism. Are we talking about special hardware? or running this on an Intel Box? If it is the second, then I am thinking threads would be the way to go. Please consider the following R statements: for( i in 1:30 )

Re: [R] Double AND within an IF statement

2016-02-24 Thread Robert Sherry
This should work: if ( age > 4 && age < 8 && infection > 0 ) replacement = 2 Bob On 2/24/2016 7:08 AM, Polychronis KOSTOULAS wrote: Hi there, apologies if this is easy. I want to write this condition: If age is more than 4 years and less or equal to 8 years and infection is positive

[R] Variable Argument Function

2016-02-07 Thread Robert Sherry
I would like to write a function in R that would take a variable number of integers as parameters. I do not have a pressing reason to do this, I am just trying to learn R. I thought a good first step would be to print out the arguments. So I wrote the following function: f1 = function (...)

Re: [R] Variable Argument Function

2016-02-07 Thread Robert Sherry
; } It does not use nested functions and it works also. Is there a reason why your solution is better? Bob On 2/7/2016 7:14 PM, Ben Tupper wrote: Hi, On Feb 7, 2016, at 6:24 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: On 07/02/2016 6:12 PM, Robert Sherry wrote: I would lik

Re: [R] Sorting a Data Frame

2016-01-26 Thread Robert Sherry
AM, S Ellison wrote: On 23.01.2016 01:21, Robert Sherry wrote: In R, I run the following commands: df = data.frame( x=runif(10), y=runif(10) ) df2 = df[order(x),] You use another x from your workspace, you actually want to df2 = df[order(df[,"x"]),] or df[order(df$x),]

Re: [R] R-help mailing list activity / R-not-help?

2016-01-24 Thread Robert Sherry
I think this mailing list is wonderful and it has helped me a lot. In fact, I am not sure I would be using R today if it was not for this list. Bob On 1/24/2016 4:42 PM, Michael Friendly wrote: On 1/23/2016 7:28 AM, Jean-Luc Dupouey wrote: Dear members, Not a technical question: But one

[R] Sorting a Data Frame

2016-01-22 Thread Robert Sherry
In R, I run the following commands: df = data.frame( x=runif(10), y=runif(10) ) df2 = df[order(x),] The first, as I would expect, creates a data frame with two columns and 10 rows. I expect the second to sort the data based upon the columns x and produce a new data frame, df2, with the

[R] F Distribution

2015-12-21 Thread Robert Sherry
When I use a table, from a Schaum book, I see that for the 95 percentile, with v_1 = 1 and v_2 = 1 the value is 161. In the modern era, looking values up in a table is less than ideal. Therefore, I would expect R to have a function to do this and based upon my reading of the documentation, I

Re: [R] not allocate of vactor size

2015-11-22 Thread Robert Sherry
I am thinking that R is running out of memory. Therefore, I would look to increase the size of my virtual memory. Here are two links that might help you with that: http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7

[R] QuantMod and XML

2015-11-07 Thread Robert Sherry
I am trying to use the package quantmod to get option quotes in R. Therefore, I executed the following two commands: library ("quantmod" ) getOptionChain("AAPL") The first one worked but the second one produced the following error message: Error in

Re: [R] QuantMod and XML

2015-11-07 Thread Robert Sherry
ckage ‘RSXML’ is not available (for R version 3.1.2) I am wondering why it is not work. Please help. Thanks Bob On 11/7/2015 6:41 PM, Hasan Diwan wrote: > Bob, > > On 7 November 2015 at 15:27, Robert Sherry <rsher...@comcast.net > <mailto:rsher...@comcast.net>> wrote: &g

[R] Working with Data Frames

2015-11-03 Thread Robert Sherry
I have created what I believe to be a data frame. It is called env1$SPY. The r statement head( env1$SPY ) produces the following output: SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted 1995-01-03 45.7031 45.8437 45.6875 45.7812 324300 31.55312 1995-01-04 45.9843

Re: [R] Interview questions?

2015-01-11 Thread Robert Sherry
Here is a question that I might ask. What are the alternatives to R and how does R compare? That is, for what class of problems is R the best tool around? Bob On 1/11/2015 1:16 PM, Barry Rowlingson wrote: Ask if they have a favourite R programmer. This will tell you how much into the R

[R] Help Getting the Price of Gold

2014-10-23 Thread Robert Sherry
I am trying to get the current price of gold for my application. I am using the library quantmod. The R commands I use are: getMetals(c('XAU'), from=Sys.Date(), autoassign = FALSE ) XAUUSD$XAU.USD[1,1] I would expect the value in XAUUSD$XAU.USD[1,1] to be a scalar but it comes back

[R] Problem getting Option Quotes

2014-10-23 Thread Robert Sherry
I am using R and quantmod to get stock and option quotes. However, it has stopped working. I expect the following function call to produce a list of options: getOptionChain( XOM, Exp = 2015-01-20 ) However, I get the following error messages: Error in lapply(strsplit(opt, tr),

[R] Using R to Compute Covariance

2014-07-26 Thread Robert Sherry
I have the following data set: xy p 11 1/2 22 1/4 39 1/4 In this case, p represents the probability of the values occurring. I compute the covariance of x and y by hand and come up with a value of 41/16. When computing the covariance, I am

Re: [R] Using R to Compute Covariance

2014-07-26 Thread Robert Sherry
David, Thanks for the response. I believe you have solved my problem. Bob On 7/26/2014 3:50 PM, David Winsemius wrote: On Jul 26, 2014, at 11:07 AM, Robert Sherry wrote: I have the following data set: xy p 11 1/2 22 1/4 39 1/4

[R] Correlation

2014-07-16 Thread Robert Sherry
Please consider the following R Script: x = c(1,2,3) y = c(1,2,9) cor(x,y) These three lines will produce, as I expected, the correlation between the variables x and y. However, R is going to assume that the probability that x = 1 is the same as the probability that x = 2.

[R] A Question about read.table and Data Frames in R

2014-06-29 Thread Robert Sherry
I created the following file: symbol,shares XOM,1000 APA,400 CVX,200 I then read the file in R using the command: stockList=read.table(/NotesOnR/stockList, header = T, sep=,) I would then expect the following expression to evaluate to the simple string APA: stockList$symbol[2]

[R] Data Frame Members

2014-06-27 Thread Robert Sherry
Suppose that a data frame has been created by the user. Perhaps it has been created using the library quantmod. Is there any command to find out what the members of the data frame is? Thanks Bob __ R-help@r-project.org mailing list