similar to: Confusion with sapply

Displaying 20 results from an estimated 500 matches similar to: "Confusion with sapply"

2011 Jan 16
2
xyplot: modify axis tick marks
Hi, I would like to plot time against rainfall data (data is at the end) using xyplot. The basic code looks like this: xyplot(rainfall~time, type="a") When I do this, the graph looks ok except that the x-axis has too many values. I would just like to display the years and not the months on the x-axis. I've been fiddling around with 'scales', and read previous posts about
2007 May 09
3
Removing a list of Objects
Hi, I have a simple beginner's question on removing a list of objects. Say I have objects C243.Daily1, C243.Daily2...C243.Daily5 in my workspace. I'd like to remove these without using rm five times. So I write. > a <- list(paste("C243.Daily",sep="",1:5)) > rm(a) Obviously this wouldn't work, as it would only remove the object a. But is there any way
2007 May 10
3
Getting the last day of the month.
Hi, Given a date, how do I get the last date of that month? I have data in the form YYYYMM, that I've read as a date using > x$Date <- as.Date(ISOdate(substr(x$YearEnd,1,4),substr(x$YearEnd,5,6),1)) But this gives the first day of the month. To get the last day of the month, I tried > as.Date(as.yearmon(x$Date,frac=0)) But I don't get the last day of the month here. (Tried
2007 May 14
6
Conditional Sums for Index creation
Hi, Apologies for the long mail. I have a data.frame with columns of price/mcap data for a portfolio of stocks, and the date. To get the total value of the portfolio on a daily basis, I calculate rowSums of the data.frame. > set.seed(1) > ab <- matrix(round(runif(100)*100),nrow=20,ncol=5) > ab[1:5,4:5] <- NA > ab[6:10,5] <- NA > ac <- as.data.frame(ifelse(ab <=
2007 May 10
3
Quick question on merging two time-series of different frequencies
Hi, A quick beginner's question. I have two time series, A with daily data, and another B with data at varying frequencies, but mostly annual. Both the series are sorted ascending. I need to merge these two series together in the following way: For any entry of A, the lookup should match with B until we find an entry of B that's larger than A's. For all A[i], i = 1,...,N and B[j],
2007 Jun 14
3
Preserving dates in Excel.
Hi, Quick question: Say I have a date variable in a data frame or matrix, and I'd like to preserve the date format when using write.table. However, when I export the data, I get the generic number underlying the date, not the date per se, and a number such as 11323, 11324, etc are not meaningful in Excel. Is there any way I can preserve the format of a date on writing into a text-file? TIA
2007 Jun 05
2
Problems with Merge
Hi, I have a history dataset, a matrix with about 1590 obs, and 242 cols, and I need to update this matrix with an 'update' matrix that has about 30 rows, and roughly similar number of columns as the history ds (but not necessarily equal). The update dataset is read from an Excel ODBC connection. When I try and merge these datasets, I get counter-intuitive results. library(RODBC) chn
2009 Mar 25
1
Creating date seq in data frame
Hi, I have the following type of data: myData <- data.frame(x = 1:5, y = letters[1:5], xDate = seq(as.Date("2001/2/1"), as.Date("2005/2/1"), by="year") ) > myData x y xDate 1 a 2001-02-01 2 b 2002-02-01 3 c 2003-02-01 4 d 2004-02-01 5 e 2005-02-01 What I need is a new column, say xDate2, that for each xDate (or for each unique combination of
2010 Jul 29
2
multiple graphics windows open
Dear R People: Now I have a function with 3 graphics windows. I'd like for them all to be visible. However, the first window goes blank. Here is the basic setup. The first plot is the entire series. The user selects two points, which in turns generates a subset plot and an EWMA subset plot. Finally, if things worked right, the user should be able to click on "Tile Vertically"
2004 Mar 10
2
Inserting Date Field into Oracle table using ROracle
Hello, Attached is a mail regarding question how to insert Date field using ROracle package. I am stuck with this problem and appreciate receiving help from gurus on this list. Code used mainly is: library(ROracle) ### --- Version 0.53 drv <- dbDriver("Oracle") con <- dbConnect( drv, "user/passwd") d <- data.frame(CDATE = "2004-03-10 10:12:00") ps
2013 Apr 11
4
Understanding contents of packages
Colleagues During the transition to R3.0.0 (OS X), one of the packages that I used -- SASxport -- did not work until I used the "type=source" option in install.packages. This led to an adventure: 1. I downloaded the package source: SASxport_1.2.4.tar.gz 2. in the SASxport/R folder, I found all the functions that are part of the package. I became interested in whether I could
2005 Dec 05
1
Automatic time zone conversion
Dear R-help, I was trying to convert a date and time record extracted from a fortran subroutine I worte and I encounter some problem. The data read in time and date in a format like "2000-05-11_01:00:00.0000" in fortran output. It is in GMT. I need to convert it to CST (GMT+8). I did the following steps. > cdate [1] "2000-05-11_01:00:00.0000\005\003" # I am not sure
2016 Aug 19
2
can't build from source: error: template with C linkage
Hi All, Users have contacted me because they can not build MCMCglmm from source. All are using R 3.3.0 on various machines with different compilers gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 Mac OS X El Capitan (version/compiler unspecified) The issue seems to be with mixing C/C++ with the repeated error: /usr/include/c++/5/bits/cpp_type_traits.h:118:3:
2010 Aug 01
1
aggregating a daily zoo object to a weekly zoo object
Dear R People: I'm trying to convert a daily zoo object to a weekly zoo object: xdate <- seq(as.Date("2002-01-01"),as.Date("2010-07-10"),by="day") library(zoo) length(xdate) xt <- zoo(rnorm(3113),order=xdate) xdat2 <- seq(index(xt)[1],index(xt)[3113],by="week") xt.w <- aggregate(xt,by=xdat2,mean) Error: length(time(x)) ==
2016 Aug 19
1
can't build from source: error: template with C linkage
This looks like the result of including a C++ system header inside an extern "C" block. There is no evidence of this happening in the current version 2.22.1. However, it did happen in the previous version 2.22 via the chain of inclusions: MCMCglmmcc.h -> cs.h -> R.h -> various C++ system headers See Writing R Extensions P 108. I would check that the people reporting this bug
2010 Jul 29
1
multiple graphics windows open with sessionInfo
Dear R People: Hello again. I'm trying to have 3 graphics windows visible simultaneously. I set up a zoo series. Then I plot the original series. I use the locator function to select 2 values from the original series, which generates a subset of the original series. Next, I plot the subset. The last step is to produce an EWMA chart from the subset series. Fair enough. I've tried
2017 Nov 05
5
Extreme bunching of random values from runif with Mersenne-Twister seed
On 04/11/2017 10:20 PM, Daniel Nordlund wrote: > Tirthankar, > > "random number generators" do not produce random numbers. Any given > generator produces a fixed sequence of numbers that appear to meet > various tests of randomness. By picking a seed you enter that sequence > in a particular place and subsequent numbers in the sequence appear to > be unrelated.
2019 Jan 06
4
Failed to install RQuantLib in Ubuntu machine
Hi, <This issue was previously posted in R-help, but advised to post here as a more relevant group> I was trying to install RQuantLib in my Ubuntu machine which failed with below information : *> install.packages('RQuantLib', repos='http://cran.rstudio.com/ <http://cran.rstudio.com/>', INSTALL_opts = c('--no-lock'))* *Installing package into
2002 Apr 11
6
extract week from date
Hello R-users, Does anyone know how obtain the week of a date? (in SPPS the instruction is "xdate.week") Thanks, Juan Ramon -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the
2017 Nov 03
2
Extreme bunching of random values from runif with Mersenne-Twister seed
Bill, Appreciate the point that both you and Serguei are making, but the sequence in question is not a selected or filtered set. These are values as observed in a sequence from a mechanism described below. The probabilities required to generate this exact sequence in the wild seem staggering to me. T On Fri, Nov 3, 2017 at 11:27 PM, William Dunlap <wdunlap at tibco.com> wrote: >