Hello all!
I want to create a new variable in a dataframe, and this variable is based
on a regression equation. For example for example for the hc=10, the
values of the new variable(d0.3) is obtained by d0.3=15.9122+0.2105*dc, for
hc=30, d0,3 values are obtained by d0.3=1.4781+0.8827*dc.
Thank
On 13-05-2013, at 08:16, catalin roibu catalinro...@gmail.com wrote:
Hello all!
I want to create a new variable in a dataframe, and this variable is based
on a regression equation. For example for example for the hc=10, the
values of the new variable(d0.3) is obtained by
Hi
Without reproducible example you probably do not persuade us to go through your
almost unreadable code.
From what you say I think you need split your file to two - training and
testing
The approach I would use is sampling a row index.
ind- sample(1:nrow(some.data), 300)
testing -
On Thu, 09 May 2013, Neuman Co neumanc...@gmail.com writes:
Hi,
I want to fit a standardized generalized hyperbolic distribution to my
data, I am using the dsgh command of the fBasics package and the optim
command.
I tried the following:
Hello,
I don't know whether it is what you are looking for, but cairo_pdf
seems to embed the fonts automatically, if I am not mistaken.
pdf(russian1.pdf, width=3, height=0.8)
grid.text(\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435
is 'hello' in Russian (Cyrillic))
Hello,
I'm using the function nlminb of the package stats inside a loop and when the
number of trials grows, R crashes and says R
GUI front-end has stopped working. Could you help me with this problem? I have
try in versions 2.15.1,2.15.2 and 3.0.0.
sessionInfo()
R version 2.15.2
Hi
Works for me without error. However are you sure your code does what you
suppose it does?
It does not return anything visible
BB is list 3000x13 with all values same except last element in each node.
AA is list 3000x13 with various values.
ro is a vector with 2997 values 0.001 one value
Hi
Try to make crashes reproducible. As I said it works on my machine without any
problem.
sessionInfo()
R Under development (unstable) (2013-02-13 r61942)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Czech_Czech Republic.1250 LC_CTYPE=Czech_Czech Republic.1250
[3]
Greg, the pairs2 function was exactly what I wanted. Thanks for a very
useful function. May I ask a follow up question, is it possible to draw a
correlation line with R2 values for each graph on each graph, or on the
side of the graph. I am sure this is possible somehow, but I am new to R
Hi deer all
I want to analysis of covariance with R software. What should I do?
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Hi all:
I have a question about poisson regression.
My data:
drug result count
1 1 8
1 254
2 1 20
2 2 44
My model:
model- glm(count ~ drug*result, family = poisson)
My result:
summary(model)
Coefficients:
Estimate Std. Error z
Hello,
it is not clear to me, how to search if in a string there is a . (full
stop).
Using:
grepl(.,string)
doesn't work because the full stop it is a metacharacter (it gives TRUE
also if no full stop is in the character). I tried also to insert \. but it
does not work.
grepl(\.,string)
Error:
On 13-05-13 3:58 AM, irene castro conde wrote:
Hello,
I'm using the function nlminb of the package stats inside a loop and when the number
of trials grows, R crashes and says R
GUI front-end has stopped working. Could you help me with this problem? I have
try in versions 2.15.1,2.15.2 and
On 13-05-13 4:19 AM, Francesco Isotta wrote:
Hello,
it is not clear to me, how to search if in a string there is a . (full
stop).
Using:
grepl(.,string)
doesn't work because the full stop it is a metacharacter (it gives TRUE
also if no full stop is in the character).
Use grepl(., string,
On Mon, 13 May 2013, meng wrote:
Hi all:
I have a question about poisson regression.
My data:
drug result count
1 1 8
1 254
2 1 20
2 2 44
My model:
model- glm(count ~ drug*result, family = poisson)
My result:
summary(model)
Coefficients:
Hello,
You should start by reading the file R-intro.pdf that comes with your
installation of R, Chapter 11 Statistical models in R.
Type the following at an R prompt:
?lm
?anova
Hope this helps,
Rui Barradas
Em 13-05-2013 05:23, masumeh akhgar escreveu:
Hi deer all
I want to analysis of
You may also try:
grepl([.],c(ad.1,ads,ad.2))
#[1] TRUE FALSE TRUE
A.K.
- Original Message -
From: Francesco Isotta isot...@hotmail.com
To: r-help@r-project.org
Cc:
Sent: Monday, May 13, 2013 4:19 AM
Subject: [R] grepl
Hello,
it is not clear to me, how to search if in a string there
At 20:51 10/05/2013, Tomos_D wrote:
That's great thanks
There is a closed form expression for the nth Fibonacci number.
See Wikipedia for details.
--- Original Message ---
From: arun kirshna [via R] ml-node+s789695n4666758...@n4.nabble.com
Sent: May 10, 2013 3:34 PM
To: Tomos_D
Hallo zusammen,
ich mache zuerst mittels eine Anova eine Überprüfung ob in den Daten ein
signifikanter Unterschied exisitiert. Danach will ich mittels des TukeyHSD
rausfinden, zwischen welchen Gruppe der Unterschied vorliegt. Allerdings weiß
ich nicht wie ich die Daten interpretieren soll.
Thanks so much for your help, now I could solve the problem (using [.])!
2013/5/13 arun smartpink...@yahoo.com
You may also try:
grepl([.],c(ad.1,ads,ad.2))
#[1] TRUE FALSE TRUE
A.K.
- Original Message -
From: Francesco Isotta isot...@hotmail.com
To: r-help@r-project.org
Hallo zusammen,
ich mache zuerst mittels eine Anova eine Überprüfung ob in den Daten ein
signifikanter Unterschied exisitiert. Danach will ich mittels des TukeyHSD
rausfinden, zwischen welchen Gruppe der Unterschied vorliegt. Allerdings weiß
ich nicht wie ich die Daten interpretieren soll.
Hello everybody,
I have three variables blue, green and red containing values 0 (no)
and 1 (yes).
How can I easily create another variable colors with the values blue,
green and red?
I hope that you can understand my question and appreciate any solutions or
hints!
Thank you!
David
Hi,
?rgb
HTH
Pascal
2013/5/13 David Studer stude...@gmail.com
Hello everybody,
I have three variables blue, green and red containing values 0 (no)
and 1 (yes).
How can I easily create another variable colors with the values blue,
green and red?
I hope that you can understand my
Hi,
i am tryng to run Bagging SVM but I have a problem. I do Bagging SVM based
on algoritm bagging Trees by Breiman. I get the following error and I think
I am wrong in calculating err.mean and err.vote. I also have difficulty in
making the plot.
library(e1071)
gendata -
Cute answer, Pascal. It may even be the answer to the question the OP
should have asked, but I don't think it answered the question that was
asked. That might be:
c(red[red], green[green], blue[blue])
Cheers,
Bert
On Mon, May 13, 2013 at 7:36 AM, Pascal Oettli kri...@ymail.com wrote:
Hi,
No -- my answer is wrong. I'll leave it to others to correct. Obvious
question to OP: What if more than one of your colors variables
simultaneously have a 1?
-- Bert
On Mon, May 13, 2013 at 8:09 AM, Bert Gunter bgun...@gene.com wrote:
Cute answer, Pascal. It may even be the answer to the
Hi R- User,
I am just wondering how I can make a loop to repeat multiple regression.
I do have more than 3000 dependent variables (example S1, S2..Sn) and put
in different columns but the explanatory variables are the same for all these
dependent variables. I have given an example below. In
OK, seems like nobody understood my question ;-)
Let's make another example:
I have three variables:
data$male and data$female and data$transsexuals
All the three of them contain the values 0 and 1.
Now I'd like to create another variable data$sex. Now in all cases where
data$female==1 the
Jochen,
a) this is an English-spoken mailing list; other languages are not encouraged
nor will they typically generate a lot of replies...
b) your code is fine, so this is not an R-issue; you are rather stuck with some
of the stats background -- you might want to see a friendly local
HI,
May be:
dat1- read.table(text=
male female transsexuals
0 1 0
1 0 0
0 0 1
0 1 0
1 0 0
1 0 0
0 1 0
,sep=,header=TRUE)
dat1$sex-colnames(dat1)[apply(dat1,1,function(x) which(x==1))]
dat1
# male female transsexuals sex
#1 0 1 0 female
#2 1 0
On Mon, May 13, 2013 at 10:24 AM, David Studer stude...@gmail.com wrote:
Hello everybody,
I have three variables blue, green and red containing values 0 (no)
and 1 (yes).
How can I easily create another variable colors with the values blue,
green and red?
Suppose
blue - c(1, 0, 0, 1)
First. Do not use html messages. They are converted to plain text and your
table ends up a mess. See below. It appears the variables are all numeric?
If so, there are two standard approaches to handling multiple scales and
magnitudes with cluster analysis:
1. Use z-scores. The scale() function
Please don't post In HTML. It mangles your code. Figure out how to adjust your
email software.
Your example is incomplete, in that you have not indicated how you are doing
the regression manually (I.e what R code steps are you using?).
If your model is linear, you could do:
deps - as.matrix(
Hello:
How can one match names containing non-English characters that
appear differently in different but related data files? For example, I
have data on Raúl Grijalva, who represents the third district of Arizona
in the US House of Representatives. This first name appears as Raúl
If the dataset is large you may prefer to process it by column instead of by
row. E.g.,
m - matrix(0, nrow=1e6, ncol=3,
dimnames=list(NULL,c(Red,Green,Blue)))
m[cbind(seq_len(nrow(m)), sample(ncol(m), size=nrow(m), replace=TRUE))] -
1
head(d)
Red Green Blue
1 0 0
Build a lookup table for your data.
I think it is a fools errand to think that you can automatically normalize
arbitrary Unicode characters to an ASCII form that everyone will agree on.
BTW: To avoid propagating open joins your data should probably have some kind
of id for the term those
... and I could not resist adding (assuming the vectors are all in a
data frame or matrix, yourdat):
apply(yourdat,1,function(x)c(blue,green,red)[as.logical(x)])
Cheers,
Bert
On Mon, May 13, 2013 at 8:39 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
On Mon, May 13, 2013 at 10:24 AM,
my dataset looks like this in the beginning:
Dosis weight sex
1 06.62 m
2 06.65 m
3 05.78 m
4 05.63 m
5 06.05 m
6 06.48 m
7 05.50 m
8 05.37 m
9 1
There is a certain logic to the behavior. In the complex assignment in
the second line of
x - 1
attributes(x)[[attrName]] - 2012
what happens is first the equivalent of
a - attributes(x) ## a is NULL
a[[attrName]] - 2012 ## a is now a numeric vector
and then
attributes(x)
On 13/05/2013 12:05 PM, Spencer Graves wrote:
Hello:
How can one match names containing non-English characters that
appear differently in different but related data files? For example, I
have data on Raúl Grijalva, who represents the third district of Arizona
in the US House of
Hi David:
My main goal is to be able to find the method/model that estimates the
random effect of site on multiple binomial outcomes in multicenter clinical
trial settings. The methods you have suggested are fixed effects models,
right?
Thanks
Anamika
On Sun, May 12, 2013 at 9:44 PM, David
On May 13, 2013, at 9:08 AM, Anamika Chaudhuri wrote:
Hi David:
My main goal is to be able to find the method/model that estimates the random
effect of site on multiple binomial outcomes in multicenter clinical trial
settings. The methods you have suggested are fixed effects models,
On Mon, May 13, 2013 at 11:22 AM, David Studer stude...@gmail.com wrote:
OK, seems like nobody understood my question ;-)
Let's make another example:
I have three variables:
data$male and data$female and data$transsexuals
All the three of them contain the values 0 and 1.
Now I'd like to
Use dput() to send data to r-help:
dput(Daten)
structure(list(Dosis = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
1L, 1L), weight = c(6.62, 6.65, 5.78, 5.63, 6.05, 6.48, 5.5,
5.37, 6.25, 6.95, 5.61), sex = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = m, class = factor)), .Names
When I melt a data frame with some dates I am getting some strange results. I
seem to lose the date format with POSIXct and get a row of zeros with POSIXlt
Any suggestions as to what I am messing up? Code and data below.
Thanks,
John Kane
Kingston ON Canada
mydata - structure(list(dd1 =
With data.table(), this could be faster
m - matrix(0, nrow=1e6, ncol=3, dimnames=list(NULL,c(Red,Green,Blue)))
set.seed(24)
m[cbind(seq_len(nrow(m)), sample(ncol(m), size=nrow(m), replace=TRUE))] - 1
d- as.data.frame(m)
library(data.table)
dt1- data.table(d)
system.time(d$RGB- with(d,
Thanks very much. I could have sworn I had tried that but obviously I had
not.
So melt() is returning the correct value which is what I had suspected but I
obiously did not convert it properly.I wonder if this buggy enough to mention
the behaviour to the package maintainer?
John Kane
In the first case:
mdat$value-.POSIXct(mdat$value,tz=EST)
mdat$value[1:3]
#[1] 2012-01-01 01:00:00 EST 2012-01-01 02:00:00 EST
#[3] 2012-01-01 03:00:00 EST
mydata$dd1[1:3]
#[1] 2012-01-01 01:00:00 EST 2012-01-01 02:00:00 EST
#[3] 2012-01-01 03:00:00 EST
A.K.
- Original Message -
Hi John,
No problem
If you look at the storage mode:
storage.mode(mydata$dd1)
#[1] integer
I think during melt, it
class(mdat$value)
#[1] numeric
class(mydata$dd1)
#[1] POSIXct POSIXt
I guess during melting, this gets coerced to integer class.
You can also do:
dear R experts---how do I determine what summary(polr( y ~ x )) calls?
it is not summary.lm(polr(y~x)) or summary.mlm or summary.glm, or
stats:::summary.lm or ... in fact, none of the summaryesc methods
seem to invoke what summary invokes.
advice, as always, appreciated.
regards,
/iaw
Look at methods(summary) to get a list of the summary methods - it
includes summary.polr when MASS is loaded. The starred ones are not
in any exported namespace, so summaryesc (which I assume means
name name completion in you UI) may not show them. Use MASS:::summary.polr
to look at it.
Bill
Amazingly enough I think i actually understand that albeit superficially.
Thanks
John Kane
Kingston ON Canada
-Original Message-
From: smartpink...@yahoo.com
Sent: Mon, 13 May 2013 11:22:35 -0700 (PDT)
To: jrkrid...@inbox.com
Subject: Re: [R] melt in reshape2 destroying dates?
Dear all, I have a matrix with all values being log transformed. I want them
back to the values before the transformation. i.e. 2^matrix M. Is there any
easy code to do this? Thanks,Zhengyu
[[alternative HTML version deleted]]
On Mon, 13 May 2013, ivo welch wrote:
dear R experts---how do I determine what summary(polr( y ~ x )) calls?
it is not summary.lm(polr(y~x)) or summary.mlm or summary.glm, or
stats:::summary.lm or ... in fact, none of the summaryesc methods
seem to invoke what summary invokes.
Hello,
Just use what you've written:
m - matrix(1:12, ncol = 3)
2^m # it's a matrix
Hope this helps,
Rui Barradas
Em 13-05-2013 19:41, JiangZhengyu escreveu:
Dear all, I have a matrix with all values being log transformed. I want them
back to the values before the transformation. i.e.
On 13-05-2013, at 20:41, JiangZhengyu zhyjiang2...@hotmail.com wrote:
Dear all, I have a matrix with all values being log transformed. I want them
back to the values before the transformation. i.e. 2^matrix M. Is there any
easy code to do this? Thanks,Zhengyu
Please don't post in
In the example below, I am merging 2 data frames I want everything in the
first one(all)
all2 - merge(all,spets, by.x=c(tdate,symbol),
by.y=c(tdate,symbol),all.x=TRUE)
What if I want to exclude everything in y? I tried below but doesn't seem to
work.
all2 - merge(all,spets, by.x=c(tdate,symbol),
I have a stack of rasters (one per species) and then I have a data frame
with lat/long columns along with a species name.
|fls= list.files(pattern=median)
s- stack(fls)
df-c(x,y,species name)|
I want to be able to just select one raster at a time to use with an
extract function. I want the
Hi,
mat1- matrix(log(1:20),ncol=5)
exp(mat1)
# [,1] [,2] [,3] [,4] [,5]
#[1,] 1 5 9 13 17
#[2,] 2 6 10 14 18
#[3,] 3 7 11 15 19
#[4,] 4 8 12 16 20
mat2- matrix(log2(1:20),ncol=5)
2^mat2
# [,1] [,2] [,3] [,4] [,5]
#[1,] 1 5 9 13
To clarify:
So if in data frame A you have
TdatesymbolTA
12/12/12 AX 123
12/11/12 ZZA4R
12/12/12 WQ B8R
Data frame B
TdatesymbolTA
12/12/12 AX 123
12/11/12 ZZ
I am trying to create my own color pallet, consisting of 18 hexadecimal
colors. I'm having trouble figuring out what to use to define/display
them. ColorRampPallet can only take 3 colors so I was hoping to somehow
create a palette then point to that pallet. Any suggestions? Thanks
--
Nathan
A[!(A$symbol %in% B$symbol), ]
maybe?
# converted your email to a reproducible example, as you should
# have done - use dput() to provide data, not just copy paste.
A - structure(list(Tdate = c(12/12/12, 12/11/12, 12/12/12),
symbol = c(AX, ZZ, WQ), TA = c(123, A4R, B8R)), .Names
= c(Tdate,
thx, everyone. this helped me debug further.
It turns out summary.polr was not my problem, though. instead, I ran
into a weird buglet with the name of my data.frame screwing up
summary.polr.
library(MASS)
N - 50
pairs - data.frame(y=as.factor(as.integer(rnorm(N)*10)),
If you create a dummy variable for spets prior to merging, you can keep
only those rows where this value is missing after merging. For example:
# fake data
all - data.frame(tdate=c(1, 3, 5, 7), symbol=c(2, 4, 6, 8))
spets - data.frame(tdate=c(1, 3, 5, 2), symbol=c(2, 8, 6, 6))
# create a dummy
Nathan,
See the help file on the funciton palette()
?palette
For example, for windows, you can do this ...
windows()
palette(c(#00, #E69F00, #56B4E9, #009E73, #F0E442, #0072B2,
#D55E00, #CC79A7, #FF))
plot(1:9, 1:9, pch=16, cex=8, col=1:9)
Jean
On Mon, May 13, 2013 at 12:41 PM,
Thanks Adam your solution worked perfectly. Thank you all for your
responses.
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-merge-2-data-frame-if-you-want-to-exclude-mutual-obs-tp4666975p4666985.html
Sent from the R help mailing list archive at Nabble.com.
or without plyr you could do, e.g.,
aggregate(df2aggregate[,-1], df2aggregate[id], function(..)
if(is.numeric(..)) mean(..) else if(is.character(..)) ..[1])
Kenn
On Mon, May 13, 2013 at 1:30 AM, Spencer Graves
spencer.gra...@structuremonitoring.com wrote:
Hi, Arun: Thanks. That's exactly
Hi,
datA-read.table(text=
Tdate symbol TA
12/12/12 AX 123
12/11/12 ZZ A4R
12/12/12 WQ B8R
,sep=,header=TRUE,stringsAsFactors=FALSE)
datB- read.table(text=
Tdate symbol TA
12/12/12 AX 123
Hi,
Try:
integrate(Pareto,lower=0,upper=(MM-1)+0.5,x0=x0,alpha2=alpha2)
#170.5065 with absolute error 0.016
A.K.
For a homework assignment I'm constructing a simple code. R keeps returning
that a x0 is missing in evaluating p2.
I can't figure out why.
lab1 - 50; mu - 1; sigma - 1
alpha1 -
Hello,
I coming across a strange problem doing math on an xts object.
If I have an xts object of stock prices (perhaps 5 minute bars of open, high,
low,close) and want to do some math, the results fail.
For example:
d$close[10] - d$open[10] works perfectly
d$close[10] - d$open[9] fails. I
Ivo
I think you should read the help page.
Firstly Y should be an ordered factor - you are fitting a
proportional odds model as the name suggests
Regards
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home:
Hello!
I was wondering if it is at all possible (in vars or maybe outside of
it?) to include non-consequite lags into the model, vor example lags 1 and
3.
So far, it looks like when I set p = 3 under VAR, it includes all lags
(1:3).
Thank you very much!
--
Dimitri Liakhovitski
--
Dimitri
On Mon, May 13, 2013 at 6:47 PM, Noah Silverman noahsilver...@ucla.edu wrote:
Hello,
I coming across a strange problem doing math on an xts object.
If I have an xts object of stock prices (perhaps 5 minute bars of open, high,
low,close) and want to do some math, the results fail.
For
Perhaps I am not looking in the right place, but I am looking for a way to
use lmer() to run a multilevel model that incorporates sampling weights. I
have used the Lumley survey package to use sampling weights in the past,
but according to post I found online from Thomas Lumley in mid-2012, R is
Hi folks,
I'm trying to accomplish something that seems like it should be
straightforward, but I've gotten tied in knots trying to figure it
out. A toy example of my issue is below. I've played with diff and
can't seem to figure out a systematic solution that will give me the
two column output
Hi everyone,
I currently work on a S4 class that has the [ function. I want to capture
the unevaluated expression corresponding to the i param using substitute()
function and do a non-standard evaluation. However R automatically
evaluates the expression and give me its value.
For example:
Given
May be:
matrix(c(test[c(TRUE,diff(test)1)],test[c(which(diff(test)1),length(test))]),ncol=2)
# [,1] [,2]
#[1,] 1 5
#[2,] 22 29
#[3,] 33 40
A.K.
- Original Message -
From: Lizzy Wilbanks egwilba...@ucdavis.edu
To: r-help@r-project.org
Cc:
Sent: Monday, May 13, 2013
#or
indx- c(0,cumsum(diff(test)!=1))
aggregate(test,list(indx),function(x) c(min(x),max(x)))[,-1]
# [,1] [,2]
#[1,] 1 5
#[2,] 22 29
#[3,] 33 40
#or
dat1- data.frame(test,indx)
library(plyr)
ddply(dat1,.(indx),summarize, Min=min(test),Max=max(test))[,-1]
# Min Max
#1 1 5
Hi,
Not sure if this is what you wanted:
mat1- as.matrix(read.table(text=
33 45 50
NA NA 54
,sep=,header=FALSE))
mat2- as.matrix(read.table(text=
24 0.000 0.000
0.000 14 0.000
0.000 0.000 10
On May 13, 2013, at 6:38 PM, Nhan Vu Lam Chi wrote:
Hi everyone,
I currently work on a S4 class that has the [ function. I want to capture
the unevaluated expression corresponding to the i param using substitute()
function and do a non-standard evaluation. However R automatically
evaluates
80 matches
Mail list logo