Hi
Hello all
I'm new to R and am experiencing a problem with a categorical variable.
All
the data of this variable are Low, High, or NA. When I put
summary(x$y), it gives me the number of High, Low, and NA entries.
However,
when I try to subset by writing x$y==Low or x$y==High, R
Hi
[R] question about rev
Hi,all:
I have a vector,and wanna get the opposite value via rev function.
a
[1] FALSE FALSE TRUE TRUE TRUE
rev(a)
[1] TRUE TRUE TRUE FALSE FALSE
I don't know why the 3rd TRUE has not been reversed,while all other
values are reversed?
That comes really close to what I had in mind.
Thanks a lot for helping out, Justin!
Good luck,
Mario
Re: [R] ggplot2 - tricky problem
how bout:
dat-data.frame(id=1:4,city=c('berlin','munich'),likeability=c(5,4,6,5),uniqueness=c(3,4,4,4))
ggplot(ddply(melt(dat,
HI
I want to remove an element from a list or character. i can any of the class
type
like
cat= [1] mac med
if my input is 2 i need to remove med and if my input is one i need to
remove mac from cat
Please help
-
Thanks in Advance
Arun
--
View this message in context:
Thanks Bert
I've been through my variables again and have managed to get the code
working - shouldn't have tried to deal with it at the end of the day
yesterday!
all the best
Lian
--
View this message in context:
Yes£¬I find out later.
rev is only reverse the order.
What I use is !
Thanks
At 2012-01-06 16:07:11,Petr PIKAL petr.pi...@precheza.cz wrote:
Hi
[R] question about rev
Hi,all:
I have a vector,and wanna get the opposite value via rev function.
a
[1] FALSE FALSE TRUE TRUE
i have been trying RJDBC for many hours but still failed to connect to my
sql server.
platform: win7 professional; SQL server 2008 express;
the code is :
drv - JDBC(com.microsoft.sqlserver.jdbc.SQLServerDriver,
C:/Users/myname/sqljdbc_3.0/enu/sqljdbc4.jar);
the function /rev / REVERSEs the order of the vector, as
v= c(1,2,3)
rev(v)= 3,2,1
if you want the opposite value , just add a exclamation in front of the
vector:
v=c(T,F,T,T);
!v is F,T,F,F
--
View this message in context:
http://r.789695.n4.nabble.com/question-about-rev-tp4268518p4268716.html
Le jeudi 05 janvier 2012 à 23:52 -0800, arunkumar a écrit :
HI
I want to remove an element from a list or character. i can any of the class
type
like
cat= [1] mac med
if my input is 2 i need to remove med and if my input is one i need to
remove mac from cat
This is really
I asked a while ago what diagnostic plots exists for quantile regression,
here:
http://stats.stackexchange.com/questions/19291/what-diagnostic-plots-exists-for-quantile-regression
And had received no answer.
I hope some more information will become available regarding this.
Best,
Tal
On Jan 6, 2012, at 06:20 , arabarkev wrote:
Hello all
I'm new to R and am experiencing a problem with a categorical variable. All
the data of this variable are Low, High, or NA. When I put
summary(x$y), it gives me the number of High, Low, and NA entries. However,
when I try to subset
Hi,
I would like to know how can I keep adding data to a file while doing a loop
and without deleting the data of the previous iteration. Thanks.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
Without context, read reproducible code, it is hard to answer this
question. What system are you on? Do you need to write one line of
data or a data frame or a list out? Are trying to write a graphic out?
It will be easier to answer your question with some context. Good
luck!
Stephen
On
Dear All,
I was searching through the spatstat manual in order to find a function to
simulate a Poisson pattern only within a fixed radius (circular moving window)
around individual points. If points are distributed heterogeneously over a
large area this may help to only assess deviation from
Thanks for the reply. Every iteration produces a text data.frame directly into
a file without saving it in R. And every iteration overwrites the data produced
from the previous iteration. So what I would like to do is being able not to
overwrite the data of any iteration but adding it to the
After so many questions and a considerable delay (almost entirely my
fault), the BRugs package version 0.7-4 has been released yesterday. The
BRugs package is available from CRAN master already as source and in
binary form for Windows and will be synced by the mirrors shortly.
Note the
After changing involuntarily some of the graphics parameters with
the command par() (I did not know that changes with this command are
permanent), now when I made a plot of the survival Kaplan-Meier
function, the Y axis does not start at 1, and the X axis does starts
at 0. The commands that I use
I've developed a preference for
x$y %in% Low
when subsetting.
Benjamin Nutter | Biostatistician | Quantitative Health Sciences
Cleveland Clinic | 9500 Euclid Ave. | Cleveland, OH 44195 | (216)
445-1365
-Original Message-
From: r-help-boun...@r-project.org
Ben's solution is much better, I was using only Jonas' code.
There might be typo with large values of 'x',
getSIstring(1e309)
[1] Inf Y
I don't believe this will happen, the range upper limit is much smaller.
Anyway, it can be easily solved.
(Ben's code, slightly changed.)
getSIstring -
Hello
I have a data frame, called input, like this:
DateTime CO2_A1cont
1 2011-04-08 11:47:01 NA
2 2011-04-08 12:42:018.9
3 2011-04-08 13:07:01 NA
4 2011-04-08 13:32:01 NA
5 2011-04-08 13:57:01 7.556482
6 2011-04-08 14:22:01 NA
57
Hello,
See
?open and ?capture.output
or
?textConnection
To open a connection (with 'open') then write to it is probably the
solution.
Rui Barradas
--
View this message in context:
http://r.789695.n4.nabble.com/add-data-to-a-file-while-doing-a-loop-tp4269086p4269396.html
Sent from the R
Dear all,
In lme, models in which a factor is fully contained in another lead to
an error. This is not the case when using lm/aov.
I understand that these factors are aliased, but believe that such
models make sense when the factors are fitted sequentially. For example,
I sometimes fit a
There was a trailing white space!
Now I feel not so smart
Thanks a lot for your help!
--
View this message in context:
http://r.789695.n4.nabble.com/R-not-recognizing-words-tp4268283p4269326.html
Sent from the R help mailing list archive at Nabble.com.
So you're looking for:
write.table(dataset, file=x.txt, append=TRUE)
Or do I understand your question wrongly?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
On Jan 6, 2012, at 8:27 AM, Joao Fadista wrote:
Thanks for the reply. Every iteration produces a text data.frame
directly into a file without saving it in R. And every iteration
overwrites the data produced from the previous iteration. So what I
would like to do is being able not to
Hi,
I just started playing w/ venneuler, and have a question about the last
method listed for creating inputs. This is the method where the source
is a matrix X, for which each column represents a set, and the
co-occurrence is defined by the rows. So, for example:
Rgames foo
[,1]
Dear all,
ggplot gives me an error when trying to plot time series data using a
date variable as the x axis.
g-structure(list(Date = c(2011-12-23, 2011-12-30, 2012-01-06,
2011-12-23, 2011-12-30, 2012-01-06, 2011-12-23, 2011-12-30,
2012-01-06), variable = structure(c(1L, 1L, 1L, 2L, 2L, 2L,
3L,
On Fri, Jan 6, 2012 at 5:49 AM, raphael.fel...@art.admin.ch wrote:
Hello
I have a data frame, called input, like this:
DateTime CO2_A1cont
1 2011-04-08 11:47:01 NA
2 2011-04-08 12:42:01 8.9
3 2011-04-08 13:07:01 NA
4 2011-04-08 13:32:01 NA
5
Dear all,
I am trying to design a Wald test to verify whether some coefficients are
statistically equal.
I would like to test not only whether they are jointly equal for a given
quantile, but for a range of quantiles. Hence, I need to extract the
variance-covariance matrix among the
How does R do it, and should I ever be worried? I always remove
columns by index, and it works exactly as I would naively expect - but
HOW? The second illustration, which deletes non contiguous columns,
represents what I do all the time and have some trepidation about
because I don't know the
Dear all,
I have a question about the plotting of the dynamical orbit by using rgl.
My code is as follows:
open3d()
par3d(cex=2)
bg3d(white)
for(i in 1:out.length){
ind-which
plot3d(x[1:i],y[1:i],out[,z][1:i],xlim=c(-10,10),ylim=c(-10,10),zlim=c(-10,10),col=red,cex=2)
Sys.sleep(0.0001)
}
,where
Hello,
I created a data.frame which contains two columns: df$P (Power) et
df$DateTime (time). I'd like to add a new column df$diffP (difference of
Power between T and T-2).
I made a loop :
for (i in 3:length(df$DateTime)){
df$diffP[i] = df$P[i] - df$P[i-2]
}
execution time result is
Hello List:
I'm writing in R some code to produce plots for residual analysis and
diagnostics in linear regressions. An example of the plots produced is given
for downloading at http://dl.dropbox.com/u/25445316/res_plots.png . Regarding
the example plot, I'd like to point out that: 1)
1. You are doing exactly what one is recommended to avoid in R. Have
you read an Introduction to R? -- especially about vectorization?
2. To answer your question: ?diff
It will probably be an order or 2 of magnitude faster.
-- Bert
On Fri, Jan 6, 2012 at 6:39 AM, ikuzar raz...@hotmail.fr
Try this:
df - data.frame(power = runif(1))
# add difference
diffGap - 2
df$diff - c(rep(NA, diffGap), head(df$power, -diffGap) - tail(df$power,
-diffGap))
head(df, 10)
powerdiff
1 0.86170585 NA
2 0.90672473 NA
3 0.96868367 -0.10697782
4 0.44199262
Is this an example of what you want to do?
fileName - tempfile(fileext=.txt)
fileCon - file(fileName, wt) # a file connection, opened for writing text
for(i in 1:5) {
cat(file=fileCon, Line, i, \n) # write to connection, not file name
}
close(fileCon)
Then look to see what the
On Jan 6, 2012, at 10:00 AM, Mike Harwood wrote:
How does R do it, and should I ever be worried? I always remove
columns by index, and it works exactly as I would naively expect - but
HOW? The second illustration, which deletes non contiguous columns,
represents what I do all the time and
Pascal A. Niklaus pascal.niklaus at ieu.uzh.ch writes:
In lme, models in which a factor is fully contained in another lead to
an error. This is not the case when using lm/aov.
I understand that these factors are aliased, but believe that such
models make sense when the factors are fitted
On 06/01/2012 9:13 AM, Phillip Von wrote:
Dear all,
I have a question about the plotting of the dynamical orbit by using rgl.
My code is as follows:
open3d()
par3d(cex=2)
bg3d(white)
for(i in 1:out.length){
ind-which
Dear All,
I have a bunch of data points as follows:
x 100
y 200
z 300
...
where 100, 200, 300 are the values. I would like to know the distribution of my
data? how can I fit my data into a distribution?
Thanks a lot,
Andra
[[alternative HTML version deleted]]
Thank you, David. I was merely using head to limit the code/
output. My question remains, because a created data frame has the
same columns as was output from head:
head(orig.df,3)
num1.10 num11.20 lc1.10 lc11.20 uc1.10 uc11.20
1 1 11 a k A K
2 2
Hello,
I am trying to run the code for quadratic discriminant analysis with the
Spambase data set following the code example in the book R in a Nutshell
by Joseph Adler (page 443).
The line of code:
spam.qda - qda(formula=is_spam~.,
data=spambase.training)
I think it's even simpler than that:
plot(y~as.POSIXct(times, format=%d.%m. %H:%M), type=l,
data=na.omit(data.frame(y,times)))
This is using y from the data specification in the plot command (not the
y in the base environment, or you'd be getting the same error), and
data= is specifying the
On Fri, Jan 6, 2012 at 10:00 AM, Mike Harwood harwood...@gmail.com wrote:
How does R do it, and should I ever be worried?
You should be worried, but not about that.
I always remove
columns by index, and it works exactly as I would naively expect - but
HOW? The second illustration, which
MASS::fitdistr
Michael
On Jan 6, 2012, at 10:47 AM, Andra Isan andra_i...@yahoo.com wrote:
Dear All,
I have a bunch of data points as follows:
x� 100
y� 200
z� 300
...
where 100, 200, 300 are the values. I would like to know the distribution of
my data? how can I fit my data
On Jan 6, 2012, at 11:43 AM, Mike Harwood wrote:
Thank you, David. I was merely using head to limit the code/
output. My question remains, because a created data frame has the
same columns as was output from head:
head(orig.df,3)
num1.10 num11.20 lc1.10 lc11.20 uc1.10 uc11.20
1 1
Ok, thanks, it works !
--
View this message in context:
http://r.789695.n4.nabble.com/data-frame-temporal-complexity-tp4269585p4270073.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Look at the documentation for whatever function you are using to write
data to the file.
It should be pretty obvious (look for an append argument).
Otherwise you'll have to provide more information, such as a short simple
example of what you have tried.
-Don
--
Don MacQueen
Lawrence Livermore
I have two one dimensional list of elements and want to perform cbind and
then write into a file. The number of entries are more than a million in
both lists. R is taking a lot of time performing this operation.
Is there any alternate way to perform cbind?
x = table1[1:100,1]
y =
Hi Gregory,
See below.
On Jan 5, 2012, at 4:20 PM, gregory benison wrote:
As Duncan noted, the message is pretty clear in that the ODBC header files
are missing, which are required to compile RODBC from source. On RH based
Linuxen, this requires the installation of the unixODBC-devel RPM,
What's wrong with rpoispp in spatstat? It can simulate over a polygon,
which can of course be used to closely approximate a circle. There is also
spsample in the sp package.
I'd also suggest asking this question on r-sig-geo.
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East
I have two dataframes and want to perform cbind and then write into a
file. The number of entries are more than a million in both frames. R is
taking a lot of time performing this operation.
Is there any alternate way to perform cbind?
x = table1[1:100,1:4]
y = table2[1:100,3:6]
Hi All,
I've just recently discovered the cmpfun function, and was wanting to to
create a function to assign this to all the functions i have created, but
without explicitly naming them.
I've achieved this with:
foo - function(x) { print(x)}
bar - function(x) { print(x + 1)}
foo - function(x)
Something like this (not tested)?
df$diffP - c(NA, NA, diff(df$P,2))
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/6/12 6:39 AM, ikuzar raz...@hotmail.fr wrote:
Hello,
I created a data.frame which contains two
That MASS::fitdistr is used for the case when I have some sense about the
distribution of my data. When I do not know anything about my data, is there
any function that can I use to tell what distribution of my data is?
Thanks a lot,
Andra
From: R. Michael
For me, this example runs in a fraction of a second:
t1 - data.frame(matrix(rnorm(3e6),ncol=3))
t2 - data.frame(matrix(rnorm(3e6),ncol=3))
t3 - cbind(t1,t2)
dim(t3)
[1] 100 6
Maybe it takes longer if your data frames have other classes of objects in
them.
If some of your data frame
You could break the data into chunks, so you cbind and save 50,000
observations at a time. That should be less taxing on your machine and
memory.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Mary Kindall
Sent: Friday, January
On Jan 6, 2012, at 1:02 PM, Andra Isan wrote:
That MASS::fitdistr is used for the case when I have some sense
about the distribution of my data. When I do not know anything about
my data, is there any function that can I use to tell what
distribution of my data is?
?density
Using append=TRUE in many functions will work, but
more slowly than opening a connection once, writing
to the connection many times, then closing it.
(Opening a file is a pretty expensive operation,
while writing to it is much cheaper.) Some more
recently written functions do not have an append=
Thank you all for your useful replies. I got it to work!
Best regards,
João Fadista, Ph.D.
Post Doc
Lund University Diabetes Centre
CRC, Malmö University Hospital
Entrance 72, building 60, level 13
SE-205 02 Malmö, Sweden
Tel: +46 (0)40 391237
e-mail: joao.fadi...@med.lu.se
-Original
I did not test this way, I 'll do it later, I think that df$diffP - c(NA,
NA, diff(df$P,2)) is the best way to compute the difference !! I 'll post
the result here
--
View this message in context:
http://r.789695.n4.nabble.com/data-frame-temporal-complexity-tp4269585p4270256.html
Sent from the
On Jan 6, 2012, at 11:43 AM, Mary Kindall wrote:
I have two one dimensional list of elements and want to perform cbind and
then write into a file. The number of entries are more than a million in
both lists. R is taking a lot of time performing this operation.
Is there any alternate way to
except, of course, that the distributions of all finite sets of
data are the same: discrete.
I think Andra would do well to seek help from his/her local
statistician, as his/her query seems to indicate considerable
confusion about basic concepts.
Please excuse me if I have misjudged.
--
Please excuse me for having posted a similar question on ecolog, but thus
far I have received few useful answers there.
I am looking for some advice concerning techniques in R that are
appropriate for correlated count data.
Specifically, I have some freezing days data, which is a count of the
On Jan 6, 2012, at 12:43 PM, Mary Kindall wrote:
I have two one dimensional list of elements and want to perform
cbind and
then write into a file. The number of entries are more than a
million in
both lists. R is taking a lot of time performing this operation.
Is there any alternate way
On Jan 6, 2012, at 12:39 PM, Marc Schwartz wrote:
On Jan 6, 2012, at 11:43 AM, Mary Kindall wrote:
I have two one dimensional list of elements and want to perform cbind and
then write into a file. The number of entries are more than a million in
both lists. R is taking a lot of time
Hello, happy new year.
I've come back to a problem from last spring. I need to understand
what what is the technically correct method to save a seed and then
re-set it. Although this example arises in the context of MT19937,
I'm needing to do this with other generators as well, including
Hello,
I believe this function can handle a problem of that size, or bigger.
It does NOT create the full matrix, just writes it to a file, a certain
number of lines at a time.
write.big.matrix - function(x, y, outfile, nmax=1000){
if(file.exists(outfile)) unlink(outfile)
testf
Hi Paul,
Did you try looking at s1, or ?.Random.seed
s1 - 444
set.seed(s1)
will give you the same result as
set.seed(444)
but .Random.seed does not contain the seed (444), but the state of
the RNG, and is an integer vector.
You can save that state using
s1 - .Random.seed
and restore it
On 12-01-06 12:18 PM, Michael Pearmain wrote:
Hi All,
I've just recently discovered the cmpfun function, and was wanting to to
create a function to assign this to all the functions i have created, but
without explicitly naming them.
I've achieved this with:
foo- function(x) { print(x)}
bar-
In S+ you can do
orig - .Random.seed
x - runif(10)
set.seed(orig)
identical(x, runif(10)) # return TRUE
because S+'s set.seed interprets a non-scalar
input as a copy of an old .Random.seed and assigns
it in the proper location. (It throws an error
if it is not a valid value for
Hi, Let me start my saying that I am new to R hence my grasp of the
appropriate used of R coding is undoubtedly way behind many on this forum.
I am trying to use boostrapping to derive errors around my parameter
estimate for the fixed effects in the following model. It is simply
estimating the
Sorry Mary,
My function would write the remainder twice, I had only tested it
with multiples of the chunk size.
(And without looking at the lenghty output correctly.)
Now checked:
write.big.matrix - function(x, y, outfile, nmax=1000){
if(file.exists(outfile)) unlink(outfile)
testf -
I'm trying to understand how to set graphical parameters for trees created with
the party package. For example take the following code:
library(party)
data(airquality)
airq - subset(airquality, !is.na(Ozone))
airct - ctree(Ozone ~ ., data = airq,
controls =
What is it you want to do with the data after you save it? Are you
just going to read it back into R? If so, consider using save/load.
On Fri, Jan 6, 2012 at 12:43 PM, Mary Kindall mary.kind...@gmail.com wrote:
I have two one dimensional list of elements and want to perform cbind and
then
Hi, is there a way to collapse/expand the Sweave chunks?
Best
Riccardo
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide
On 07/01/12 02:17, herbert8...@gmx.de wrote:
Dear All,
I was searching through the spatstat manual in order to find a function to
simulate a Poisson pattern only within a fixed radius (circular moving window)
around individual points. If points are distributed heterogeneously over a
large
1. If you do not have unixODBC installed, you will get an error message
regarding a missing ODBC driver manager, if as you have done here, that test
is first rather than second.
If the test for the headers comes first, and no driver manager is
installed, configure exits with an error before
Hello,
I have one column in my dataframe that has gene names of interest.
Unfortunately, due to the fact that some probes lie between two genes or
two transcripts of a gene, it looks something like this -
FAM81A LOC283050;LOC283050;LOC283050;ZMIZ1 PINK1;PINK1 MRPL12;MRPL12
C1orf114
I think you can do this with something like this (untested):
unique(unlist(strsplit(XXX, ,)))
Michael
On Jan 6, 2012, at 8:05 PM, Kurinji Pandiyan kurinji.pandi...@gmail.com wrote:
Hello,
I have one column in my dataframe that has gene names of interest.
Unfortunately, due to the fact
On Fri, Jan 6, 2012 at 9:05 PM, Kurinji Pandiyan
kurinji.pandi...@gmail.com wrote:
Hello,
I have one column in my dataframe that has gene names of interest.
Unfortunately, due to the fact that some probes lie between two genes or
two transcripts of a gene, it looks something like this -
Sorry. - that should be a semi-colon below.
Michael Weylandt
On Jan 6, 2012, at 8:17 PM, R. Michael Weylandt michael.weyla...@gmail.com
michael.weyla...@gmail.com wrote:
I think you can do this with something like this (untested):
unique(unlist(strsplit(XXX, ,)))
Michael
On Jan 6,
On Jan 6, 2012, at 6:09 PM, Chris Conner wrote:
I'm trying to understand how to set graphical parameters for trees
created with the party package. For example take the following code:
library(party)
data(airquality)
airq - subset(airquality, !is.na(Ozone))
airct - ctree(Ozone ~
I want to create a list of functions in a for loop, with the index
of the loop appearing explicitly in the function code.
After quite a bit of thrashing around I figured out how to do it.
Here is a toy example:
junk - vector(list,4)
for(i in 1:4) {
itmp - i
junk[[i]] -
I imagine the answer will involve lazy evaluation and require you use force()
but I'm not quite qualified to pronounce and not at a computer to test.
Michael
On Jan 6, 2012, at 8:43 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote:
I want to create a list of functions in a for loop, with the
On Jan 6, 2012, at 9:51 PM, R. Michael Weylandt michael.weyla...@gmail.com
wrote:
I imagine the answer will involve lazy evaluation and require you
use force() but I'm not quite qualified to pronounce and not at a
computer to test.
Your theory passes the experimental test:
for(i in
On 07/01/12 15:51, R. Michael Weylandt michael.weyla...@gmail.com wrote:
I imagine the answer will involve lazy evaluation and require you use force()
but I'm not quite qualified to pronounce and not at a computer to test.
I think you've got it; I tried
junk - vector(list,4)
for(i in 1:4) {
On Fri, Jan 6, 2012 at 9:43 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote:
I want to create a list of functions in a for loop, with the index
of the loop appearing explicitly in the function code.
After quite a bit of thrashing around I figured out how to do it.
Here is a toy example:
junk
Presumably because the i = 4 has to be re-evaluated at the start of
each iteration of the while-loop which implicitly force()s it?
Though, I don't know if it might not be a bad idea to put an implicit
force() in the internal code for `for` to prevent these sorts of
things. I can't immediately
On Fri, Jan 6, 2012 at 11:13 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:
Presumably because the i = 4 has to be re-evaluated at the start of
each iteration of the while-loop which implicitly force()s it?
Though, I don't know if it might not be a bad idea to put an implicit
90 matches
Mail list logo