search for: charvec

Displaying 15 results from an estimated 15 matches for "charvec".

2012 Sep 07
6
splitting character vectors into multiple vectors using strsplit
Hi folks, Suppose I create the character vector charvec by > charvec<-c("a1.b1","a2.b2") > charvec [1] "a1.b1" "a2.b2" and then I use strsplit on charvec as follows: > splitlist<-strsplit(charvec,split=".",fixed=TRUE) > splitlist [[1]] [1] "a1" "b1" [[2]] [1] &qu...
2007 Nov 02
1
R timeDate does not allow seconds?
...ble to get seconds to work. I ended up with this format finally: "2007-10-31_16:20:22" Problem is I am unable to get it recognized as a date using timeDate(): R> timeDate(as.character(inputdate),format="%Y-%02m-%02d_%02H.%02M.%02S") Error in if (regexpr("/....", charvec[1])[[1]] > 0) return("%m/%d/%Y") : missing value where TRUE/FALSE needed The R-help archives said something about non-standard formats casuing a problem, but I believe (short of the underscore) that its the seconds, not the delimiter that is causing the trouble. I've also...
2009 Jan 27
1
Mystery Error in midnightStandard
I wasn't even aware I was using midnightStandard. You won't find it in my script. Here is the relevant loop: date1 = timeDate(charvec = Sys.Date(), format = "%Y-%m-%d") date1 dow = 3; for (i in 1:length(V4) ) { x = read.csv(as.character(V4[[i]]), header = FALSE, na.strings=""); y = x[,1]; year = V2[[i]]; week = V3[[i]]; dtstr = sprintf("%i-%i-%i",year,week,dow); date2 = timeDate(dtstr, fo...
2007 Aug 20
2
library(fCalendar) timeDate("12.03.2005",format="%d.%m.%Y")
Dear R users, I have problem with the library fCalendar. I am not using the US standard format notations. It seems like it is not possible to have different format than the US standards. Anyone how knows a way to go around this problem? Here is the code I enter: myDate = "12.03.2005" timeDate(myDate, format = "%d.%m.%Y") And I get following error message: Error in if
2004 Dec 12
1
Re: [R-sig-finance] dates and times on Windows for fMetrics
...data been recorded? # Say, 16:00:00 local time "Australia/Sydney" when the exchange closes? Time = "16:00:00" # At which Financial Center you like to use your Data? FinCenter = "Australia/Sydney" # Make a timeSeries Object: sydney.ts = timeSeries( data = Data, charvec = paste(Date, Time), units = c("Open", "High", "Low", "Close", "Volume"), zone = "Australia/Sydney", FinCenter = "Australia/Sydney") sydney.ts # You should get: # Open High Low Close Volume # 2003-1...
2008 Jan 24
1
Error using Rmetrics to read data
...1283.42 1270.73 1277.41 2610749952 1277.41 4 8/1/2006 1278.53 1278.66 1265.71 1270.92 2527689984 1270.92 5 7/31/2006 1278.53 1278.66 1274.31 1276.66 2461299968 1276.66 6 7/28/2006 1263.15 1280.42 1263.15 1278.55 2480420096 1278.55 > SP500<-as.timeSeries(SP500) Error in .midnightStandard(charvec, format) : 'charvec' has non-NA entries of different number of characters > [[alternative HTML version deleted]]
2009 Jan 27
2
Can I create a timeDate object using only year and week of the year values?
...ple data, but I require a value representing the amount of time since the sample was taken (actually, for the purpose of the model, it is sufficient to use the number of weeks from the middle of the sample week to the present). What I have found so far includes: library(Rmetrics) time1 = timeDate(charvec = Sys.Date(), format = "%Y-%m-%d", zone = "", FinCenter = "") time2 = timeDate("2004-08-30", format = "%Y-%m-%d", zone = "", FinCenter = "") difftimeDate(time1,time2,units = "weeks") Does timeDate use the format strin...
2008 Aug 18
1
Converting monthly data to quarterly data
...I got: >tser<-as.ts(denise) Warning message: In data.matrix(data) : class information lost from one or more columns and column 2 has become a list of numbers rather than dates. I tried: > library(fCalendar) > den.tseries<-as.timeSeries(denise) Warning messages: 1: In .whichFormat(charvec, ...) : Could not determine time(date) format 2: In .whichFormat(charvec, ...) : Could not determine time(date) format > is.timeSeries(den.tseries) [1] TRUE > apply.quarterly(den.tseries,FUN="mean") data 1970-01-01 -2.425000000 1970-04-01 -0.557961111 1970-04-28...
2011 Mar 14
7
creating character vector
Is there a way to convince R to create a character vector without using the quotes? This works ex1 <- c("first","second") but when I try this it doesn't ext <- as.character(c(first,second)) it complains. I have many variables to put into character vectors so dispensing with the quotes would be useful. Thanks Jim =============================== Dr. Jim Maas
2012 Oct 29
2
Problems plotting a sparse time series in R
...noised.csv", sep=";", dec=".") date <- as.Date(df.raw[,1]) comments <- df.raw[,2] stats <- df.raw[,-c(1,2)] ################################################################ #### timeSeries library(timeSeries) ts <- timeSeries(charvec=date, data=stats) plot(ts) ################################################################ #### zoo library(zoo) ts <- zoo(stats, date) plot(ts) I tried plotting the stuff with two packages, timeSeries and zoo. Both have the same problem: The column "Bauchf...
2009 Oct 21
0
Problems coercing to timeSeries
...6/1999 118.5938 118.8750 118.2812 118.8438 3 1/7/1999 118.9062 119.0312 118.3750 118.5000 4 1/8/1999 118.4688 118.5625 117.5312 117.8125 5 1/11/1999 117.6562 117.7812 117.1250 117.5625 6 1/12/1999 117.5312 118.2188 117.2500 117.9688 > FUT10Y<-as.timeSeries(FUT10Y) Error in midnightStandard2(charvec, format) : 'charvec' has non-NA entries of different number of characters I thought timeSeries auto-detected the dates and formatted appropriately. Should I set the format explicitly? I've checked the raw data file and didn't find an errant characters, although there are some N...
2010 Jul 30
0
CBIND / MERGE two time series objects along time (overlapping indices, redundant data)
...ly appreciated. Kind regards, Bernhard. <---------------------------------------------------------------------------------------------------> # R Console example: require(timeSeries) date <-timeDate("01.01.2001", format = "%d.%m.%Y") test1 <- timeSeries(c(23.1), charvec = date) test2 <- timeSeries(c(23.1, 23.4), charvec = c(date, date)) colnames(test2) <- "SS.2" merge(test1, test2) GMT            TS.1 SS.2 2001-01-01 23.1 23.1 2001-01-01 23.1 23.4 cbind(test1, test2) Fehler in cbind(deparse.level, ...) : number of rows must match cbind(test2, test...
2005 Apr 19
1
timeSeries Date Warning messages: Set timezone to GMT!
...me()), zone = "GMT", FinCenter = FinCenter) 3: Set timezone to GMT! in: rulesFinCenter(FinCenter) 4: Set timezone to GMT! in: print.timeDate(list()) >ts<-timeSeries(pdatadate[,2:4], pdatadate[,1], format = "%Y-%m-%d") Warning messages: 1: Set timezone to GMT! in: timeDate(charvec = charvec, format = format, zone = zone, FinCenter = FinCenter) 2: Set timezone to GMT! in: rulesFinCenter(FinCenter) 3: Set timezone to GMT! in: Sys.timeDate() 4: Set timezone to GMT! in: timeDate(as.character(Sys.time()), zone = "GMT", FinCenter = FinCenter) 5: Set timezone to GMT! in...
2008 Aug 19
0
Converting monthly data to quarterly dataMonday, August 18, 2008 11:38 AM
...t; > > > > and column 2 has become a list of numbers rather than dates. > > > > > > I tried: > > > > > >> library(fCalendar) > > >> den.tseries<-as.timeSeries(denise) > > > Warning messages: > > > 1: In .whichFormat(charvec, ...) : Could not determine time(date) format > > > 2: In .whichFormat(charvec, ...) : Could not determine time(date) format > > >> is.timeSeries(den.tseries) > > > [1] TRUE > > >> apply.quarterly(den.tseries,FUN="mean") > > >...
2009 Jan 28
2
t.test in a loop
Hi All, I've been having a little trouble with creating a loop that will run a a series of t.tests for inspection, Below is the code i've tried, and some checks i've looked at. I've used the get(paste()) idea as i was told previously that the use of the eval should try and be avoided. I've run a single syntax to check that my systax is correct and works without any problems