pa package in R - performance attribution

In order to use mutate() and as_factor() you'll need the dplyr and forcats packages loaded. You can convert string variables to factors in R in a number of different ways. See examples here:

got it, let me try it out first, many thanks mara :grinning:

Best

Dear mar

Couple of issues i encountered when i use the "readtable" clipboard way to import excel data in R..

  1. when i tried to use the "tribble" in Addin to copy and paste my excel data, there is no data missing BUT i lost almost half set of data from excel when i loaded into R using the readtable way? u hve any idea how i can solve it and "read" all the data

  2. after importing the excel data with readtable command..i found the "date" is stored as a factor ($ date : Factor w/ 12 levels "2018-01-31","2018-02-28")
    i tried to change the "factor" in the "date" dataframe format with the following commands..

my_data$date<- as.Date(my_data$date, "%m/%d/%Y) ...date format in my excel(1/31/2018)

but it turns out all the date with "N/A"?? ($ date : Date, format: NA NA ...)

i would appreciate if u could point me to the right direction...

Best

To clarify, I don't think that using datapasta should be your go-to for reading in your actual data. It's useful for making a small reproducible example. Try reading in your data with readxl::read_excel() as you were before, and then take a look at some of the links I provided above re. changing data types in R. Your date shouldn't be a factor variable if you do this, and you can convert it or parse it as a date.

These packages might also help you to work with date and factor variables (though you can do these things with base R as well):

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.