* using log directory 'd:/RCompile/CRANincoming/R-devel/DatastreamR.Rcheck' * using R Under development (unstable) (2024-03-18 r86148 ucrt) * using platform: x86_64-w64-mingw32 * R was compiled by gcc.exe (GCC) 13.2.0 GNU Fortran (GCC) 13.2.0 * running under: Windows Server 2022 x64 (build 20348) * using session charset: UTF-8 * checking for file 'DatastreamR/DESCRIPTION' ... OK * this is package 'DatastreamR' version '2.0.4' * package encoding: UTF-8 * checking CRAN incoming feasibility ... NOTE Maintainer: 'LSEG Datastream ' New submission Possibly misspelled words in DESCRIPTION: Datastream (2:22, 10:38, 10:65) The Title field should be in title case. Current version is: 'R package for Datastream Web Services API' In title case that is: 'R Package for Datastream Web Services API' * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking serialization versions ... OK * checking whether package 'DatastreamR' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... OK * checking DESCRIPTION meta-information ... NOTE Authors@R field gives persons with invalid ORCID identifiers: LSEG Datastream [aut, cre] (datastreamapi@lseg.com) * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking LazyData ... NOTE 'LazyData' is specified without a 'data' directory * checking examples ... OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... ERROR Running 'Test_GetData.R' Running 'Test_UCTS.R' Running 'testthat.R' Running the tests in 'tests/Test_GetData.R' failed. Complete output: > library(DatastreamR) > #logger::log_threshold(level=loglevel('ERROR')) > > # Login using Wrong Username or Password > ds = DataClient$new("C:\\Vidya\\dsws\\sami\\DswsRUtilities\\DevR6\\Config.ini") cannot open the connectionERROR [2024-03-19 11:40:38] cannot open the connectionINFO [2024-03-19 11:40:38] DSConnect.R DSConnect$getToken :Getting Token and Token Expiry Please install xml2 packageERROR [2024-03-19 11:40:38] DSConnect.R DSConnect$getToken Please install xml2 packageERROR [2024-03-19 11:40:38] DSConnect.R DSConnect$getToken No response received Warning message: In file(filepath, open = "r", encoding = encoding) : cannot open file 'C:\Vidya\dsws\sami\DswsRUtilities\DevR6\Config.ini': No such file or directory > > # Login using Configuration > # ds = DataClient("Config.ini") > > # Example 1: To retrieve data for tickers VOD and BARC for dattypes PH and PL > # with start and end date as given. The retrived data is captured in a > # dataframe and further the values are displayed in a Chart. > # > > df = tryCatch ({ + print("Retrieving data into dataframe and plot the values") + ds$getDataframe(tickers = "VOD,BARC", fields= list("PH", "PL"), start ='2022-01-12',end = '2022-07-13', kind = 1) + }, + error = function(e) { stop (message(e))}) [1] "Retrieving data into dataframe and plot the values" INFO [2024-03-19 11:40:38] Datastream.R DataClient$getDataframe Getting Data INFO [2024-03-19 11:40:38] Datastream.R DataClient$getData Getting Data You are not logged on. Please recreate the client supplying valid user credentials.Error in value[[3L]](cond) : Calls: tryCatch -> tryCatchList -> tryCatchOne -> Execution halted Running the tests in 'tests/Test_UCTS.R' failed. Complete output: > # Datastream User Created Timeseries > # ---------------------------------- > # > # Datastream permits users to create and manage custom items. One of these > # types is custom timeseries data. Clients can upload their own timeseries > # data to Datastream’s central systems. These can then be used in combination > # with Datastream maintained series in charts and data requests with the full > # power of the Datastream expressions language. > # > # DatastreamUserCreated_TimeSeries.R defines a TimeseriesClient class and > # ancillary classes that assist in creating and managing timeseries data. > # > # This simple test script demonstrates how to manage custom timeseries data > # using the DatastreamUserCreated_TimeSeries.R module. > # > # Prerequesites: > # > # Firstly, your Datastream credentials need to be permissioned to use the > # Datastream API services. To verify you have access, please access the API > # test page at https://product.datastream.com/dswsclient/Docs/TestUserCreatedItems.aspx. > # Selecting the "Get Token" service method, insert your Datastream credentials > # and press the Execute button. If your credentials are valid and are permissioned > # to access the API service, you will receive a token response. If you are not > # permissioned, you will receive below message > # "User 'Your ID' not entitled to ClientApi service.". > # Please contact your LSEG representative to get your ID permissioned. > # > # Once you have permissions to access the API service, you also need to be > # permissioned to specifically access the service that permits you to access > # and manage custom user created items such as timeseries. You can verify this > # by using the "Get All Items" service method on the above test page. Using the > # token returned from the GetToken method, copy the token into the Token field > # and then select Execute. If you are permissioned for the user created items > # service, you will get a response listing the timeseries available to you on > # Datastream. This may be an empty list if you are a new customer or have never created user created items before. If you > # are not permissioned, you will receive an error message: > # "ID 'Your ID' is not permissioned for user created items.". > # Please contact your LSEG representative to get your ID permissioned. > # > > library (DatastreamR) > library(logger) > > # You can set the threshold for log messages as given below > # logger::log_threshold(ERROR) > > # This is a simple support function for displaying the contents of an individual > # timeseries item. It's used frequently in the demos below. > ProcessTimeseriesResponse = function(tsResponse, tsName) + { + if (!is.null(tsResponse)) + { + # Any request dealing with a single user created item returns a DSUserObjectResponse. This has ResponseStatus property that indicates success or failure + if (tsResponse$ResponseStatus != DSUserObjectResponseStatus$UserObjectSuccess) + print(paste('Request failed for timeseries', tsName, 'with error ', names(DSUserObjectResponseStatus)[tsResponse$ResponseStatus + 1], ': ', tsResponse$ErrorMessage)) + else if (!is.null(tsResponse$UserObject)) # The timeseries item won't be returned if you set SkipItem true in CreateItem or UpdateItem + { + # Here we simply display the timeseries data using a dataframe. + tsItem = tsResponse$UserObject + metadata = c (Id = tsItem$Id, + Desc = tsItem$Description, + LastModified = as.character(tsItem$LastModified), + StartDate = ifelse (!is.null(tsItem$DateInfo), as.character(tsItem$DateInfo$StartDate), NULL), + EndDate = ifelse(!is.null(tsItem$DateInfo),as.character(tsItem$DateInfo$EndDate), NULL), + Frequency = ifelse(!is.null(tsItem$DateInfo), names(DSUserObjectFrequency)[tsItem$DateInfo$Frequency + 1], NULL), + NoOfValues = ifelse(!is.null(tsItem$DateRange), tsItem$DateRange$ValuesCount , 0)) + df = data.frame(metadata) + print(df) + + if (!is.null(tsItem$DateRange)) + { + df = data.frame(Dates = sapply(tsItem$DateRange$Dates, FUN = function(x) { return (as.character(x)) }), + Values = sapply(tsItem$DateRange$Values, FUN = function(x) { ifelse (is.null(x), return (NA_character_ ), return (x) )} )) + # Values if NULL, is printed as because, while converting list to vector + # either by using as.vector or sapply, the NULL values in the list are deleted. + # and thus there will be mismatch in no of rows and cannot be put in a dataframe + print(df) + } + } + } + else + print(paste('Timeseries ', tsName, ' successfully updated but item details not returned.')) + } > > > # > # To query and modify timeseries, you first need to create a TimeseriesClient > # object using your Datastream credentials. > # > # This can be done in two ways. The first method is simply to create the > # client passing your Datastream credentials in directly: > # > # timeseriesClient = TimeseriesClient(NULL, 'YourID', 'YourPwd') > # > # Alternatively, you can use a configuration file containing your > # credentials. The config file just needs your credentials in the following > # format: > # > # [credentials] > # username=YourID > # password=YourPwd > # > # Then create the TimeseriesClient object passing in the config file. > # > # timeseriesClient = TimeseriesClient('config.ini') > # > # > # Okay, let's start the demo by creating the TimeseriesClient. > > timeseriesClient = NULL > > # Assuming you have permissioned credentials, replace 'YourID' and 'YourPwd' > # with them and then let's logon and create the TimeseriesClient object. > # Note the basic error handling for DSUserObjectFault exceptions > > tryCatch({ + # First step is creating the client by replacing 'YourID' and + # 'YourPwd' with your own credentials. + print('Creating a TimeseriesClient object using your credentials.') + + timeseriesClient = TimeSeriesClient$new("C:\\Vidya\\dsws\\sami\\DswsRUtilities\\DevR6\\Config.ini") + + #timeseriesClient = TimeSeriesClient('Config.ini') + + }, + error = function(e) + { + stop(message(e)) + } + ) [1] "Creating a TimeseriesClient object using your credentials." cannot open the connectionError in value[[3L]](cond) : Calls: tryCatch -> tryCatchList -> tryCatchOne -> In addition: Warning message: In file(filepath, open = "r", encoding = encoding) : cannot open file 'C:\Vidya\dsws\sami\DswsRUtilities\DevR6\Config.ini': No such file or directory Execution halted Running the tests in 'tests/testthat.R' failed. Complete output: > library(testthat) > library(DatastreamR) > > test_check("DatastreamR") [ FAIL 2 | WARN 2 | SKIP 0 | PASS 0 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test_GetData_EconCC.R:10:1'): Test for retrieving Economic Changes and Corrections ── Error in `file(filepath, open = "r", encoding = encoding)`: cannot open the connection Backtrace: ▆ 1. └─DataClient$new("C:\\Vidya\\dsws\\sami\\DswsRUtilities\\DevR6\\Config.ini") at test_GetData_EconCC.R:10:1 2. └─DatastreamR (local) initialize(...) 3. └─super$initialize(...) 4. └─base::tryCatch(...) 5. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 6. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. └─value[[3L]](cond) 8. └─logger::log_error(message(e)) 9. └─logger::log_level(...) ── Error ('test_GetData_EconCC.R:17:3'): Test for retrieving Economics Sequence ── Error in `file(filepath, open = "r", encoding = encoding)`: cannot open the connection Backtrace: ▆ 1. └─DataClient$new("C:\\Vidya\\dsws\\sami\\DswsRUtilities\\DevR6\\Config.ini") at test_GetData_EconCC.R:17:3 2. └─DatastreamR (local) initialize(...) 3. └─super$initialize(...) 4. └─base::tryCatch(...) 5. └─base (local) tryCatchList(expr, classes, parentenv, handlers) 6. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 7. └─value[[3L]](cond) 8. └─logger::log_error(message(e)) 9. └─logger::log_level(...) [ FAIL 2 | WARN 2 | SKIP 0 | PASS 0 ] Error: Test failures Execution halted * checking PDF version of manual ... [13s] OK * checking HTML version of manual ... OK * DONE Status: 1 ERROR, 3 NOTEs