Displaying 20 results from an estimated 300 matches similar to: "Getting the last day of the month."
2012 Nov 09
2
Creating yyyymm regexp strings on the fly for aggregation.
Folks,
This question is somewhat related to a previous posting of mine.
I just can't seem to create a generic solution.
Here is a function that I found searching around the internet:
splitIt <- function(x, n) {split(x, sort(rank(x) %% n))}
I use it like so:
> splitIt(1:12, 2)
$`0`
[1] 1 2 3 4 5 6
$`1`
[1] 7 8 9 10 11 12
Or
> splitIt(1:12, 4)
$`0`
[1] 1 2 3
$`1`
[1] 4 5 6
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 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <-
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
2011 Feb 16
1
Timeseries Data Plotted as Monthly Boxplots
Hello, I'm trying to develop a box plot of time series data to look at the
range in the data values over the entire period of record.
My data initially starts out as a list of hourly data, and then I've been
using this code to make this data into the final ts array.
# Read in the station list
stn.list <- read.csv("/home/kbennett/fews/stnlist3", as.is=T, header=F)
# Read in
2007 Aug 13
3
invert 160000x160000 matrix
Can R invert a 160000x160000 matrix with all positive numbers? Thanks a lot!
2012 Mar 14
3
Help: problem converting character to numeric
Dear R experts,
I have a dataframe imported from a csv file (with read.csv).
Here is an example:
yyyymm<- c("19860228", "19860331","19860430","19860531")
id<-c("10000","10000","10000","10000")
re<- c("C","0.25", "0.98", "1.34")
mret<-data.frame(yyyymm, id, re)
2010 Feb 15
4
Separating columns, and sorting by rows
Dear anyone who knows more about R than me (so everyone). I have been bashing
my head on the keyboard all day trying to do something with my table.
I have some data, like so:
yyyy-mm Rainfall(mm)
1 1977-02 17.4
2 1977-03 34.0
3 1977-04 26.2
4 1977-05 42.6
5 1977-06 58.6
6 1977-07 23.2
7 1977-08 26.8
8 1977-09 48.4
9
2010 Jan 22
2
Question on Merge/Lookup
I need to merge three datasets and don't know how. If I were using SQL, I
would use df3, look up the characteristics of each date in df1 and the value
for each observation in df2.
df1 - unique list of Dates and characteristics of those dates
Date, YYYYMM, YYYYWW, DOW
df2 - the raw data
Date, Place, Value
df3 - all posibile combinations of Date + Place (via
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.
2012 Dec 15
2
troubles reading a text file
Dear R experts,
For quite some time I have been trying to solve a mistery of reading a seemingly trouble-free text file. The data is temperature reconstruction arranged as a huge grid, preceded by seven "header lines" (which you see better if file is opened in Firefox or Chrome).
This is the data (gridded temperature reconstruction)
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:
>
2017 Nov 03
2
Extreme bunching of random values from runif with Mersenne-Twister seed
Bill,
I have clarified this on SO, and I will copy that clarification in here:
"Sure, we tested them on other 8-digit numbers as well & we could not
replicate. However, these are honest-to-goodness numbers generated by a
non-adversarial system that has no conception of these numbers being used
for anything other than a unique key for an entity -- these are not a
specially constructed
2017 Dec 10
2
What does gluster do when it's idle?
Hi,
There's no client activity and I have collected tcpdump for 5 mins on one
of the glusterFs sever which is also a client with gluster NFS mount. From
tcpdump I see that for every few seconds, STAT & STATFS commands are run.
For whichctory are these commands being run and why?
Regards,
Jeevan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Sep 27
1
converting numbers in "YYYYMM" format to last calendar day and last exchange trading day of the month
I have a vector that contains month and year in the format YYYYMM (e.g.“200701”, “200702”)
I wish to do to things:
1. I need to convert to a date that is the last calendar day of each month.
2. I need to convert this to a date that is the last U.S. stock-exchange trading day of each month.
Any advice is appreciated,
mymonths <- c(200701, 200702)
2017 Nov 13
4
What is it with trusted.io-stats-dump?
Hi,
I am trying to understand how the extended attribute trusted.io-stats-dump
works.
setfattr -n trusted.io-stats-dump -v
/tmp/gluster_perf_stats/io-stats-pre.txt /mnt/gluster/gv0_glusterfs
I can see that the io-stats-pre.txt is created. But how and what happened
in the background?
And why I can't I see the attribute with getfattr again?
getfattr -dm- /mnt/gluster/gv0_glusterfs
# file:
2017 Nov 13
2
What is the difference between FORGET and UNLINK fops
Hi,
Can I get a brief description of all the FOPS in gluster or the location of
the source code file so that I will try to get an understanding myself?
Few FOPS I'm not clear like FORGET, UNLINK, FLUSH, LOOKUP
Or is there a way I can tunnel through the FOPS that that are happening in
the background for each operation? I have tried this to find from a brick
logfile in TRACE mode, but there