Displaying 3 results from an estimated 3 matches for "noofday".
Did you mean:
noofdays
2011 Jan 12
1
snowfall
...trading days
myFinCenter="Asia/Singapore"
getTimeToMaturity <- function(x){
tryCatch({
toDt <- as.Date(as.character(x['EXPIRY_DT']), "%Y-%m-%d")
#Expiry Date
fromDt <- as.Date(as.character(x['TIMESTAMP']), "%Y-%m-%d")
#Trade Timestamp
NoOfDays <- NROW(getTradingDates(toDt,fromDt))
return(NoOfDays/252)
},
error = function (ex){
#print (paste("Error in",toDt,fromDt))
NoOfDays <- 0
return(NoOfDays/252)
}
)
}
Question: The following two lines work but the third and parallel one
doesn't ... why?
1) > app...
2010 Apr 12
1
N'th of month working day problem
...herever z.na does but has 1, 2, 3, ...
>> # instead of z.na's data values and then use na.locf to fill in NAs
>>
>> idx<- na.locf(seq_along(z.na) + (0 * z.na))
>>
>> # pick off elements of z.na corresponding to i'th of month
>>
>> noofday<- paste(day)
>>
>> if (day<10) noofday<-paste("0",day, sep="")
>>
>> tempdata<-z.na[idx[format(time(z.na), "%d") == noofday]]
>>
>> return(tempdata)
>>
>> }
>>
>> length(chooseday(D...
2011 May 10
1
Reading a large netCDF file using R
...I tried to get the variable values using this command
> xx=get.var.ncdf(nc)
Error: cannot allocate vector of size 2.1 Gb
This file has six hourly data for the 199 x 99 points for 10 years. I wanted
to aggregate this data into a monthly scale. I tried used a simple code like
this
for (i in 1:noofdays) {
for (j in 0:3) {
x= get.var.ncdf(nc,v1,start=c(1,1,(i+j)),count=c(199,99,1))
temp_data_mat=temp_data_mat+x
}
for (x1 in 1:199) {
for (x2 in 1:99) {
data_mat_89_99[x1,x2,ctr]=temp_data_mat[x1,x2]
}
}
ctr=ctr+1
temp_data_mat=matrix(0,ncol=99,nrow=199)
}
I didnt think it worked...