On 07/26/2013 12:13 PM, john d wrote:
Dear all,
Let's say I have the following data.frame:
dat-data.frame(x=rnorm(100), y=rnorm(100,2))
and I plot a histogram of variable x, somethink like:
hist(dat$x, breaks=-5:5)
Now, I'd like to color each bar according to the mean of the cases
according
Hi
I would just use for cycle. Something like
lll - vector(list, length(InputFiles))
for (i in InputFiles) {
everything what you want to do for each file
you can store it in a list
lll[[i]] - whatever you want to store there
}
After populating list you can do anything with it.
Regards
Petr
On 07/26/2013 04:06 AM, John Sorkin wrote:
David Thank you for your thoughts. The data I am analyzing do not
come from a clinical trial but rather from a cohort study whose aim
is to determine risk factors for surgical therapy to treat their
joints. John
As David explained, there are several
Hi Michel,
Sorry, I misunderstood your question.
You could also try:
library(plyr)
df1New-droplevels(ddply(TEST,.(Matricule),function(x) {x[,c(Nom,Prenom)]-
x[1,c(Nom,Prenom)];x}))
df2New-droplevels(ddply(TEST,.(Matricule),function(x) {x[,c(Nom,Prenom)]-
x[nrow(x),c(Nom,Prenom)];x}))
HI,
You could try:
my.data- structure...
pe-round(pe,0)
peMax-as.data.frame(sapply(paste0(a,1:4),function(x) {x1-my.data[,x];
unsplit(lapply(split(x1,x1),function(y) {x2-row.names(pe)[pe[,x]%in% y];
x3-x2[which.max(as.numeric(gsub(\\D+,,x2)))];rep(x3,length(y))}),x1)}),stringsAsFactors=FALSE)
May be this also helps:
XXX: dataset
rl-rle(as.character(XXX$electrode))
dat-do.call(rbind,lapply(seq_along(rl$lengths),function(i){x1-if(rl$values[i]==electrode1
(rl$lengths[i]%/%31)) rep(3,rl$lengths[i]%/%3) else
rl$lengths[i];data.frame(Len=x1,Val=rl$values[i])}))
Hi there,
I just started using lme4 and I have a question about obtaining p-values. I'm
trying to get p-values for the output of a linear mixed-effects model. In my
experiment I have a 2 by 2 within subjects design, fully crossing two factors,
Gram and Number. This is the command I used to
Hi everybody,,
I have a question about R function duplicated(). I have spent days try to
figure this out,but I cant find any solution yet. I hope somebody can help
me..
this is my data:
subj=c(1,1,1,2,2,3,3,3,4,4)
response=c('sample','sample','buy','sample','buy','sample','
Hi,
You may try this (didn't get time to test this extensively)
indx-which(tt$response!=buy)
tt$newcolumn-0
tt[unlist(lapply(seq_along(indx),function(i) {x1-if(indx[i]==nrow(tt))
indx[i] else seq(indx[i]+1,indx[i+1]-1);x2-rbind(tt[indx[1:i],],tt[x1,]);
if(any(x2$response==sample))
HI,
Not sure about what your expected output would be. Also 'CEBPA' was not
present in the Data.txt.
gset- read.table(Names.txt,header=TRUE,stringsAsFactors=FALSE)
temp1- read.table(Data.txt,header=TRUE,stringsAsFactors=FALSE)
lst1-split(temp1,temp1$Names)
mat1-combn(gset[-1,1],2) #removed
Hi,
Sorry,`indx` should be:
indx-which(tt$response==buy) #I changed indx but forgot about it
tt$newcolumn-0
tt[unlist(lapply(seq_along(indx),function(i) {x1-if(indx[i]==nrow(tt))
indx[i] else seq(indx[i]+1,indx[i+1]-1);x2-rbind(tt[indx[1:i],],tt[x1,]);
if(any(x2$response==sample))
Dear reader,
I'm trying to use multiple vectors as rownames for the read.table function.
I tried to insert these vectors as a list, e.g. row.names=c(1,4), from the
excel file. I tried other ways, as if the argument only took continuous tab
separated
columns, e.g. row.names=c(1:4). But, this also
Hi,
I'm new to R, so sorry if this is a simple answer. I'm currently trying to
collapse some ordinal variables into a composite; the program ideally should
take a data frame as input, perform a factor analysis, compute factor
scores, sds, etc., and return the rescaled scores and loadings. The
Dear John,
Use xlim() and ylim() instead of expand_limits()
library(ggplot2)
#sample data from ggplot2
data(Cars93, package = MASS)
dataSet - Cars93
#variables to calculate the range to extend the axis dataVector -
unlist(dataSet[,MPG.city])
dataRange - diff(range(dataSet$MPG.city))
Dear Sibylle,
Have you tried to create a new variable?
ME$fDiversity - factor(ME$Diversity)
H08_lme - lme(
log(Height2008_mean) ~ fDiversity,
data = ME,
random = ~ 1|Plot/SubPlot,
weights = varPower(form = ~Diversity),
na.action = na.omit,
subset = ME$Species == Ace_pse,
method = ML
)
Hello,
Once again, the matrix EWMA has not the correct size.
Did you carefully read the answer by Thomas Stewart?
https://stat.ethz.ch/pipermail/r-help/attachments/20130724/c454b0f7/attachment.pl
Extract of his reply: When you expand the example to 5 stocks,
there will be 15 elements (5
Hi
You provided functions, so far so good. But without data it would be quite
difficult to understand what the functions do and where could be the issue.
I suspect combination of complete cases selection together with subset and
factor behaviour. But I can be completely out of target too.
Hi Rui Arun,
really thanks for investing so much time to deal with this problem! The code
works now for this specific example. However it is not generally robust for
slightly different situations. For instance it cannot correctly handle a slight
variation of the table where I have again 4
Dear all
I am doing a research in clinical psychology and I need to Generate a
block randomization for a clinical trial, with two treatments and
three therapists. I mean I must randomize the clients (all women) to
two kinds of treatment (called treatment as usual and narrative
exposure therapy)
Hi to everyone, first of all thanks for this service, it is being very useful
for me, thanks in
advance.
I am new in R, so I suppose I could make really naive questions, I'm sorry.
I have to impute some missing values and I am trying to do it with VIM library
trough Hot Deck
imputation.
I
Dear community,
How do I change the hyphens that appear when using '-' to n-dash in, for
example, x-axes?
Example code:
axis(1, c(1:2), c(1-4, 23-26), tck=.05)
Thanks
Anders
[[alternative HTML version deleted]]
__
R-help@r-project.org
On 26/07/2013 09:36, Anders Sand wrote:
Dear community,
How do I change the hyphens that appear when using '-' to n-dash in, for
example, x-axes?
Example code:
axis(1, c(1:2), c(1-4, 23-26), tck=.05)
On what device on what platform? The commonest answer would be
'if you want en-dash not
Hi
I recommend to start with
library(fortunes)
fortune(surgery)
Anyway, beside Introduction to R you could go through
CRAN Task View: Design of Experiments (DoE) Analysis of Experimental Data
and specifically through
Experimental designs for clinical trials
This task view only covers
Hi,
You may try:
library(psych)
?block.random()
Also, look this link
http://personality-project.org/revelle/syllabi/205/block.randomization.pdf
A.K.
- Original Message -
From: mina orang minaor...@gmail.com
To: r-help@r-project.org
Cc:
Sent: Friday, July 26, 2013 4:26 AM
Subject: [R]
Thanks Rich and Jim and apologies for omitting the line
x - c(285, 43.75, 94, 150, 214, 375, 270, 350, 41.5, 210, 30, 37.6,
281, 101, 210)
But the fundamental problem remains that vertical spacing is not correct
unless I waste a lot of image space at the top.
Frank
--
Frank E Harrell Jr
Two choices.
If this were a linear model, do you like the GEE approach or a mixed effects approach?
Assume that subject is a variable containing a per-subject identifier.
GEE approach: add + cluster(subject) to the model statement in coxph
Mixed models approach: Add + (1|subject) to the
Hi Dennis,
No problem.
As I mentioned, I was under the understanding that electrode1 occurs only in
multiples of 3. I think your earlier post sounded like that. May be I was
misunderstood. So, my solution was based on that. In the below table, I am
not sure, how you wanted to split. For
Hi
Well, the function init.dfs does nothing as all data frames created inside it
does not propagate to global environment and there is nothing what the function
returns.
Tha last line (when used outside a function) gives warnings but there is no
sign of error.
When
head(ab.1.df)
dmid
Hello,
I have recently discovered the modeest library, and am trying to understand
how to use it with non-numeric data (e.g. determining the most common last
name, or analysing customer demographics âby zip code).
I have the mlv() function working for numeric (double and integer) data,
but it
Hi Dennis,
I guess in this case, instead of Eletrode1 occuring 3 times, it is
Electrode4 exists only 6 times. If that is the situation:
just change:
XXX: data
rl-rle(as.character(XXX$electrode))
dat-do.call(rbind,lapply(seq_along(rl$lengths),function(i){x1-if(rl$values[i]==electrode4
It would be better to wrap it in a function.
fun1- function(x,colName,N,value){
rl- rle(as.character(x[,colName]))
dat-do.call(rbind,lapply(seq_along(rl$lengths),function(i){x1-if(rl$values[i]==value
(rl$lengths[i]%/%N1)) rep(N,rl$lengths[i]%/%N) else
Can you supply some code and data? At the moment the question in not clear, or
not expressed in R terminology. Maybe I'm just not awake yet but
I tried to insert these vectors as a list, e.g. row.names=c(1,4), from the
excel file
does not seem to make any sense at all probably because 'list'
Hi Petr,
Thanks for the quick response. Unfortunately I cannot share the data I am
working with, however please find attached a suitable R workspace with
generated data. It has the appropriate variable names, only the data has
been changed.
The last function in the list (init.dfs()) I call to
Hi Petr,
So sorry, I accidentally attached the complete data set rather than the one
with missing values. I've attached the correct file to this email. RE:
init.dfs() being local, I hadn't even thought of that. I've been away from
OOP for close to 15 years now, so it might be time to revise!
The
Hi
There are probably better options but
merge(data.frame(x=1:154),data.frame(x=names(ab.1.fa[[1]]), y=ab.1.fa[[1]]),
all.x=T)
gives you data frame with NA when there was missing value in the first
data.frame.
You probably can automate the process a bit with nrow function.
Regards
Petr
It would help me to give advice if I knew what you wanted to do with the new curves.
Plot, print, extract?
A more direct solution to your question will appear in the next release of the
code, btw.
Terry T.
On 07/25/2013 05:00 AM, r-help-requ...@r-project.org wrote:
My problem is:
I
Hi list,
While the X matrix deemed to be singular question has been answered in
the list for quite a few times, I have a twist to it.
I am using the coxph model for survival analysis on a dataset containing
over 160,000 instances and 46 independent variables and I have 2 scenarios:
1. If I use
On Jul 25, 2013, at 7:17 AM, Dark wrote:
Hi,
Yes maybe I should have been more clear on my problem.
I want to append the different data-frames back into one variable ( rbind )
and save it as one R Data file.
Indeed. That was the operation I had in mind when I made my suggestions.
Hello,
I am trying to solve the following algebraic differential equation :
dy1 = h - dy3
dy2 = g - dy4
y3 = K1*y1/(y3+y4)
y4 = K2*y2/(y3+y4)
I tried using the function daspk, but it gives me the following error :
out - daspk(y = yini, dy = dyini, times = z, res = liquide, parms = 0)
daspk--
This post has NOT been accepted by the mailing list yet.
This post was updated on Jul 26, 2013; 4:40pm.
Hello,
Two days ago I started my journey with R, and right now I'm struck on
Holtwinters, and have no idea, what I'm doing wrong. So now, I'll show
step by step what I've been doing. Actually
Hello All,
I am not able to install/update XML package, getting the following:
install.packages(XML, lib = .libPaths()[3])
trying URL
'http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip'
Error in download.file(url, destfile, method, mode = wb, ...) :
cannot open
Thanks Terry.
Good points. I recalled last night some exchanges on r-sig-mixed-models
regarding a reasonable number of 'replications' for the estimation of random
effects and it occurred to me that with this study, you will have 0, 1 or 2
events per subject, depending upon the subject risk
Hi Manisha,
I didn't run your dataset as I am on the way to college. But, from the error
reported, I think it will be due to some missing combinations in one of the
dataset. For ex. if you run my previous code without removing CEBPA:
ie.
mat1- combn(gset[,1],2)
Soumitro:
Have you read An Introduction to R. If not, do so, as some of your
confusion appears related to basic concepts (e.g. of factors)
explained there.
1. Presumably your categorical variables are factors, not character.
If so, when you cbind() them, you cbind their integer codes, yielding
Marc,
Thank you for your comments. The data has been previously collected, so the
study is a non-concurrent prospective analysis, i.e. retrospective analysis.
John
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine
Dear R-Users and R-Devels,
I may have found a deprecated option for the 'latex' function in the Hmisc
package. I am working with Hmisc and knitr and tried the following code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb}
\usepackage{ctable}
On 26-07-2013, at 16:18, Przemek Gawin arl...@gmail.com wrote:
This post has NOT been accepted by the mailing list yet.
This post was updated on Jul 26, 2013; 4:40pm.
Hello,
Two days ago I started my journey with R, and right now I'm struck on
Holtwinters, and have no idea, what I'm doing
Hello, R users!
I am trying to double integrate the following expression:
# expression
(1/(2*pi))*exp(-y2/2)*sqrt((y1/(y2-y1)))
for y2y10.
I am trying the following approach
# first attempt
library(cubature)
fun - function(x) { (1/(2*pi))*exp(-x[2]/2)*sqrt((x[1]/(x[2]-x[1])))}
Hello
First thank you very much to Jean, Bill, Brian and David for the answers and
code. I very extremely grateful.
I am eventually going to adapt Brian's code with a very minor alteration. If
one follows the original syntax
End - merge(merge(Start, transformer, by.x=Left,
I have no trouble accessing either of those files. Keep in mind that servers do
not have 100% uptime (and the people responsible for uptime do not monitor this
forum), and any local network problems you may be having cannot be addressed
here. So, in general you need to try more servers, confirm
Thanks for your response. You are right - I am new to R and it's
terminologies. I will follow up on your suggestions.
On Fri, Jul 26, 2013 at 11:22 AM, Bert Gunter gunter.ber...@gene.comwrote:
Soumitro:
Have you read An Introduction to R. If not, do so, as some of your
confusion appears
When you use complete.cases(), it creates a logical vector
that selects cases with no missing values, but it does not
change the rownames in the data.frame and those are carried
through to the factor scores so you could link them up that
way. Alternatively, you could use na.exclude as the
What you need to ensure is that you have sufficient physical memory for the
operations that you want to do. I would suggest at least 3X the size of
the object you want to create. If you have RData files that will result
(after the rbind) into a 40GB object, then you will need over 100GB of
On Jul 26, 2013, at 8:44 AM, Tiago V. Pereira wrote:
I am trying to double integrate the following expression:
# expression
(1/(2*pi))*exp(-y2/2)*sqrt((y1/(y2-y1)))
for y2y10.
I am trying the following approach
# first attempt
library(cubature)
fun - function(x) {
I'm hitting a wall. When I use the 'scrape' function from the package
'scrapeR' to get the pagesource from a web page, I do the following:
(as an example)
website.doc = parse(http://www.google.com;)
When I look at it, it seems fine:
website.doc[[1]]
This seems to have the information I need.
[Sorry I can't quote past messages as I get mail on Nabble and have been
told I can't reply through Nabble].
Thanks Kennel for recommended a narrowing range for usr y-limits. That
does help quite a bit.
But I found a disappointing aspect of the graphics system: When you
change height= on
On Thu, 2013-07-25 at 04:56 -0700, Jeroen wrote:
Dear all,
I am trying to correlate a variable tau1 to a set of other variables (x1,
x2, x3, x4), taking into account an interaction with time ('doy') and place
('region'), and taking into account dependency of data in time per object
ID. My
lattice graphics allow you to specify units in cm or inches, and then the
absolute vertical positioning can be controlled.
On Fri, Jul 26, 2013 at 12:58 PM, Frank Harrell f.harr...@vanderbilt.eduwrote:
[Sorry I can't quote past messages as I get mail on Nabble and have been
told I can't reply
On Jul 26, 2013, at 9:33 AM, David Winsemius wrote:
fun2 - function(x,y) { (xy)*(x0)* (1/(2*pi))*exp(-y/2)* sqrt((x/(y-x)))}
persp(outer(0:5, 0:6, fun2) )
There does seem to be some potential pathology at the edges of the range,
Restricting it to x = 0.03 removes most of that concern.
On 26/07/2013 12:43 PM, Nick McClure wrote:
I'm hitting a wall. When I use the 'scrape' function from the package
'scrapeR' to get the pagesource from a web page, I do the following:
(as an example)
website.doc = parse(http://www.google.com;)
When I look at it, it seems fine:
website.doc[[1]]
By the way, here's a quicker (but slightly more dangerous) way to find the
print.XMLInternalDocument
function: just call debug(print) before printing the object. Two steps
take you to the method, and let you see what it's doing. The danger
comes because now print() will always trigger the
A DESCRIPTION file begins with 0xFFFE and
$ file DESCRIPTION
DESCRIPTION: Little-endian UTF-16 Unicode text, with CRLF, CR line terminators
I think it was created on Windows.
In R (2,15,1 on Debian GNU/Linux), using roxygen2, I get
roxygenize(../GitHub/mice)
Error: Line starting '��P ...' is
Hi,
Using the example code without removing CEBPA:
gset- read.table(Names.txt,header=TRUE,stringsAsFactors=FALSE)
temp1- read.table(Data.txt,header=TRUE,stringsAsFactors=FALSE)
lst1-split(temp1,temp1$Names)
mat1-combn(gset[,1],2)
library(plyr)
Hi Arun,
Many thanks for following this through. Based on your earlier suggestion
with CEBPA, I also edited the code and now it seems work (I removed the non
exiting names). I looked into the current code that you have sent below
and I learnt a few more things. So thank you again.
Your skills
On 25.07.2013 21:05, vanessa van der vaart wrote:
Hi everybody,,
I have a question about R function duplicated(). I have spent days try to
figure this out,but I cant find any solution yet. I hope somebody can help
me..
this is my data:
subj=c(1,1,1,2,2,3,3,3,4,4)
Thank you very much for the help, that's what I was looking for!
Also my apologies for sending an html, I thought I turned it off
(hopefully this time works).
Best regards,
Nicola
__
R-help@r-project.org mailing list
Hey All,
I need to apply different regression lines to different group on my ggplot,
and here is the code I use:
qplot(x=Var1,y=Var2,data=df,color=SiteID,group=SiteID)+geom_point()+geom_smooth(method='lm',formula=log(y)~I(1/x),se=FALSE,size=2)
However the regression for different groups is as
I tried using readTiff() and got the error message Sorry can't handle images
with 32-bit samples
line of code
x - readTiff(C:/Users/550062/Desktop/Data/example1.tif)
So far I have not had any luck finding this error message on google. Any
guess at what it means and how to get the code to work?
On Jul 26, 2013, at 11:51 AM, Uwe Ligges wrote:
On 25.07.2013 21:05, vanessa van der vaart wrote:
Hi everybody,,
I have a question about R function duplicated(). I have spent days try to
figure this out,but I cant find any solution yet. I hope somebody can help
me..
this is my data:
On Jul 26, 2013, at 2:06 PM, David Winsemius wrote:
On Jul 26, 2013, at 11:51 AM, Uwe Ligges wrote:
On 25.07.2013 21:05, vanessa van der vaart wrote:
Hi everybody,,
I have a question about R function duplicated(). I have spent days try to
figure this out,but I cant find any solution
Try reading a different file. The error message says the existing code cannot
read that file.
---
Jeff NewmillerThe . . Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.
Disclaimer: I haven't seen your tif file and I know nothing about
readTiff... but here go some general comments.
TIF files can use different bit depths (number of bits to store each
pixel (or each color for each pixel). Most common software outputs 8-
or 16-bits, but your file probably has a
Hello all.
I am interested in creating a mutable list object in R.
Ideally I would do it through something like this:
x - list(a = list(1:4), b = miao, c = 4:1)
x_RC - as.RefClass(x)
attr(x_RC[[2]], I am) - string
x_RC[[3]] - x_RC[[3]]+1
x_new - as.list(x_RC)
Is that reasonably possible to
Reference classes are implemented with environment objects, which are mutable.
Once you convert to list, the converted object is not mutable, since there is
no such thing as a mutable list. So I would say your request is not possible.
Hello
I'm trying to run the script below for making a boxcox transformation of
some variables contained on an excel file, but i can't get it. I ever have
the same message :
error : $ operator is invalid for atomic vectors
One of the names of the variables is Ec30 and it's the variable I put as
Dear Thierry,
Thank you for your help. My code now works the way I wanted it to.
To other readers out there, I think the reason why the two functions work
differently is because extend_limits only ensures that the axis includes the
coordinates supplied, and does not guarantee that limits will
What is a reliable way to go from a column of a model matrix back to the column
(or columns) of the original data source used to make the model
matrix? I can come up with a method that seems to work, but I don't see
guarantees in the documentation that it will.
In particular, does the order
On some slightly different datasets:
tt1-structure(list(subj = c(1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5,
6, 6, 6, 7, 7, 7, 8, 8, 8), response = structure(c(2L, 2L, 1L,
2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L,
1L, 2L, 1L), .Label = c(buy, sample), class = factor),
HI,
Using the example in ?combine
library(randomForest)
rf1 - randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf2 - randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf3 - randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf.all - combine(rf1, rf2,
Hello!
I have just installed R on an Ubutnu machine (13.04) and keep getting the
following:
erin@erin-Lenovo-IdeaPad-Y480:~$ R
/usr/bin/R: line 236: /usr/lib/R/etc/ldpaths: No such file or directory
R version 3.0.1 (2013-05-16) -- Good Sport
Copyright (C) 2013 The R Foundation for Statistical
On Jul 26, 2013, at 9:45 PM, Erin Hodgess wrote:
Hello!
I have just installed R on an Ubutnu machine (13.04)
Did you follow directions given here:
http://cran.us.r-project.org/bin/linux/ubuntu/
Users who need to compile R packages from source [e.g. package maintainers, or
anyone
I would say that the use of Reduce in this context is bad practice.
from ?Reduce :
Reduce uses a binary function to successively combine the elements of
a given vector and a possibly given initial value.
combine() is obviously not a binary function. do.call() seems to be
THE appropriate idiom.
82 matches
Mail list logo