Hi there,
I just find a fancy plot like the following:
http://www.nature.com/nature/journal/v505/n7481/images_article/nature12784-f2.jpg
I am wondering how to plot something like that in R. Which package will
be convenient for doing such things.
BTW, the link that points to R graph gallery
Hi
Just for completeness, if you want to get rid of all rows regardless in which
column they are
res3 - res1[complete.cases(res1),]
identical(res2, res3)
[1] TRUE
Petr
-Original Message-
From: arun [mailto:smartpink...@yahoo.com]
Sent: Friday, March 14, 2014 3:19 PM
To: dila radi;
Thanks a lot Jeff for the reply. I usually do what you said i.e,
return a value from the function and save it in the calling
environment when I call the function, but I just wanted to experiment
with the special assignment operator. Could you clarify a small doubt
of mine :
I agree that x refers
Many thanks Jeff. Got it working now.
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: Monday, 17 March 2014 3:21 PM
To: BEUTEL Terry S; r-help@r-project.org
Subject: Re: [R] assigning dataframes in an ifelse statement
Solution is to not use ifelse. Use
Hi Dila,
Suppose 'dat' is the dataset:
str(dat)
#'data.frame': 621 obs. of 5 variables:
# $ V1: int NA 8185 8186 8187 8188 8189 8190 8191 8192 8193 ...
# $ V2: Factor w/ 3 levels 1948,1949,..: 3 1 1 1 1 1 1 1 1 1 ...
# $ V3: Factor w/ 32 levels 1,10,11,..: 32 1 12 23 26 27 28 29 30 31 ...
On 17 Mar 2014, at 06:20 , Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:
Solution is to not use ifelse. Use if...else...
Specifically,
A - if (x==2) B else C
(Newcomers may not immediately catch on to the fact that flow control
statements in R are function calls with syntactic sugar, and
Clearly not. I don't know why you think that should be the expected behaviour.
They are different variables.
---
Jeff NewmillerThe . . Go Live...
DCN:jdnew...@dcn.davis.ca.us
On 03/17/2014 05:07 PM, Jinsong Zhao wrote:
Hi there,
I just find a fancy plot like the following:
http://www.nature.com/nature/journal/v505/n7481/images_article/nature12784-f2.jpg
I am wondering how to plot something like that in R. Which package will
be convenient for doing such things.
S3 classes only dispatch on the basis of the first parameter class. That was
one of the reasons for the development of S4-classed objects. You say you have
the expectation that the object is of a class that has an ordinary `predict`
method presumably S3 in character, so you probably need to
This is workaround by defining the 'global variables' as NULL. Use it with
caution.
### Fooling R CMD check
transition_group_id - NULL
### Fooling R CMD check
setkey(aligtable,transition_group_id,align_origfilename)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research
On 17/03/2014 09:42, ONKELINX, Thierry wrote:
This is workaround by defining the 'global variables' as NULL. Use it with
caution.
Better, see ?globalVariables (available since R 2.15.1).
### Fooling R CMD check
transition_group_id - NULL
### Fooling R CMD check
On 2014-03-16 23:56, Duncan Murdoch wrote:
On 14-03-16 2:57 PM, Göran Broström wrote:
I have always known that matrices are faster than data frames, for
instance this function:
dumkoll - function(n = 1000, df = TRUE){
dfr - data.frame(x = rnorm(n), y = rnorm(n))
if (df){
On 2014-03-17 01:31, Jeff Newmiller wrote:
Did you really intend to make all of the x values the same?
Not at all; the code in the loop was in fact just nonsense. The point
was to illustrate the huge difference in execution time. And that the
relative difference seems to increase fast with
Dear R (list)-users
I'm trying to extract part of a list based on the value of one of the
subsubscript element
As those things are usually quite complicated to explain, let me provide a
simple reproducible example that closely matches my problem (although my
actual list has a few thousands
On 14-03-17 7:27 AM, sylvain willart wrote:
Dear R (list)-users
I'm trying to extract part of a list based on the value of one of the
subsubscript element
As those things are usually quite complicated to explain, let me provide a
simple reproducible example that closely matches my problem
I have this problem with this form:
min (A*X) under some constraints.
the unknown is X that is a Matrix. I can't use the function linp because
in it X is a vector..
How can I do??? Can you help me
[[alternative HTML version deleted]]
__
Try help(quantile.survfit)
Terry Therneau
--- begin included message ---
Hello,
I am using the function survfit in the 'survival' package. Calling the function produces
the median survival
time automatically, as below.
sleepfit - survfit(Surv(timeb, death)~1)
sleepfit
Call:
It works like a charm,
Plus, this method (logical vector for list extraction) opens a wide range a
possibilities for me,
thanks a million Duncan
2014-03-17 12:55 GMT+01:00 Duncan Murdoch murdoch.dun...@gmail.com:
On 14-03-17 7:27 AM, sylvain willart wrote:
Dear R (list)-users
I'm trying to
-- begin included message ---
Hi,
I am fitting a weibull model as follows
my models is
s - Surv(DFBR$Time,DFBR$Censor)
wei - survreg(s~Group+UsefulLife,data = DFBR,dist=weibull)
How can i predict the probabilty of failure in next 10 days, for a new data with group =10
and usefuleLife =100
I don't know much about the frailtyHL package, but from the description it appears to be
fitting the same model as coxme. The latter is designed to work with large data sets.
Terry Therneau
__
R-help@r-project.org mailing list
On 2014-03-17 00:36, William Dunlap wrote:
Duncan's analysis suggests another way to do this:
extract the 'x' vector, operate on that vector in a loop,
then insert the result into the data.frame.
Thanks Bill, that is a good improvement.
Göran
I added
a df=quicker option to your df argument
e.g...
b - gam(Y~s(X)) ## fit
gam.check(b) ## check
fitted(b) ## fitted values
predict(b,newdata=data.frame(X=c(15,16))) ## predictions at new X
see ?predict.gam
On 14/03/14 23:24, Parviz Zare wrote:
Dear Sir,
How I can obtain the predicted values of Y variable with fitting smooth
I started to use the data.table to subset, reshape large data.
But how do I transform a set of columns?
# for a data.frame I would do:
df = data.frame(a = c(a,b,c,d), b = 1:4,c = 1:4)
df[,2:3] = df[,2:3]^2
# but with data.table this somehow similar code produces an error.
dt = data.table(a =
This piece of code is indeed confusing. Generally quantile and BCa
bootstrap do not estimate a global SE, so the glob.sigma slot you want to
access is not really meaningful for those methods.
The result object of a BCa bootstrap as calculated by the mc.bootstrap
function will contain a
Hi,
May be this helps:
dt1 - copy(dt)
dt[,c(b,c):=lapply(.SD,function(x) x^2),.SDcols=2:3]
#or
for(.col in 2:3) set(dt1,j=.col,value=dt1[[.col]]^2)
identical(dt,dt1)
#[1] TRUE
A.K.
On Monday, March 17, 2014 10:27 AM, Witold E Wolski wewol...@gmail.com wrote:
I started to use the
Hello everyone,
I'm trying to visualize a network with many vertices, where the focus is to
detect the evolution of communities over time. My little network has 5000
vertices and 4 edges, and my biggest network has 24 vertices and
approximately 2 million edges.
I want to replicate
Hello,
I would like to name files (.txt, .pdf or lists (or dataframes) with names
composed from subjects' IDs, dates, and times e.g. 003DE, 03 17 2014 and
16:02:30 gives a file named 003DE-031714-160230.txt.
How can I do that?
Thanks for your help.
[[alternative HTML version
On 03/17/2014 07:57 AM, Barbara Rogo wrote:
I have this problem with this form:
min (A*X) under some constraints.
the unknown is X that is a Matrix. I can't use the function linp because
in it X is a vector..
How can I do??? Can you help me
If X is a matrix, then A*X could be a matrix or
Generate the desired name(s) as character variables and use those variables as
the filename when saving it (them).
?paste
?paste0
?sprintf
?format.POSIXct
If you have not converted your timestamps to a time data type yet then you
probably need to do that. You may be able to hack something
ninths - sapply(MyFullList, function(x) x[[9]])
You use sapply so that the result is coerced to a character vector, and
x[[9]] rather than x[9] so that each result is a scalar character.
Using vapply instead of sapply will make the code a little more robust
to errors, since it forces you
Dear R-Family,
I have just downloaded a massive data file from internet
(AphroJP_62STN_V1005.1900.gz). Apparently, the file is compressed with .gz.
When I uncompressed
it, the file was saved in the name (AphroJP_62STN_V1005.1900) of unknown
format. How can I open it in R?
thankyou very much
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of eliza botto
Sent: Monday, March 17, 2014 12:06 PM
To: r-help@r-project.org
Subject: [R] open unknown file format in R
Dear R-Family,
I have just downloaded a massive data
If it's a text file, any of the usual functions, such as read.table(),
scan(), etc.
If it's a binary file, try readBin()
It's up to you to find out what kind of a file it is, and how the data is
structured within the file.
(hint: on a unix-alike system, the 'file' command will tell you something
On Sun, 16 Mar 2014, Duncan Murdoch wrote:
On 14-03-16 2:13 AM, Mike Miller wrote:
I always knew there was some numerical reason why I was getting very
long stretches of 9s or 0s in the write.table() output, but my concern
is really with how to prevent that from happening. So the question
Dear all,
I do have zipped data and want to use the package ff.
Unfortunately I am not able to load the date:
When I try to use ffload I always get:
Error in system(cmd, intern = TRUE) : 'unzip' not found
Conferring to other R-help posts I already downloaded a software for
zipping/unzipping
and
On 17-03-2014, at 21:03, Mike Miller mbmille...@gmail.com wrote:
…...
data[,c(5:9,11,13,17:21)] - signif(data[,c(5:9,11,13,17:21)], digits=5)
Then write.table(data) does what I'd want. It works better than format().
Example:
data2 - data
data2[,c(5:9,11,13,17:21)] -
Hello,
I'm an R beginner and am not sure how to address this question. I've read
through tutorials and am still stuck.
I have a column in my data called Sample. The samples are listed as four
sites (SFHS, SFLS, NFLS, NFHS) with tree numbers (01 through 23) and
replicates per tree (A and B). So, a
I am trying to use heatmap.send() in package sendplot with the example data
given in 'A tutorial for sendplot R package', Section 4.
The code I am using (copied from tutorial) is:
data(mtcars)
x - as.matrix(mtcars)
xy.labels=list(value=x)
x.labels=data.frame(label=colnames(x),
On 2014/3/17 1:12, Jim Lemon wrote:
On 03/17/2014 05:07 PM, Jinsong Zhao wrote:
Hi there,
I just find a fancy plot like the following:
http://www.nature.com/nature/journal/v505/n7481/images_article/nature12784-f2.jpg
I am wondering how to plot something like that in R. Which package will
Hi there,
I hope to rotate the Y label of axis(4) with -90 degree. I can typeset
the Y label using text() with srt = -90. However, I cannot get the
coordinate of the position that mtext() used.
In other words, I hope to convert:
mtext(Y label, side = 4, at = 0, line = 2)
to
text(x, 0, Y
On Mon, 17 Mar 2014, Berend Hasselman wrote:
On 17-03-2014, at 21:03, Mike Miller mbmille...@gmail.com wrote:
…...
data[,c(5:9,11,13,17:21)] - signif(data[,c(5:9,11,13,17:21)], digits=5)
Then write.table(data) does what I'd want. It works better than format().
Example:
data2 - data
Tena koe Jessie
Lots of ways of doing this. Perhaps the easiest, if your data is formatted as
you suggest, is to use substring; e.g., substring(yourData$Sample, 1, 4) should
give you the sites.
Otherwise, you might need to investigate regular expressions.
HTH .
Peter Alspach
On 03/18/2014 09:18 AM, Jinsong Zhao wrote:
Hi there,
I hope to rotate the Y label of axis(4) with -90 degree. I can typeset
the Y label using text() with srt = -90. However, I cannot get the
coordinate of the position that mtext() used.
In other words, I hope to convert:
mtext(Y label, side =
On 14-03-17 6:22 PM, Mike Miller wrote:
On Mon, 17 Mar 2014, Berend Hasselman wrote:
On 17-03-2014, at 21:03, Mike Miller mbmille...@gmail.com wrote:
…...
data[,c(5:9,11,13,17:21)] - signif(data[,c(5:9,11,13,17:21)], digits=5)
Then write.table(data) does what I'd want. It works better than
Dear Dr. Wood and other mgcv experts
In ?gam.models, it says that the numeric by variable is genrally not
subjected to an identifiability constraint, and I used the example in
?gam.models, finding some differences (code below).
I think the the problem might become serious when several varying
Hi,
May be this helps:
dat - read.table(text=Sample
SFLS01A
SFHS05B,sep=,header=TRUE,stringsAsFactors=FALSE)
dat1 -
setNames(as.data.frame(do.call(rbind,strsplit(gsub(([[:alpha:]]+)(\\d+)([[:alpha:]]+),\\1
\\2 \\3,dat$Sample), )),stringsAsFactors=FALSE),c(site,tree,rep))
#or
dat2 -
Hello,
It is in binary format. I didn't use stations. But to read the gridded
format, I used:
readBin(fid, numeric(), n=1e8, size=4, signed=TRUE, endian='little')
where file is the connection created with file()
Hope this helps,
Pascal
On Tue, Mar 18, 2014 at 4:06 AM, eliza botto
hi i am also doing my master degree in link prediction in social network
so i need your help..
which tool should i used for that ??
Waiting for your reply
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
On Mon, 17 Mar 2014, Duncan Murdoch wrote:
On 14-03-17 6:22 PM, Mike Miller wrote:
Thanks! Another thing I've figured out: Use of drop0trailing=T in
format() fixes the .0 stuff that I didn't like:
write.table(format(data[1:10,], digits=5, trim=T, drop0trailing=T),
row.names=F,
On 2014/3/17 15:32, Jim Lemon wrote:
On 03/18/2014 09:18 AM, Jinsong Zhao wrote:
Hi there,
I hope to rotate the Y label of axis(4) with -90 degree. I can typeset
the Y label using text() with srt = -90. However, I cannot get the
coordinate of the position that mtext() used.
In other words, I
The following call to locpoly gives a 'NaN' on one computer and a
number on a different computer:
library(KernSmooth)
x - c(5.84155992364115, 1.55292112974119, 0.0349665318792623,
3.93053647398094, 3.42790577684633, 2.9715553006801,
0.837108410045353, 2.872476865277, 3.89232548092257,
Hi...
Can someone please explain to me what this error message means?
It only appears if I include the correlation= part, but I have no idea why.
Thanks,
Joe
ARModel -lme(Life_Satisfaction ~Time, data = restructuredData, random =
~Time|Person, method = ML, na.action = na.exclude, control =
Hello
I am using 2 for loops to find the difference between all rows of a matrix.
I need to store it to a csv file. I have written this:
for (i in 0:length(datamat)){
for (j in i+1:length(datamat)){
x-datamat[i,]-datamat[j,];
y-as.data.frama(x);
write.csv(y, dif.csv)
}}
datamat is the original
I have the following data frame. Using the stringr package, I've attempted
to map the url's to some specific elements that are in each url. I then
used the reshape package to join two different data frames. The next step
is to transform the two columns in the mydt data frame (forester and
On Mar 17, 2014, at 5:14 AM, Therneau, Terry M., Ph.D. wrote:
Try help(quantile.survfit)
Very handy, now that I know to look for it.
I wonder if you could add quantile.survfit, lines.survfit, and points.survfit
to links on the help page for survfit.object? (I generally look for the list of
Tena koe
What are you doing wrong? For one thing not supplying a simple reproducible
example :-)
Try:
set.seed(12)
(tempMat - matrix(round(100*runif(12), 0), nrow=3))
[,1] [,2] [,3] [,4]
[1,]7 27 181
[2,] 82 17 64 39
[3,] 9432 81
(diffMat - apply(tempMat,
1. I would strongly recommend that you spend some time with one of the
many R tutorials (An Introduction to R ships with R, but there are
many more on the web) before attempting to write any further code or
posting here.
2. Post in plaiin text, not HTML, as code can get scrambled in HTML.
Bert
57 matches
Mail list logo