Search results

  1. trinker

    time series objects

    See what this gives you: names(Mytsdata) That's because a ts object doesn't use names. This is usefule beyond str() to see what the object looks like. dput(Mytsdata) What were you trying to do here: names(Mytsdata)<-c("m","sp") > head(Mytsdata) the last command shows nothing changed.
  2. trinker

    time series objects

    > Mytsdata<-ts(mydata,frequency=12,c(2014,12)) does not. So for my data I have to use the above formulation. This is because you passed the whole dataframe into the data argument, and usually you likely only want to pass a vector from the data frame. > Why are there two sets of [] around...
  3. trinker

    time series objects

    mydata[['Spend']] This is grabbing the Spend column using column indexing. Almost identical to mydata[, 2] but safer in that it's gauranteed to return the vector not a list. Error in C(2014, 12) : object not interpretable as a factor R is case sensitive C is not c
  4. trinker

    time series objects

    It does but it's subtly using indexing as in [, 2] So this will likely work: ts(mydata[['Spend']],frequency=12) But you need to specify start = c(YOUR_START_YEAR, YOUR_START_MONTH) The dollar signs in the head you show above indicate character. R stores numeric/floats without dollar signs.
  5. trinker

    time series objects

    usnim_2002[, 2] Above you grabed 1 column, a vector. Do the same for this new data set with Spend start = c(2002, 1) Above you specified a date start (year, month) but don't this time. Also I think your data is character. Maybe use lapply(mydata, class) to see.
  6. trinker

    R News and Updates

    > stringsAsFactors=T had to go at some point! Agreed, but there was some pain (though minimal)
  7. trinker

    ggplot - graph bars and line

    It's hard to help because we don't have the data. If you can make a minimal working example you're sure to get a quicker response.
  8. trinker

    Blog Discussion Thread

    I like dplyr and tidyr for analysis...for programming they're a *****...mostly because the API is constantly changing. You can't make data science pipelines with an unstable API.
  9. trinker

    "X" in front of my column names - I want it to stop!!

    Look at the check.names argument?
  10. trinker

    Long live SAS

    I take it back PSPP is the way forward:
  11. trinker

    Long live SAS

    There was a crappy open source version of spss I tried once upon a time before R...pspp
  12. trinker

    Plotting a new series on top of old

    I'm sorry hlsmith but it's still not clear to me what you want. Can you draw the image by hand, take a pic of what you'd expect it to do? Also why plot x on the y axis and y on the x axis Or just poor variable names?
  13. trinker

    Today I Learned: ____

    TIL about the strtrim function...used to use substring(1, n)...not a huge savings but cool and semantically easier to think about: x <- 'Dason is a horrid human being (or bot) devoid of any type of empathy for others. He has amassed his fortune at the expense of all that is holy and sacred...
  14. trinker

    R programming

    I agree with Dason on all points.
  15. trinker

    [Python] regex fixed-width positive lookbehinds

    In R (via stringi) I could write (?<=a|bc) but doing this with the re module results in this error: raise error("look-behind requires fixed-width pattern") error: look-behind requires fixed-width pattern Is it true that if I have the regex (?<=a|bc) in Python I need to write it as...
  16. trinker

    R to Python List manipulation

    Is there a way to unlist/flatten to a vector? Or what python calls a list?
  17. trinker

    How can I get the data-points from the cluster with smallest within-variance in kmeans?

    Can you make this minimally reproducible and add what data should be or a dummy example?
  18. trinker

    R to Python List manipulation

    Taking the plunge and learning Python at a deeper level to compliment my R skills. I am coming up against a wall with manipulating named lists in the way I can in R. R/Python folks can you tell me the equivalent ways to do this common R tasks? R Way of working with list: x <- list(...
  19. trinker


    Tried this and it still works so: install.packages('devtools') library(devtools) install_github('trinker/mapit') library(mapit) wh <- geo_code( street = '1600 Pennsylvania Ave', city = 'Washington', state = 'DC', zip = '20500', api.key = 'signup to get yours free' ) ##...
  20. trinker


    If you need the addresses as lat an long....There's lots of ways to do this. This is one approach: (if it still works). This approach requires authentication and tokens but isn't too bad to do. You're just restricted on the number of...