[R] Function to find angle between coordinates?

2009-09-01 Thread clair.crossup...@googlemail.com
Dear all, I was doing some self study and was wondering if a function already exists which allows one to determine the angle between points. e.g. given the following (x,y) coordinates input: (0,1); (0,0); (1,0) would result in: output: 90 degrees Best regards C.C. ___

Re: [R] Function to find angle between coordinates?

2009-09-01 Thread clair.crossup...@googlemail.com
Thank you very much, these were exactly what i needed! :-) C.C. On 1 Sep, 14:08, "clair.crossup...@googlemail.com" wrote: > Dear all, > > I was doing some self study and was wondering if a function already > exists which allows one to determine the angle between poi

[R] How to sum and group data by DATE in data frame

2009-09-09 Thread clair.crossup...@googlemail.com
Dear all, Lets say I have a data frame as follows: > Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', > '2006-09-20')) > Income <- c(73.79, 72.46, 76.32, 72.43, 72.62) > data.frame(Date, Income) Date Income 1 2006-08-23 73.79 2 2006-08-30 72.46 3 2006-09-06 7

[R] Issue displaying DATES on a plot with two ordinates

2009-09-10 Thread clair.crossup...@googlemail.com
Dear all, I am having an issue with displaying the dates on a plot with two ordinates (i.e. two differently scaled y-axes). Instead of dates appearing on the x-axis I am instead seeing a string of numbers (14460, 14465, 14470 and 14475). example R code: library(plotrix) x.Left <- as.Date(c('2009

[R] date conversion not as i would have expected

2009-10-21 Thread clair.crossup...@googlemail.com
Good day, i imported some data into R from Excel. By using the edit() function, this is what one of the dates looks like in R: > x <- structure(1254351600, class = c("POSIXt", "POSIXct"), tzone = "") [1] "2009-10-01 BST" However, when i do the following, the date changes: > as.Date(x, formate="

[R] How to find moving averages within each subgroup of a data frame

2009-10-22 Thread clair.crossup...@googlemail.com
Dear all, If I have the following data frame: > set.seed(21) > df1 <- data.frame(col1=c(rep('a',5), rep('b',5), rep('c',5)), > col4=rnorm(1:15)) col1 col4 1 a 0.793013171 2 a 0.522251264 3 a 1.74641 4 a -1.271336123 5 a 2.197389533 6 b 0.433130777 7

Re: [R] How to find moving averages within each subgroup of a data frame

2009-10-23 Thread clair.crossup...@googlemail.com
Dear all, If I have the following data frame: > set.seed(21) > df1 <- data.frame(col1=c(rep('a',5), rep('b',5), rep('c',5)), > col4=rnorm(1:15)) col1 col4 1 a 0.793013171 2 a 0.522251264 3 a 1.74641 4 a -1.271336123 5 a 2.197389533 6 b 0.433130777 7

[R] RCurl unable to download a particular web page -- what is so special about this web page?

2009-01-26 Thread clair.crossup...@googlemail.com
Dear R-help, There seems to be a web page I am unable to download using RCurl. I don't understand why it won't download: > library(RCurl) > my.url <- > "http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2"; > getURL(my.url) [1] "" Other web pages are ok to downl

Re: [R] RCurl unable to download a particular web page -- what is so special about this web page?

2009-01-27 Thread clair.crossup...@googlemail.com
om/) but if i can get this verbose to work, then i think i will be able to google the right action to take based on the information it gives. Many thanks for your time, C.C. On 26 Jan, 16:12, Duncan Temple Lang wrote: > clair.crossup...@googlemail.com wrote: > > Dear R-help, > &g

Re: [R] RCurl unable to download a particular web page -- what is so special about this web page?

2009-01-27 Thread clair.crossup...@googlemail.com
Thank you. The output i get from that example is below: > d = debugGatherer() > getURL("http://uk.youtube.com";, + debugfunction = d$update, verbose = TRUE ) [1] "" > d$value() text "About to connect() to uk.youtube.com port 80 (#0)\n Trying 208.117.236.72... connected\nConnected to uk

Re: [R] RCurl unable to download a particular web page -- what is so special about this web page?

2009-01-27 Thread clair.crossup...@googlemail.com
In readLines("http://uk.youtube.com";) : incomplete final line found on 'http://uk.youtube.com' > On 27 Jan, 16:02, "clair.crossup...@googlemail.com" wrote: > Thank you. The output i get from that example is below: > > > d = debugGatherer() > > getURL(&

Re: [R] RCurl unable to download a particular web page -- what is so special about this web page?

2009-01-27 Thread clair.crossup...@googlemail.com
gent. > > If you use > >   getURL("http://www.youtube.com";, >            httpheader = c("User-Agent" = "R (2.9.0)"))) > > you should get the contents of the page as expected. > > (Or with URL uk.youtube.com, etc.) > >   D. > > &