0

I have loaded data from a text file using :

test_data <- read_csv("C:/test/input.txt")

loaded data can be seen as follows :

 test_data

Rows: 10 Columns: 6                                                                                                                
-- Column specification ------------------------------------------------------------------------
Delimiter: ","
chr  (5): patient, handling, handling_id, registration_type, employee
dttm (1): time

i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
> test_data
# A tibble: 10 x 6
   patient   handling handling_id registration_type time                employee
   <chr>     <chr>    <chr>       <chr>             <dttm>              <chr>   
 1     Item1 Astart   approved    started           2021-12-06 02:00:00 NULL    
 2     Item1 Astart   approved    completed         2021-12-06 02:30:00 NULL    
 3     Item1 AB       approved2   started           2021-12-06 07:00:00 NULL    
 4     Item1 AB       approved2   completed         2021-12-06 09:00:00 NULL    
 5     Item1 APar     approved3   started           2021-12-06 05:00:00 NULL    
 6     Item1 APar     approved3   completed         2021-12-06 14:00:00 NULL    
 7     Item1 APar2    approved5   started           2021-12-06 05:00:00 NULL    
 8     Item1 APar2    approved5   completed         2021-12-06 14:00:00 NULL    
 9     Item1 AEnd     approved4   started           2021-12-06 20:00:00 NULL    
10     Item1 AEnd     approved4   completed         2021-12-06 22:00:00 NULL

so when I try to view the data :

data(test_data) 

I get the error :

Warning message:
In data(test_data) : data set ‘test_data’ not found

Ive tried a lot of suggestions on the net, nothing seems to work.

Thanks in advance.

steve
  • 395
  • 2
  • 11
  • Why do you load a txt file with read_csv function? – Yacine Hajji Aug 30 '23 at 07:07
  • Which operating system, and version of R are you using? This may help: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Technophobe01 Aug 30 '23 at 07:09
  • 1
    The `data` function is not for viewing data, it does something quite different and using it doesn't make sense in your context. Are you perhaps consfusing it with the `View` function? – Roland Aug 30 '23 at 07:11
  • Hi, I'm running Windows 10, R v4.0.2. The text file contains data in CSV format. I'm trying to use bupaR heuristicsminer with example shown here https://github.com/bupaverse/heuristicsmineR. I have existing data in test_data ( as shown above ) and would like to pass test_data data through to heuristics miner. Thanks. – steve Aug 31 '23 at 00:56
  • That is not really relevant. The example from the package contains the line `data(patients)` to load the patients dataset, which is part of one of the packages loaded. You are using your own dataset and because that data isn't part of a package it isn't found by the `data` function. And the good news is: That doesn't matter. You don't need to use the `data` function. – Roland Aug 31 '23 at 05:07
  • Hi, I guess my question is how do I get test_data into heuristicsmineR, as heuristicsmineR seems to want a data set, however my data looks like its in a data set? If my data not in the same format as patients data set, how would I change it so it would be please? Sorry, am new to R. – steve Aug 31 '23 at 05:30
  • You need to consult the package documentation. My cursory look was not sufficient to understand what kind of data structure is needed. Personally, I would check `data(patients); str(patients)` if the documentation is less than helpful. – Roland Aug 31 '23 at 10:39

0 Answers0