Dear all,
I am encountering problems with the application of ddply within the body of a
self-defined function.
The script is the following:
moncostcarmoto - function(costtype){
costaux_result - data.frame()
for (purp in PURPcount){for (per in PERcount){
As the footer says, provide commented, _minimal_, self-contained, reproducible
code.
This is hardly minimal or reproducible.
Anyway, this probably ought to qualify as a plyr FAQ of some sort: don't use
the summarise function as the FUN argument within a function. Define a named or
anonymous
* David Winsemius qjvafrz...@pbzpnfg.arg [2012-09-05 21:02:16 -0700]:
On Sep 5, 2012, at 8:51 PM, Sam Steingold wrote:
I have a list of data frames:
str(data)
List of 4
$ :'data.frame': 700773 obs. of 3 variables:
..$ V1: chr [1:700773] 200130446465779 200070050127778
On 09/06/2012 05:00 AM, r-help-requ...@r-project.org wrote:
Hi, R experts
I am currently using lmekin() function in coxme package to fit a
mixed effect model for family based genetic data. How can I extract the p
value from a lmekin object? When I print the object in R console, I can
Dear All,
Suppose I have two loops and would like to convert it to sapply, how
to achive the goal?
Below is an example, the calculation inside the loop is not essential,
so please do not use tricks for this part.
a - 1:5
b - 1:10
resu - matrix(NA,nrow=5,ncol=10)
for (i in 1:5)
{
for (j in 1:5)
Hello,
Use expand.grid.
One line at a time, to make it clearer:
a - 1:5
b - 1:10
m - expand.grid(b, a)[, c(2, 1)]
resu - matrix(NA, nrow=5, ncol=10)
for (i in 1:5)
{
for (j in 1:10) # -- was 1:5 in your post
{
resu[i,j]=a[i]+b[j] # will be more complicated
}
}
f -
not practical [...] to rename the column to something unique.
On the contrary, since R is a scripting language it is quite practical.
Depending on the format of your data, it is probably necessary as well.
If all of the files have exactly the same number of rows corresponding to the
same key
On Thu, Sep 06, 2012 at 10:50:00AM -0400, Jie wrote:
Dear All,
Suppose I have two loops and would like to convert it to sapply, how
to achive the goal?
Below is an example, the calculation inside the loop is not essential,
so please do not use tricks for this part.
a - 1:5
b - 1:10
resu
On Sep 6, 2012, at 2:02 AM, HJ YAN wrote:
Hi Arun and David
Thanks a lot for your reply and sorry for sending the csv file. (p.s. I can
download my csv file from the email I sent, so I'm not sure why this doesn`t
work for other users...)
I already explained why. You did not read the
Hi Folks:
Here's the situation:
m - cbind(x=letters[1:3], y = letters[4:6])
m
x y
[1,] a d
[2,] b e
[3,] c f
## m is a 2 column character matrix
d - data.frame(a=1:3,b=4:6)
d$c - m
d
a b c.x c.y
1 1 4 a d
2 2 5 b e
3 3 6 c f
## But please note (as was remarked in a
Hello
Within my panel function, I am using draw.key to create a custom key for
each panel. I'm trying to use grobWidth to calculate the correct width
for the viewport, but it appears to be disregarding the fontfamily when
computing the width. Attached is an example; any ideas what I'm doing
Hi everyone
Can anyone help?
x = c(Treatment, Planned, Actual, Demographics, Outcomes)
for (i in x) {
df - paste(i)[, c(Reference_ID, Arm_ID)]
unique(df) - uniq
as.data.frame(table(uniq$Reference_ID)) - y
i.Arms- paste(y$Var1, y$Freq, sep=_)
Print_Message(Check for the Total No of Arms in
On Sep 4, 2012 5:45 PM, Bert Gunter gunter.ber...@gene.com wrote:
I may be out of line here, but I fail to see what on earth this has to do
with R and why this thread should be continued here.
Perhaps I'll write an R function that hooks into the console prompt and
reminds users every N minutes
Hello,
Say all the below five vectors should have same elements in any situation.
How to find the non matching vectors among these five, if so how we can find
the non matching elements of those vectors?
Can anyone help?
a=c(1,2,3)
b=c(1,2,3,4)
c=c(1,2,3)
d=c(1,2,3)
e=c(1,4,5)
Hi,
I'm a beginner in both statistics and the usage of R. I have been stuck for
days with a problem I hope somebody is willing to help me solving.
I'm trying to create some kind of graphical plot etc. of my results of the
following glm of interactions.
I17-glm(formula = response ~ var1+ var2 +
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Sam Steingold
Sent: Thursday, September 06, 2012 3:43 PM
To: David Winsemius
Cc: r-help@r-project.org
Subject: Re: [R] merge a list of data frames
* David Winsemius
Hi,
There are many ways to do this. As well as the php way mentioned by
Franz, you could use cgi. This would probably be considered the
traditional way of doing it. As we are java web developers we are
aiming to use Rserve (http://www.rforge.net/Rserve/) and tomcat (this
can also interact
Hi R Experts,
Just wanted to know if there's any package in R that can be used for
multi-class multi-label SVM classification(classes are not mutually
exclusive). I am using the e1071 package for multi class classifications
(here there are N mutually exclusive classes) , not sure if the same can
Dear R Users and Developers,
I am trying to do the equivalent of
v - c(1,2,3,3,2,1,)
vu - unique(v)
for a vector such as
v2 - c(1.02, 2.03, 1.00, 3.04, 3.06)
vut - ...
As indicated in the subject, we need approximately unique values with a defined
tolerance, i.e. for the v2 vector the
Dear useR's,
I was comparing results for a logistic regression model between different
library's.
themodel formula is arranged as follows:
response ~ (intercept) + value + group
OR:
glm( response ~ (intercept) + value + group ,
family=binomial(link='logit'))
lrm( response ~
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of oliverjack38
Sent: Wednesday, September 05, 2012 3:57 PM
To: r-help@r-project.org
Subject: [R] Smooth contour of a matrix
Hi R users
I'm looking for a way to do a
Hi Arun and David
Thanks a lot for your reply and sorry for sending the csv file. (p.s. I
can download my csv file from the email I sent, so I'm not sure why this
doesn`t work for other users...)
Anyway, below I used dput() and I am attaching the output from R:
structure(list(V1 =
Hello,
My name is Dontrece Smith. I am creating figures for my GAMs. I change my
qualitative variables to 1 or 2 in my dataset, so I would be able to run my
GAMs. However, R will only display plots for my quantitative variables and
not my qualitative variables. Is there any way to fix this issue?
HI HJ,
No problem.
The gsub() was used to just format your date column to make almost the way you
wanted the results:
dat2$date
# [1] 2012-04-29 2012-04-30 2012-05-01 2012-04-28 2012-04-29
#[6] 2012-04-30 2012-05-01 2012-05-02 2012-04-30 2012-05-01
gsub(.*-(.*)-(.*),\\2/\\1,dat2$date)
#[1]
What did you expect 'print(i).Arms' to do? This is causing part of
the problem since the syntax is not correct.
Also what does 'paste(i)[, c(Reference_ID, Arm_ID)]' do? Does not
seem correct since 'paste' does not return a matrix.
On Thu, Sep 6, 2012 at 2:54 AM, Sri krishna Devarayalu
Hi,
May be this is what you wanted:
I named your dput() data as dat1.
source(HuYan.txt)
head(dat1)
dat1$date- as.Date(dat1$V2,format=%d/%m/%Y %H:%M)
dat2-aggregate(V3~date+V1,data=dat1,mean)
dat2$date1-gsub(.*-(.*)-(.*),\\2/\\1,dat2$date)
dat2$V3-1
xtabs(V3~V1+date1,data=dat2)
date1
V1
On 06-09-2012, at 08:54, Sri krishna Devarayalu Balanagu wrote:
Hi everyone
Can anyone help?
x = c(Treatment, Planned, Actual, Demographics, Outcomes)
for (i in x) {
df - paste(i)[, c(Reference_ID, Arm_ID)]
unique(df) - uniq
as.data.frame(table(uniq$Reference_ID)) - y
i.Arms-
thank you very much,
I will be expecting your book soon.
-
Thank you,
with regards,
Punitha
--
View this message in context:
http://r.789695.n4.nabble.com/linking-HTML-with-R-tp4642276p4642379.html
Sent from the R help mailing list archive at Nabble.com.
On 06/09/2012 6:48 AM, Michael Bach wrote:
Dear R Users and Developers,
I am trying to do the equivalent of
v - c(1,2,3,3,2,1,)
vu - unique(v)
for a vector such as
v2 - c(1.02, 2.03, 1.00, 3.04, 3.06)
vut - ...
As indicated in the subject, we need approximately unique values with a defined
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Sri krishna Devarayalu Balanagu
Sent: Thursday, September 06, 2012 8:54 AM
To: r-help@r-project.org
Subject: [R] Why the error is coming, can anyone help?
Hi everyone
Can
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Michael Bach
Sent: Thursday, September 06, 2012 12:48 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] unique with tolerance
Dear R Users and Developers,
I am trying to do
print(i).Arms
is not valid R syntax. Did you mean
print(i.Arms)
?
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Sri krishna Devarayalu Balanagu
Sent: Wednesday,
Hi Bert,
maybe I'm missing the point, but
dd-cbind(d,m)
does 1, 2 and 3 as desired:
n - data.frame(nx=letters[7:9], ny = 7:9)
str(cbind(d,m,n))
t-letters[7:9]
str(cbind(d,t))
cheers.
Am 06.09.2012 18:03, schrieb Bert Gunter:
Hi Folks:
Here's the situation:
m - cbind(x=letters[1:3], y
Hello all,
Evidently my previous message met some filter due to subject line. I am
re-sending my message. I apologize if this was sent out twice.
Based on Ripley Thompson, Analyst, 1987, I am trying to do a regression of
my data which assumes a linear
relationship between measurements
On Sep 6, 2012, at 9:03 AM, Bert Gunter wrote:
Hi Folks:
Here's the situation:
m - cbind(x=letters[1:3], y = letters[4:6])
m
x y
[1,] a d
[2,] b e
[3,] c f
## m is a 2 column character matrix
d - data.frame(a=1:3,b=4:6)
d$c - m
d
a b c.x c.y
1 1 4 a d
2 2 5 b
Dear R-Users,
I was able to use mvpart package for my multi-response data and was able to
generate the decision tree.
I realized that the colors (3) for the legend are being recycled. In my
situation I have 12
dependent variables and would like to have 12 different colors for the
legend and
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of salind
Sent: Thursday, September 06, 2012 8:56 AM
To: r-help@r-project.org
Subject: [R] Interaction plot glm?
Hi,
I'm a beginner in both statistics and the usage of R. I
On Sep 6, 2012, at 4:50 AM, Dontrece Smith wrote:
Hello,
My name is Dontrece Smith. I am creating figures for my GAMs. I change my
qualitative variables to 1 or 2 in my dataset, so I would be able to run my
GAMs. However, R will only display plots for my quantitative variables and
not my
... and if it Duncan's suggestion won't do, maybe approaching it via
clustering might be useful.
But do note that, as stated, the problem is not well defined, because
transitivity fails: consider
v - c(1,2,3,4,5,10)
with a tolerance of =2. Then 1 is the same as 2 and 3, 2 and 3 are
the same as
On Thu, Sep 6, 2012 at 10:20 AM, David Winsemius dwinsem...@comcast.net wrote:
snipped
I guess this means you are not the one performing the d$c - m step? If you
were under control of that step, you can get different (and more to your
liking) behavior with 'cbind.data.frame':
Correct. d is
Thanks to both of you for suggestions.
I settled for the round() approach.
much obliged,
Michael Bach
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
On Sep 6, 2012, at 6:42 AM, Sam Steingold wrote:
* David Winsemius qjvafrz...@pbzpnfg.arg [2012-09-05 21:02:16 -0700]:
On Sep 5, 2012, at 8:51 PM, Sam Steingold wrote:
I have a list of data frames:
str(data)
List of 4
$ :'data.frame':700773 obs. of 3 variables:
..$ V1: chr
* David Winsemius qjvafrz...@pbzpnfg.arg [2012-09-06 10:30:16 -0700]:
these are the results of applying a model to the test data.
the first column is the ID
In which case you should be using the 'by' argument to `merge`
I already do! see my initial message!
3. sort by the sum/mean of the
Hello,
Try the following.
class(d[3][[1]])
dim(d[3][[1]])
(d2 - cbind(d[1:2], d[3][[1]]))
dim(d2)
Funny how the original names of 'm' are retrieved.
Rui Barradas
Em 06-09-2012 18:28, Bert Gunter escreveu:
On Thu, Sep 6, 2012 at 10:20 AM, David Winsemius dwinsem...@comcast.net wrote:
I would like to fit regression models of the form
y ~ ns(x, df=splineDF)
where splineDF is passed as an argument to a wrapper function.
This works fine if the regression function is lm(). But with lme(),
I get two different errors, depending on how I handle splineDF
inside the wrapper
On Sep 6, 2012, at 10:28 AM, Bert Gunter wrote:
On Thu, Sep 6, 2012 at 10:20 AM, David Winsemius dwinsem...@comcast.net
wrote:
snipped
I guess this means you are not the one performing the d$c - m step? If you
were under control of that step, you can get different (and more to your
This should get you started.
Rich
aa - c(1,2,3)
bb - c(1,2,3,4)
cc - c(1,2,3)
dd - c(1,2,3)
ee - c(1,4,5)
outer.all.equal - function(input.list) {
nn - names(input.list)
if (is.null(nn)) stop(input must be a named list.)
n - length(input.list)
result - vector(list, n*n)
dim(result)
On Sep 6, 2012, at 1:40 AM, Sri krishna Devarayalu Balanagu wrote:
Hello,
Say all the below five vectors should have same elements in any situation.
How to find the non matching vectors among these five, if so how we can find
the non matching elements of those vectors?
non-matching is
I've looked again at Deepayan Sakar's 'Lattice' book and not seeing the
information I know must be in there. A clue stick would be much appreciated.
A pair of box-and-whisker plots for two conditions of the same data set
display each box plot horizontally (see attached pH figure). Relations
Help! Weird behavioral difference between R interactive and command-line?
Hi all,
This weird problem has been bugging me for a while.
If I run the R program in an interactive session, it worked;
But if I run the R program on command-line, it stopped with no reason: with
Execution halted
Dear R-help members,
with the help of one of you the following R-Code was developed. No I have the
(probably simple) problem that I want to increase font size of text and
ylab names from 1 to 2. Unfortunately I'm not able to adjust the margin so,
that the plot is appers complete (all names
On 9/6/2012 7:24 PM, Bert Gunter wrote:
... and if it Duncan's suggestion won't do, maybe approaching it via
clustering might be useful.
But do note that, as stated, the problem is not well defined, because
transitivity fails: consider
v - c(1,2,3,4,5,10)
with a tolerance of =2. Then 1 is the
All,
I have:
sales - c(2300,900,155,102,42,10)
names(sales) - c(Christmas,Valentine's Day,
Mother's Day,Father's Day,
Thanksgiving,New Year's Day)
barplot(sales,ylim=c(0,2500))
But it doesn't place all of the name labels on the plot. So I tried:
sales -
Hello,
(Apologies for length, wanted to get all the relevant detail in that I know
of).
I've been having a lot of trouble with some code for an inventory analysis
problem I was doing, and finally came to the conclusion that it appears
that choose() is returning incorrect values. Specifically:
Him
T his is the third time I have seen this message. I don't have an answer for
you. Someone else might, but repeatedly posting won't make an answer
magically appear, and if no one knows what you are talking about you won't
see any response. In that case you may need to translate your
This is the third time I have seen this message. I don't have an answer for
you. Someone else might, but repeatedly posting won't make an answer magically
appear, and if no one knows what you are talking about you won't see any
response. In that case you may need to translate your references
Your Q1 may be a tad below 3. When printed it is, by default, rounded
to 7 significant digits. E.g.,
3 - 3*10^-16
[1] 3
options(digits=17)
3 - 3*10^-16
[1] 2.9996
choose will truncate, not round, its inputs to make integers out of them
so your 3 - 3*10^-16 is treated as
On Thu, 6 Sep 2012, Richard M. Heiberger wrote:
The primary recommendation is to use the y ~ x formula rather than the
~ y | x formula.
Rich,
I missed this.
The place to look first is in the help files
?bwplot
?panel.bwplot
I tend to grab books first. :-)
Here is a example that
The primary recommendation is to use the y ~ x formula rather than
the ~ y | x
formula. The place to look first is in the help files
?bwplot
?panel.bwplot
Here is a example that matches your data structure
Rich
tmp - data.frame(y=rnorm(20),
x=rep(letters[1:2], each=10))
Look at the staxlab function in the plotrix package.
On Thu, Sep 6, 2012 at 12:03 PM, David-Arnold david-arn...@redwoods.edu wrote:
All,
I have:
sales - c(2300,900,155,102,42,10)
names(sales) - c(Christmas,Valentine's Day,
Mother's Day,Father's Day,
Thanksgiving,New
Dear Rxperts..
I am trying to install a few packages in R (version 2.14.2) on a *64-bit
Window 7* workstation. Some of the errors are posted below.. Both 32-bit
and 64-bit versions of R were installed. I did not get errors while
installing packages through *32-bit R*, except that it could not
Hello,
1. With R-2.15.1 on Windows 7 your first plot places all labels when you
maximize the graphics device.
2. To place the labels in your second plot you can change the margin
settings:
op - par(mar = c(7, 4, 4, 2) + 0.1) # default is c(5, 4, 4, 2) + 0.1
On 06/09/2012 2:09 PM, Shayne Hodge wrote:
Hello,
(Apologies for length, wanted to get all the relevant detail in that I know
of).
I've been having a lot of trouble with some code for an inventory analysis
problem I was doing, and finally came to the conclusion that it appears
that choose() is
As Linus would say:
AGHHH...!
1. Rui's solution clearly violates my conditions 1) and 2) and so does not work.
2. David's violated my UNSTATED condition 4: The order of the columns
cannot be changed. Any matrix columns must be expanded in place
between their flanking columns of the data frame.
HI,
For your question to split by two variables, try this:
dat1-read.table(text=
ID PT_ID BASE IDX_DT OBS_DATE OBS_VALUE CATEGORY DAYS_DIFF
LDL_BASE rf
118485 9624295 164.2 2006-11-21 2009-02-17 157.6 2 819 2006-11-20
2.5
118486 9624295 164.2 2006-11-21
Dontrece,
Try using the all.terms argument to the plot.gam() function.
plot(gam4, shade=TRUE, pages=1, all.terms=TRUE)
Does that work?
Jean
Dontrece Smith smithdon2...@gmail.com wrote on 09/06/2012 06:50:07 AM:
Hello,
My name is Dontrece Smith. I am creating figures for my GAMs. I change
Try using ave(), as in
dat1WithMean - within(dat1, Mean - ave(OBS_VALUE, PT_ID, DAYS_DIFF, FUN
= mean))
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of arun
Sent:
Michi,
Try putting your par() statements BEFORE your barplot() statement. For
example,
oldpar - par(mar=c(18, 7, 2, 2.1))
oldfont - par(font=3)
bp - barplot(data.matrix(geo_barplot_percentage_top10),
...
Jean
Michael Eisenring eimic...@ethz.ch wrote on 09/06/2012 12:40:27 PM:
Dear
For posterity, I found the TeachingDemos::shadowtext option most
agreeable for this problem:
* legend puts a large box around the text which did not seem
possible to shrink, and does not accept vector x, y arguments
* plotrix::boxed.labels did not work with pos=4 (this moved the
text, but
Update: seems one way to skin this cat is to add
gp = gpar(fontfamily=mono)
to the viewport() call itself. If anyone has any suggestions for a
robust way to extract this piece information from the key grob itself
(it's nested several levels deep), I'm all ears.
Thanks
Ben
I accidentally posted the wrong version of my code, omitting the Q1 loop,
and, sure enough that loop generates non-integers:
qfracseq - seq(from = 1, to = 0, by = -.1)
Q - 10
Qseq - Q*qfracseq
Qseq [1] 10.0 9.0 8.0
7.0
[5]
You find code to compute the Cragg-Donald Wald F test statistic to test for
weak instruments (e.g., Stock and Yogo, 2005) below with a working example.
The code reproduces the results from Stata 12 using the same data (see
bottom of this email), but further testing is needed. Use at your own risk.
I am new to R and am encountering memory issues while trying to download a
large table from Green Plump, using sqlQuery. Is there any way this FF
package can help me create a large dataframe in R while downloading from the
server?
The FF documentations are very confusing. Thanks for any
On Sep 6, 2012, at 2:45 PM, Shayne Hodge wrote:
I accidentally posted the wrong version of my code, omitting the Q1 loop,
and, sure enough that loop generates non-integers:
qfracseq - seq(from = 1, to = 0, by = -.1)
Q - 10
Qseq - Q*qfracseq
Qseq [1] 10.0
Hi Weija,
You can also try this instead of the loop solution in my previous reply.
dat1-read.table(text=
ID PT_ID BASE IDX_DT OBS_DATE OBS_VALUE CATEGORY DAYS_DIFF
LDL_BASE rf
118485 9624295 164.2 2006-11-21 2009-02-17 157.6 2 819 2006-11-20
2.5
118486 9624295
Hi,
Try this:
list1-list(a=a,b=b,c=c,d=d,e=e)
dat1-as.matrix(do.call(rbind,lapply(list1,`[`,1:4)))
dat1[duplicated(dat1)|duplicated(dat1,fromLast=TRUE),]
[,1] [,2] [,3] [,4]
#a 1 2 3 NA
#c 1 2 3 NA
#d 1 2 3 NA
Wanting a commandline solution (for a problem detailed @
http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2012/msg00279.html
) I turned to Rscript, and whacked out the q'n'd
https://github.com/TomRoche/GEIA_to_netCDF/blob/master/netCDF.stats.to.stdout.r
However it wasn't as
Dear R People:
Suppose I have the following:
x - 1:4
And I want to create the following matrix:
1 2 3 4
2 1 2 3
3 2 1 2
4 3 2 1
Is there a function in place for this, please? I looked at symMatrix
in micEcon and some of the items in Matrix, but they didn't quite do
it.
I can put together
toeplitz(1:4)
[,1] [,2] [,3] [,4]
[1,]1234
[2,]2123
[3,]3212
[4,]4321
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org
Hi Tom,
Using the script below I had no trouble. Here's an example
Minke:R ben$ Rscript --no-init-file ./argCatcher.rs ./the=trouble .with=./args
is=the.y argue
./the=trouble
.with=./args
is=the.y
argue
# script starts here
# argumentCatcher.rs
args = commandArgs(trailing = TRUE)
cat(args,
To bootstrap from a histogram, use
sample(bins, replace = TRUE, prob = counts)
Note that a kernel density estimate is biased, so some bootstrap
confidence intervals have poor coverage properties.
Furthermore, if the kernel bandwidth is data-driven then the estimate
is not functional, so some
On Thu, Sep 06, 2012 at 02:45:20PM -0700, Shayne Hodge wrote:
I accidentally posted the wrong version of my code, omitting the Q1 loop,
and, sure enough that loop generates non-integers:
qfracseq - seq(from = 1, to = 0, by = -.1)
Q - 10
Qseq - Q*qfracseq
Qseq [1] 10.0
82 matches
Mail list logo