HI Matt,
I changed the dates a little bit to show dates that are outside the range in
dataset B.
A<- read.table(text="
ID Date Depth Temp
1 2002-05-12 10 12
1 2003-05-13 10 12
1 2003-05-14 10 12
1 2004-04-15 10 12
Hi,
Using the same example:
str1<-paste(colnames(dat1)[grepl("diag",colnames(dat1))],"%in%","vec1",collapse="|")
subset(dat1,eval(parse(text=str1)))
# ID diag1 diag2 diag3 proc1 proc2 proc3
#2 2 k69 i80 u456 z456 z123 z456
#3 3 l91 i801 g678 u456 u123 u123
#4 4 i80 i90 h983
Hi,
The expected output is not clear.
dat1<- read.table(text="ID diag1 diag2 diag3 proc1 proc2 proc3
1 k23 i269 j123 u123 u456 u123
2 k69 i80 u456 z456 z123 z456
3 l91 i801 g678 u456 u123 u123
4 i80 i90 h983 z123 z456 z456",sep="",header=TRUE,stringsAsFactors=FALSE)
vec1<- c("i80
I am trying to add a column to a data frame. Each day for each stock I
make a prediction for a future date. Then I need to compare my
predictions to the actual values. So looking at the first row of data:
For Stock A on 2011-01-01 I predicted that on 2011-01-02 the price would
be 10.25.
Now I
If spacing is critical, use 'sprintf' for creating the output.
> Lines1<- read.csv(textConnection("Year, Day, Hour, Value
+ 2010, 001,0,15.9
+ 2010, 001,1,7.3
+ 2010, 001,2,5.2
+ 2010, 001,3,8.0
+ 2010, 001,4,0.0
+ 2010, 001,5,12.1
+ 201
Hi,
sini<- sin(i)
is.vector(sini)
#[1] TRUE
lni<- log(i)
is.vector(lni)
#[1] TRUE
x<-cbind(int=1,sini,lni)
is.matrix(x)
#[1] TRUE
t(x)*x
#Error in t(x) * x : non-conformable arrays
t(x)%*%x
# int sini lni
#int 20.000 0.9982219 42.3356165
#sini 0.9982219 10.29
try this. Splits the dataframe based on the two IDs and then chooses
the first one in cases where condition not met.
> id1<-c(1,1,2,2,3,3,4,5,5,6,6,7,8,9,9,10)
> id2<-c(22,22,34,34,15,15,76,45,45,84,84,37,52,66,66,91)
> GENDER<-sample(c("G-UNK","G-M","G-F"),16, replace = TRUE)
> ETH <-sample(
Hi,
Suppose you have situations like this: (duplicates are both UNKNOWN and want to
remove those)
example1<-rbind(example,data.frame(id1=c(11,12,12),id2=c(93,95,95),GENDER=rep("G-UNK",3),ETH=rep("E-UNK",3)))
spl<- as.character(interaction(example1$id1,example1$id2))
res1<-do.call(rbind,la
On Sep 7, 2013, at 10:44 AM, li li wrote:
> Hi all,
> Is there a way to change the color of the boxplot plots outliers?
> Thanks.
>Hanna
If you review ?boxplot, you will see that ?bxp is listed in the See Also
section and is used for the actual plotting. In ?bxp is a description of the
Hi,
summary(pres.gam)
Family: gaussian
Link function: identity
Formula:
prestige ~ s(income) + s(education)
Parametric coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 47.3276 0.6914 68.45 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
Hi all,
Is there a way to change the color of the boxplot plots outliers?
Thanks.
Hanna
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting gui
Hi,
example<- data.frame(id1,id2,GENDER,ETH,stringsAsFactors=FALSE)
res<-unique(example[!(grepl("UNK",example$GENDER)|grepl("UNK",example$ETH)),])
res
# id1 id2 GENDER ETH
#1 1 22 G-M E-VT
#3 2 34 G-M E-AF
#5 3 15 G-M E-AF
#7 4 76 G-F E-VT
#8 5 45 G-F E-VT
#
Folks:
1. Ankur needs to read "An Introduction to R" or other R tutorial (on the
web, say), as it appears that he has not made much of an effort to learn
how R works. In particular, R is not a data base and does not (normally, at
user level) use pointers/references. So no automatic updating.
2. I
There are a number of discussions on the interwebs about this problem,
try googleing the error. Starting points might be
http://stackoverflow.com/questions/11374211/jpype-cant-start-the-awt-because-java-was-started-on-the-first-thread
http://lists.apple.com/archives/java-dev/2005/Mar/msg00506.htm
Hello,
What you can do is to write a function to do the change. When you want
to change a value in column Value, it will update the value in column
New. Something like this:
fun <- function(data, row, newval){
data$Value[row] <- newval
data$New <- c(NA, diff(data$Value))
Is there a way in which I can setup a model like that?
Regards,
Ankur Seth
On Sat, Sep 7, 2013 at 4:49 PM, Rui Barradas wrote:
> Hello,
>
> It will not change the value automatically, you will have to rerun the
> code.
>
> Rui Barradas
>
> Em 07-09-2013 11:52, Ankur Seth escreveu:
>
>> Thanks
Hello,
No, I don't believe so. If you change one column and want another column
to change you have to tell R to do it.
Rui Barradas
Em 07-09-2013 12:19, Ankur Seth escreveu:
Is there a way in which I can setup a model like that?
Regards,
Ankur Seth
On Sat, Sep 7, 2013 at 4:49 PM, Rui Barr
Hello,
It will not change the value automatically, you will have to rerun the code.
Rui Barradas
Em 07-09-2013 11:52, Ankur Seth escreveu:
Thanks Rui, but this does not change the value in the new column
automatically if I change the value in the data column. Any ideas?
Regards,
Ankur Seth
Thanks Rui, but this does not change the value in the new column
automatically if I change the value in the data column. Any ideas?
Regards,
Ankur Seth
On Sat, Sep 7, 2013 at 2:11 PM, Rui Barradas wrote:
> Hello,
>
> Try the following.
>
> dat <- read.table(text = "
>
> Date
Hello,
Try the following.
dat <- read.table(text = "
DateValue
08/01/2013100
08/02/2013 100.5
08/03/2013 102
", header = TRUE)
dat$New <- c(NA, diff(dat$Value))
dat
Hope this helps,
Rui B
Hello All,
I am trying to build a model in R. I am facing the following problem...
My Data Frame contains the following data...
DateValue
08/01/2013100
08/02/2013 100.5
08/03/2013 102
No
I have a data frame that looks like
id1<-c(1,1,2,2,3,3,4,5,5,6,6,7,8,9,9,10)
id2<-c(22,22,34,34,15,15,76,45,45,84,84,37,52,66,66,91)
GENDER<-sample(c("G-UNK","G-M","G-F"),16, replace = TRUE)
ETH <-sample(c("E-AF","E-UNK","E-VT"),16, replace = TRUE)
example<-cbind(id1,id2,GENDER,ETH)
where there a
22 matches
Mail list logo