Krishna Krishna - 8 months ago 23
Java Question

How to print values of all elements of java.util.Date type Array in R language

I am new in R language and i have a problem :

In java i have a method like this

public Date[] getAllDates(String fromDate, String toDate){
ArrayList<Date> dates= new ArrayList<Date>();
Generating dates from fromDate to toDate here and setting into above

return dates.toArray(dates.size());


Now in R when i am calling this method then it is returning this array

dates= c(classInstance$getAllDates(fromDate,toDate));

Now i am not able to show the dates values present in dates array it is showing as object only.

and if i use
then it displays

List of 1
$ :Formal class 'jrectRef' [package "rJava"] with 4 slots
.. ..@ dimension: int 10
.. ..@ jsig : chr "[Ljava/util/Date;"
.. ..@ jobj :<externalptr>
.. ..@ jclass : chr "[Ljava/util/Date;"

i tried everything but i am not able to show the values from this array.
please help me.Thank you


Finally after a lot of search on google(approx 3 days continuously) about R programming and concept and techniques to resolve my above issue, now i am able to give my answer itself.

dates= c(classInstance$getAllDates(fromDate,toDate));

from here

for(i in 1 : dates$length) { 
 #Fetching one by one date object using for each loop in R
 index = .jevalArray(dates)[[i]]
 # Holding an individual array into variable 
 # Now printing using Java toString() method only.