Displaying 20 results from an estimated 3000 matches similar to: "how to type long string"
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 Feb 13
0
handle date variables
Thanks! This is helpful.
Three more questions.
1. How to convert a string into a numeric value. For
example, convert '20010122' to 20010122.
2. How to convert a string into a date value. For
example, convert 20010122
to 2001 Jan 22, and get its day of the week, i.e.
Monday?
3. How to handle date variables in a loop? How to make
the following codes work? And how users should pass
the
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
2007 Mar 19
3
R4.1: seq.POSIXt, tz="AEST" (PR#9572)
Times from seq.POSIXt come out wrong in AEST timezone around Feb 29 every
leap year before 1970 (on Windows XP).
According to help(DateTimeClasses), this is handled by "our own C code".
> x <- as.POSIXct("1968-02-27") # tz="AEST"
> x.gmt <- as.POSIXct("1968-02-27", tz="GMT")
> data.frame(
GMT=seq(x.gmt, by="day",
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 Nov 15
5
Convert 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
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)
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
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
2011 Mar 03
2
Plotting Mean in plotting degree distribution
Hi,
I am plotting degree distribution of a graph using the function,
library(igraph)
dd1 = degree.distribution(G)
plot(dd1, xlab = "degree", ylab="frequency")
I would like to plot the mean of the distribution as a vertical line in the
attached plot.
Please let me know how to do this.
Thanks,
Kumar http://r.789695.n4.nabble.com/file/n3334375/cdata3_dd.png
cdata3_dd.png
--
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
2003 Dec 04
4
bug in as.POSIXct ?
I think that there is a bug in the as.POSIXct function on Windows.
Here is what I get on Win2000, Pentium III machine in R 1.8.1.
> dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59)
> dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0)
> dd2 - dd1
Time difference of 1.000278 hours
Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has
2010 Aug 16
1
data frame handling
Dear all,
I have an xts object , t.xts with 4 columns: "v1" "DD1" "v2" "DD2" and
created a data frame :
t <- as.data.frame(t.xts)
I would like to extract data and create a new data frame for when the values
in column DD1 falls between 0 and 30 and extract the corresponding v1 value.
How can I do this?
Thanks.
--
View this message in context:
2008 Apr 14
3
Doing the right amount of copy for large data frames.
Hi there,
Problem ::
When one tries to change one or some of the columns of a data.frame, R makes
a copy of the whole data.frame using the '*tmp*' mechanism (this does not
happen for components of a list, tracemem( ) on R-2.6.2 says so).
Suggested solution ::
Store the columns of the data.frame as a list inside of an environment slot
of an S4 class, and define the '[',
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 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2012 Jul 07
11
Splitting a character vector.
I am lousy at simple regex and I have not found a solution to a simple problem.
I have a vector with some character values that I want to split.
Sample data
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max jack)")
Desired result
dd2 <- data.frame( xx = c("XXY", "XXY", "CAMP",
2023 Jul 08
1
Getting an error calling MASS::boxcox in a function
No, I'm afraid I'm wrong. Something went wrong with my R session and gave
me incorrect answers. After restarting, I continued to get the same error
as you did with my supposed "fix." So just ignore what I said and sorry for
the noise.
-- Bert
On Sat, Jul 8, 2023 at 8:28?AM Bert Gunter <bgunter.4567 at gmail.com> wrote:
> Try this for your function:
>
>
2018 Oct 05
2
Seg fault stats::runmed
Dear all,
I just found this issue:
dd1 = c(rep(NaN,82), rep(-1, 144), rep(1, 74))
xx = runmed(dd1, 21)
-> R crashes reproducibly in R 3.4.3, R3.4.4 (Ubuntu 14.04/Ubuntu 16.04)
With GDB:
Program received signal SIGSEGV, Segmentation fault.
swap (l=53, r=86, window=window at entry=0xc59308,
outlist=outlist at entry=0x12ea2e8, nrlist=nrlist at entry=0x114fdd8,
print_level=print_level at
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some
wages and supply some simple sums by work category. I
have gone at it with a brute force "for" loop approach
which seems okay as it is a small dataset. It looks
a bit inelegant and given all the warnings in the
Intro to R, etc, about using loops I wondered if
anyone could suggest something a bit simpler or more
efficent?
Example: