Displaying 20 results from an estimated 800 matches similar to: "handle date variables"
2001 Feb 13
1
pass a string to a function
Hi,
I'd like to pass a string to a function as the value
of the argument.
Here is my code. However, it doesn't work. Please help
me with this.
Thanks,
Yu-Ling Wu
-----------------------------------------------------
library(RODBC)
odbcConnect("console") -> myConnect
fun1 <- function(dd1) {
h3 <- sqlQuery(myConnect, "select * from console where
byday =
2001 Jul 14
6
how to type long string
Hi, All:
I try to type some long string in R console, whenever
I like to change to a new line, I get error message.
The following is my simple code
--------------------------------------
h3 <- sqlQuery(myConnect, "select * from console where
Error: syntax error
byday = 'dd1'group by by hour")
Error: syntax error
---------------------------------------
Any Hints?
Thanks.
2011 Feb 09
1
Iterate over a list of input files?
Hi,
I've got the following code which seems to work fine for a single
file if I specify the file name explicitly in the code. What I need to
do is run it on all the files in the directory tested and augment the
data frame I'm building to have more results columns.How can I do
that?
Here's the code:
library(chron) # .Holidays / is.holiday / is.weekend
TStoDate = function
2012 Nov 02
2
Date format conversion from "2012-09-20" to "2012:09:20"
Hi R,
How to get the range of values form startDate to lastDate as given below?.
#*****************************************************************
# Load historical data
#******************************************************************
library('quantmod')
endDate =Sys.Date()
startDate = as.Date(endDate-30, order="ymd")
dataspy = getSymbols("SPY", from = startDate,
2008 Nov 13
0
sem and "simple variables"
salutations!
i am doing some longitudinal modeling with sem and thought calculating some
"simple variables" would make my model more readable. this is the smallest
subset of my model that illustrates the resulting problem.
i have 2 observed exogenous variables (c1, d2) and 4 observed endogenous
variables (dc1, dd1, dc2, dd2). c1 is the observed state at time 1, dc1 is
the change in c
2004 Jul 16
1
highlighting subset of point with xyplot (or Hmisc(xYplot))
Hello all,
I am trying to use xyplot to give a six panel plot and to highlight
only points (in any panel) that meet a certain criterion. With the
plot command I would do something like:
plot.default(filein$Site,filein$circ.conc)
points(filein$Site,filein$circ.conc,type="p",
pch=ifelse(filein$p.value<5e-02,19,21))
I had thought I could just stick in the pch line from above into
2014 Jul 21
2
Inserción de condicionales en pequeño código
Buenas tardes,
He construido la función “myfun” al objeto de considerar aquellas
persones que a partir de una determinada fecha de Apertura tienen como mínimo 65 años. Se tiene su fecha de
nacimiento, su fecha de inicio en la institución y su fecha de salida de la
misma. Doy vueltas al script y no acabo se saber cómo poder aplicar de un modo
eficiente las instrucciones “if” ó bien “ifelse”, y me
2013 Jan 18
1
Object created within a function disappears after the function is run
Dear R-helpers,
I have run the code below which I expected to make an object called dd1,
but that object does not exist.
So, in summary, my problem is that my function is meant to make an object
(dd1), and it does indeed make that object (I know that the last line of
the function prints it out) but then, after the function has run, the
object has disappeared.
It's late on a Friday so I may
2012 Aug 06
1
more efficient way to parallel
Dear All,
Suppose I have a program as below: Outside is a loop for simulation (with
random generated data), inside there are several sapply()'s (10~100) over
the data and something else, but these sapply's have to be sequential. And
each sapply do not involve very intensive calculation (a few seconds only).
So the outside loop takes minutes to finish one iteration.
I guess the better way
2008 Sep 04
1
Timezone support?
This is a follow-up to the thread ending with:
http://rubyforge.org/pipermail/vpim-talk/2008/000120.html
I too am in search of some ruby parser for icalendar which properly handles
timezones on the datetimes in the icalendar RFC.
As I understand it there are actually three types of times.
1) UTC times with a string form of yyyymmddThhmmssZ
note the trailing Z indicates zulu time aka utc.
2)
2018 Mar 25
1
Get Specific Records from Another DataFrame
Hello
I have been struggling with this simple looking problem. I have two
dataframes. The first one contains ID, date, and revenue information for
specific suppliers.
id lastdate depvar
A 5/10/2017 10
B 8/16/2017 20
C 2/14/2017 30
D 9/5/2017 40
E 8/1/2017 50
F 11/4/2017 60
G 6/22/2017 70
The second dataframe contains timeseries data of each supplier in different
columns. For example Column A are
2011 Nov 15
1
Convert full matrix back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0
The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 =
dist(ab,"euclidean")> dd1 1 2 3 4 52 0.1 3 0.2 0.1 4 0.3 0.2 0.1 5 0.4 0.3 0.2 0.1 6 0.5 0.4 0.3 0.2 0.1
Convert the lower triangular matrix to a full
2007 Apr 19
1
Character coerced to factor and I cannot get it back
Something probably obivous but I don't see it. I
needed to find the first 1 or two digits of some 5 and
6 digit numbers since they identified research sites
while the rest of the number was the plot id.
I converted the numbers to characters, got the first 1
or 2 characters as appropriate and went to add the
new vector to the data.frame. For some reason R is
insisting on turning the
2004 Mar 25
1
mlocal/mtrace inside a loop
Hello
I need some help in figuring Bravington’s debugger
out.
Ok
I have 2 functions, fun1 and fun2 saved in a ASCII
file say filename is funs.
Fun1 has a loop which calls fun2, fun2 has a loop
which fails and I need to find out the value of the
variables of the fun2 and fun1 loops at the specific
iteration that fails. Both fun1 and fun2 loops will
iterate thousands of times so line by line debug
2012 Aug 30
1
How to modify the values of the parameters passing via ...
Dear Friends,
Let's assume there are three parameters that were passed into fun1. In
fun1, we need to modify one para but the remains need to be untouched. And
then all parameters were passed into fun2. However, I have failed to
achieve it.
Please see the following code.
##########################################
fun1 <-function(x, y, z=10) {x+y+z;}
fun2 <-function(aa, ...) {
2011 Apr 26
1
Barplot for degree distribution
In barplot for degree distribution x-axis is not seen.
See the example below
> g = barabasi.game(500, 0.4)
> dd1 = degree.distribution(g)
> plot(dd1, xlab="degree", ylab = "frequency")
whereas barplot doesnot have any x-axis
> barplot(dd1, xlab = "degree", ylab = "frequency")
Please see the figures attached.
2011 Aug 23
0
Matrix:::qr.qy and signature(qr = "sparseQR", y = "dgCMatrix")
> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Matrix_0.999375-50 lattice_0.19-30
loaded via a namespace (and not attached):
[1] grid_2.13.1
2008 Jan 08
0
Status of Timezone support / Handeling DTSTART; TZID="(GMT-05.00) Eastern Time (US & Canada)":20080107T123000
I can not tell from the docs or from the mailing list what is the
state of timezone support in the iCalendar package?
If I want to parse an iCalendar file that has non utc dstarts and
dends will it convert those times to UTC or otherwise allow me to do
that?
When I tried to parse an iCalendar input file started off with
something like this:
BEGIN:VCALENDAR
METHOD:REQUEST
2008 Aug 22
0
Question about Timezone In 1.0.2
I''m looking at the docs for 1.0.2 and saw this example...
# Now, you can make timezones like this
cal = Calendar.new
cal.timezone do
timezone_id "America/Chicago"
daylight do
timezone_offset_from "-0600"
timezone_offset_to "-0500"
timezone_name "CDT"
dtstart
2007 Apr 20
0
Fwd: Re: Character coerced to factor and I cannot get it back
--- John Kane <jrkrideau at yahoo.ca> wrote:
> Date: Fri, 20 Apr 2007 10:47:45 -0400 (EDT)
> From: John Kane <jrkrideau at yahoo.ca>
> Subject: Re: [R] Character coerced to factor and I
> cannot get it back
> To: jim holtman <jholtman at gmail.com>
>
> Thanks Jim,
>
> I can live with it as a factor or I will do as you
> suggest. What is bothering