Displaying 20 results from an estimated 1000 matches similar to: "library which convert dates"
2009 May 29
4
logical vector as a matrix
I have a vector like this:
h <- c(4, 6, NA, 12)
and I create the secound logical vector like this:
g <- c(TRUE, TRUE, FALSE, TRUE)
And my problem is that I would like to get a new "m" vector as a rasult "h"
and "g"( as dot-matrix printer) but with missed "NA" value, for example:
m = (4,6,12)
Do you have any idea?
--
View this message in
2009 Jun 01
2
add values inside vector
I think it's easy problem but I can't find solution.
I have a vector:
vec <- c (23.4, 3.0, 14.7, 7.7)
and I would like to add all values which are inside my vector to each
other.
as a result a want to get one value like sum all values from my vector-
sth=(23.4 + 3.0 + 14.7 + 7.7)
PS. I usually don't know how long is my vector in my function
--
View this message in
2009 May 14
2
I want to avioid unnecessary value
I have a database like this:
"kol1";"kol2";"kol3" ...
"2";"5";"9"
"9";"6";"6"
"4";"6";"5"...
I looking for a kod in R which let mi aviod in column unnecessary value, for
example number "9".
So, if I have:
Kol1
2
9
4
4...
after loop in R I would like to get my
2009 Jun 08
4
seq(...) strange logical value
Do you heve any idea why I get after this instruction everywhere false?
> seq (0, 1, by=0.1) == 0.3
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
But after different step it's ok:
> seq(0, 1, by=0.1) == 0.4
[1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
--
View this message in context:
2009 Jun 01
3
Editor R
Do you know any good editor R?
--
View this message in context: http://www.nabble.com/Editor-R-tp23822342p23822342.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jun 15
2
function inside ifelse
Hi,
Could you tell me, if it's possible to create ifelse and put function
inside, for example:
code{
ifelse ((is.na(vek)), call_fun_1(arguments), call_fun_2(arguments))
call_fun_1 <- function(arguments)
{ sth...
}
}
--
View this message in context: http://www.nabble.com/function-inside-ifelse-tp24035739p24035739.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jun 14
3
if + is.na
Hello!
I wont to use a function is.na()
I have two vectors:
> a=c(1,NA,3,3,3)
> b=c(0,0,0,0,0)
and when I use is.na function it's ok:
> is.na(a)
[1] FALSE TRUE FALSE FALSE FALSE
but I would create sth like this:
for i in 1:length(a){
if (wsp[i] == is.na(a)) {b=43}
}
or like this
if(is.na(a)) b=3 else a
[1] 1 NA 3 3 3
but I always get an error:
the condition has
2010 Jan 06
1
math function - MDS method
Hi,
I need math function which is used in: isoMDS, Sammon and metaMDS method.
Anybody know where I may find it? Any manual or webside?
I would be very happy
Thanks a lot !
--
View this message in context: http://n4.nabble.com/math-function-MDS-method-tp1008294p1008294.html
Sent from the R help mailing list archive at Nabble.com.
2009 May 31
1
Error:non-numeric argument in my function
Hello!
I have a function:
zywnoscCalosc<- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) {
ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){
wekt_n = ndf[i,]
wekt_n_ok = wekt_n[!is.na(wekt_n)]
dl_n = length(wekt_n_ok)
wynik = (1*wekt_n_ok)/(1*dl_n)
}
}
and I get an error like this:
Error in 1 * wekt_n_ok :
2009 Jun 16
1
ifelse(is.na), with function inside
Hi,
I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use is.na(a)
function to get a vector like this:
wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on value in
vector "a"
This is my short code but something is wrong and I don't know what...
for (i in 1:7){
a=c( NA, 3, 4, 4, NA, NA, 3)
fun1=function(x){
x=1
print(x)
}
fun2=function(x){
2009 Aug 13
1
write result in matrix using loop
Hello,
I want call my function (use my database) and write every result in matrix
"wynik" but I always get an error: Error in wynik[, i] <- dodawanie(wzorzec,
wzorzec1) :
number of items to replace is not a multiple of replacement length
I'll be very happy if sb help me
dodawanie<- function ( wzorzec, wzorzec1){
wynik1<-wzorzec + wzorzec1
wynik2<-wzorzec *
2010 Mar 05
2
install rJava in linux
Hi
I'm a problem with installing "rJava" in Linux
I have got in my system : java-sun, java-sun-tools, java-sun-jre
but if I wont install rJava I got a problem like this:
> install.packages("rJava", dependencies = TRUE)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://cran.mirroring.de/src/contrib/rJava_0.8-2.tar.gz'
Content type
2009 Jun 02
2
What do you think about my function?
Hello,
I want to know what do you think about my function. I know that it isn't
briliant :/ but what do you think? What I should do that my function will be
better? (now is very slow and not ideal, sometimes I also get a mistake!)
########## My function #############################################
dzieci<-transform(dzieci, zywnosc=0)
zywnoscCalosc<- function( jedzenie, sklep, n1, n2,
2011 Mar 30
2
summing values by week - based on daily dates - but with some dates missing
Dear everybody,
I have the following challenge. I have a data set with 2 subgroups,
dates (days), and corresponding values (see example code below).
Within each subgroup: I need to aggregate (sum) the values by week -
for weeks that start on a Monday (for example, 2008-12-29 was a
Monday).
I find it difficult because I have missing dates in my data - so that
sometimes I don't even have the
2003 Apr 28
4
how to present a table in powerpoint?
Hi,
I have a nicely printed table of results generated by R's
> print(myresult)
where myresult is a "data frame".
I am trying to put this table into a powerpoint slide for presentation without re-typing and re-formating, i.e.,
present it as it is in the R window. This saves time when there are a lot of tables to be presented.
I tried
> sink("myresult.txt")
>
2011 Jul 22
1
Summing values by weekday and weekend - based on daily dates
Hi, all
Here I created a data frame like
mydates<- seq(as.Date("2010-05-29"), length = 43, by = "day")
myvalues<-runif(43,0,1)
myframe<-data.frame(dates=mydates, day=weekdays(dates), value=myvalues)
dates day value
1 2010-05-29 Saturday 0.14576143
2 2010-05-30 Sunday 0.37669604
3 2010-05-31 Monday 0.74813943
4 2010-06-01 Tuesday
2007 Nov 12
4
time plotting problem
I am completely misunderstanding how to handle dates.
I want to plot a couple of data series against some
dates. Simple example 1 below works fine.
Unfortunately I have multiple observations per day (no
time breakdowns) and observations across years.
(example 2 very simplistic version )
Can anyone suggest a quick fix or point me to
something to read? I thought that zoo might do it but
I seem
2008 May 08
2
Microseconds for a zoo object?
Hello
I have a string which contains microseconds, can anyone help on
constructing this in to a time object, with the microseconds, that I can
take to a ZOO file?
Thanks
Sean
> UK[1,3]
[1] "17:09:53.824"
> UK[1,1]
[1] "2007-12-11 00:00:00"
> mydates <- paste( substr(UK[,1], 1, 10), UK[,3])
> mydates[1]
[1] "2007-12-11 17:09:53.824"
>
2005 Dec 07
1
Dots argument in apply method
Hello everyone,
I'm working on a package using S4 classes and methods and I ran into the
following "problem" when I tried to create an "apply" method for objects
of one of my new classes. I've found a way around the problem but I
wonder if I did not paint myself into the corner. I'd like your opinion
about that.
So I have an object "myObj" of class
2010 Dec 03
2
How to get 'R' to talk BACK to other languages / scripts??
Hey everyone,
I know that I can call 'R' from other scripts, and that I can make
command calls from 'R' (e.g., using system() ). But how can I get 'R' to
RETURN values to the script that called it. E.g., I would like to be able
to do something like the following (as a simpler example) from a bash
script:
#!/bin/bash
myTest=echo /usr/local/bin/R --no-restore