Search results

  1. trinker

    Importing excel and graphing

    Hmm would have thought airquality[,0:4] would throw an error
  2. trinker

    Importing excel and graphing

    I'd recommend the readxl package to read in most xlsx files. So this will install the package: install.packages('readxl') Then when you want to use it: library(readxl) mydata <- read_excel("S:\\CIU\\Testfolder\\DataforTS2.xlsx")
  3. trinker

    Importing excel and graphing

    Importing files trips a lot of people up but R has nice tools to do this with little lift. Once you get it down it really makes it easy to automate tasks to make plots/reports. If you can post the code you tried and the error it gave that could be a start to getting help.
  4. trinker

    What if you try to install a package and nothing happens....

    Also ggfortify must be in quotes but that'll just throw an error
  5. 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.
  6. 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...
  7. 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
  8. 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.
  9. 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.
  10. trinker

    R News and Updates

    > stringsAsFactors=T had to go at some point! Agreed, but there was some pain (though minimal)
  11. 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.
  12. 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.
  13. trinker

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

    Look at the check.names argument?
  14. trinker

    Long live SAS

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

    Long live SAS

    There was a crappy open source version of spss I tried once upon a time before R...pspp
  16. 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?
  17. 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...
  18. trinker

    R programming

    I agree with Dason on all points.
  19. 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...
  20. trinker

    R to Python List manipulation

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