On Aug 31, 2012, at 3:48 PM, jjthaden wrote:
On Aug 30, 2012, at 4:35 PM, David Windemius wrote:
David said my newdata data frame 'new' must have a column named
'area'.
It did. Nonetheless predict.lm throws an error with type = "terms"
and
newdata = new. I see nothing in the predict.lm
On Aug 31, 2012, at 5:27 PM, jjthaden wrote:
The error is generated in the last line of code shown here from
predict.lm
The code you offered had an extra comma in the 'area' vector. Removing
allowed the fitting and prediction to proceed without error, I do not
see why you are producing c
HI,
You can also use ifelse:
dat1<-read.table(text="
10/20/30
40/20
60/10/10/5
80/10
",sep="",header=FALSE,stringsAsFactors=FALSE)
dat2<-ifelse(nchar(gsub("[^/]","",dat1$V1))==1,gsub("(.*)/(.*)","\\1 0 0
\\2",dat1$V1),ifelse(nchar(gsub("[^/]","",dat1$V1))==2,gsub("(.*)/(.*)/(.*)","\\1
\\2 0 \\3",
Hi,
Try this:
dat1<-read.table(text="
10/20/30
40/20
60/10/10/5
80/10
",sep="",header=FALSE,stringsAsFactors=FALSE)
dat2<-gsub("(.*)/(.*)","\\1 0 0 \\2", gsub("(.*)/(.*)/(.*)","\\1 \\2 0 \\3",
gsub("(.*)/(.*)/(.*)/(.*)","\\1 \\2 \\3 \\4",dat1$V1)))
dat3<-data.frame(do.call(rbind,strsplit(dat2, " "
Greetings, R helpers,
I have been using the Tps() function in the fields package to model response
surfaces for some dietary research in crickets. Overall, I have *three*
independent variables of interest, two continuous variables ("protein" and
"carbohydrate") and one categorical variable (cr
On Aug 30, 2012, at 4:35 PM, David Windemius wrote:
>> David said my newdata data frame 'new' must have a column named 'area'.
>> It did. Nonetheless predict.lm throws an error with type = "terms" and
>> newdata = new. I see nothing in the predict.lm documentation that
>> bars this usage. Is the
1) just because you don't use sqldf doesn't make it better. merge only does the
join, not the conditions, so you have to apply them after merge. Untested (you
should provide a complete example):
result <- merge ( detail, pdetail, by=TDATE, suffixes=c(".a",".b") )
result <- subset ( result, STIM.
The error is generated in the last line of code shown here from predict.lm
> predict.lm
function (object, newdata, se.fit = FALSE, scale = NULL, df = Inf,
interval = c("none", "confidence", "prediction"), level = 0.95,
type = c("response", "terms"), terms = NULL, na.action = na.pass,
On Sat, Sep 1, 2012 at 4:27 AM, David Winsemius wrote:
>
> On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote:
>
>> Hi all,
>>
>> I want to know how to perform the test Breslow-Day test for homogeneity of
>> odds ratios (OR) stratified for svytable. This test is obtained with the
>> f
Hi:
I was trying to use apply on a sparse matrix from package Matrix,
and I get the error:
Error in asMethod(object) :
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 106
Is there a way to apply a function to all the rows without bumping
into this problem?
Here is a si
On 2012-08-31 16:03, Bert Gunter wrote:
?which ##
as in ix <- which(x==values)
-- Bert
Or maybe ?identify.
Peter Ehlers
On Fri, Aug 31, 2012 at 2:09 PM, Michael wrote:
Hi all,
I am using "locator" to select the points from a scatter plot...
This is all fine.
But the problem is that t
?which ##
as in ix <- which(x==values)
-- Bert
On Fri, Aug 31, 2012 at 2:09 PM, Michael wrote:
> Hi all,
>
> I am using "locator" to select the points from a scatter plot...
>
> This is all fine.
>
> But the problem is that the locator only returns the axis values of the
> selected points.
>
>
Hello,
It means you should update your version of R. paste0 was introduced with
R 2.15.0 as is the shorter equivalent of
paste(..., sep = "")
I'm sending you a small correction just in case some of the elements in
A only have 1 element.
fun <- function(X){
xname <- deparse(substitute(X
Hi all,
I am using "locator" to select the points from a scatter plot...
This is all fine.
But the problem is that the locator only returns the axis values of the
selected points.
Instead, I would like to get the index of these select points...
The axis values are real-values so it's a bit har
On Aug 31, 2012, at 10:11 AM, ramoss wrote:
> 1)I am wandering how the following SQL statement can be written in R language
> w/o using sqldf:
> create table detail2 as
> select a.*
> from detail a,
> pdetail b
> where a.TDATE=b.TDATE
> and(a.STIM >= b.STIM and a.STIM <=b.MAXTIM)
>
> * William Dunlap [2012-08-31 18:38:52 +]:
>
> Is the following something like what you are doing?
yes, absolutely, thanks a lot!
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://pmw.org.il http://dhimmi.com
http://palesti
Hello,
Try the following.
A <- c(
"10/20/30",
"40/20",
"60/10/10/5",
"80/10")
fun <- function(X){
xname <- deparse(substitute(X))
s <- strsplit(X, "/")
n <- max(sapply(s, length))
tmp <- numeric(n)
f <- function(x){
x <- as.numeric(x)
m <- length(x)
Hello,
You create a 3d array X and then index it as if it were 1d.
Correction:
TS <- EuStockMarkets
[...etc...]
for (t in T[1:(length(T)-n)]){
X[ , , t] <- cor(TS[t:(t+n), 1:ncol(TS)], use = "pairwise.complete.obs")
}
# Calculate correlation matrices
Also, 't' and 'T' are not good names, th
1)I am wandering how the following SQL statement can be written in R language
w/o using sqldf:
create table detail2 as
select a.*
from detail a,
pdetail b
where a.TDATE=b.TDATE
and(a.STIM >= b.STIM and a.STIM <=b.MAXTIM)
2) when try if then in R it only applies to the 1st row & not t
Hello everyone,
a hopefully easy to solve problem from an R novice...
I try to calculate a number of correlation matrices that finally should be
combined in a three-dimensional array.
Here the my code with an R dataset as an example.
---
## Creation an array of
Hi,
A column of my df looks like
A
10/20/30
40/20
60/10/10/5
80/10
I want to split it such that the last column has the last composition and if
there are not enough the middle columns get the 0s. That way my df would look
like
A1 A2 A3 A4
10 20 0 30
40 0 0 20
60 10 10 5
80 0 0 10
How can I
Hi,
Try this:
z1<-c(z,z,z,z,z)
ifelse(z1>14,x,y)
#[1] 1 2 3 4 5
A.K.
- Original Message -
From: Andras Farkas
To: "r-help@r-project.org"
Cc:
Sent: Friday, August 31, 2012 7:55 AM
Subject: [R] Help on numerical object and ifelse function
Dear All,
this is probably an easy one but I
It is hard to help when you don't give an example of your input data
and what you want to be computed (in a form one can source or copy
into an R session). Is the following something like what you are doing?
Suppose you have a function that takes a file name and
returns a list of things of variou
I guess there are two issues with data.frame. It comes with more than
you probably want to support (e.g., list and matrix- like subsetter [,
the user expecting to be able to independently modify any column). And
it comes with less than you'd like (e.g., support for a 'column' of S4
objects). By
On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote:
> Hi all,
>
> I want to know how to perform the test Breslow-Day test for homogeneity of
> odds ratios (OR) stratified for svytable. This test is obtained with the
> following code:
>
> epi.2by2 (dat = daty, method = "case.contro
Using a data.frame x with columns bins and counts:
x <- structure(list(bins = c(3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5,
11.5, 12.5, 13.5, 14.5, 15.5), counts = c(1, 1, 2, 3, 6, 18,
19, 23, 8, 10, 6, 2, 1)), .Names = c("bins", "counts"), row.names =
4:16,
class = "data.frame")
This
OK, then this turns out to be a pure LaTeX problem. Thanks for the
experiments and examples, and they worked very well for me. It seems
subcaption is on the radar of LyX 2.1 now.
Regards,
Yihui
--
Yihui Xie
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
> * David Winsemius [2012-08-30 10:14:34 -0700]:
>
>> str( as.data.frame( do.call(rbind, strsplit(c("a,1","b,2","c,3"),
> ",") ) , stringsAsFactors=FALSE) )
> 'data.frame': 3 obs. of 2 variables:
> $ V1: chr "a" "b" "c"
> $ V2: chr "1" "2" "3"
do.call/rbind appeared to be TRT. I tried it a
To add to what David said ...
Of course, there are already S3 "getters" and "setters" methods for data
frames ("[.data.frame" and "[<-.data.frame" )*. These could clearly be
extended -- i.e. the data.frame class could be extended and appropriate S3
methods written. Whether you use S3 or S4 depends
On 31 August 2012 at 07:14, Linh Tran wrote:
| I took some time to think about it and don't know that it was the case
| for me. If the openmpi-bin package was missing, I wouldn't have been
| able to even use openmpi and during my trouble, I would check the mpi
| software each time I installed i
On Aug 31, 2012, at 5:57 AM, Ramiro Barrantes wrote:
> Hello,
>
> I have again a "good practices"/programming theory question regarding
> data.frames.
>
> One of the fundamental objects that I use is the data frame with a particular
> set of columns that I would fill or get information from,
On Mon, Jul 9, 2012 at 3:59 PM, Terry Therneau wrote:
> Without more information, we can only guess what you did, or what you are
> seeing on the page that is "different".
>
> I'll make a random guess though. There are about 5 ways to paramaterize
> the Weibull distribution. The standard packag
Hello,
w2 <- if(z > 14) x else y
w2
The difference is that ifelse is vectorized and returns an object of the
same length as the condition.
Since length(z > 14) == 1, it only returns x[1] (or y[1], were the
condition FALSE).
Hope this helps,
Rui Barradas
Em 31-08-2012 12:55, Andras Farkas escr
Hi everybody
I have a question about loading 'RcmdrPlugin.FactoMineR'
pachage in R.
I have installed Rcmdr, FactoMineR and 'RcmdrPlugin.FactoMineR.
when I want to load this package, at first a message inform me I should load
the following list of packages:
FactoMineR, ellipse, lattice, cluster, sca
HI,
You can also use these in addition to aggregate:
tapply(dat$x,INDEX=dat[grp],mean)
library(plyr)
ddply(dat,.(dat[grp]$a,dat[grp]$d),summarize,mean(x))
# dat[grp]$a dat[grp]$d ..1
#1 b c 0.26781378
#2 b d -0.01994023
#3 c e 0.1487
Dear All,
this is probably an easy one but I can not get a handle on it:
x <-c(1,2,3,4,5)
y <-c(6,7,8,9,10)
z <-15
w <-ifelse(z>14,x,y)
this will give me a value of 1 for w. What I would like to get is the whole
string of x, so that w would become a numeric object of 5 characters exactly
th
- Forwarded Message -
From: Mahbubeh Parsaeian
To: "r-help@r-project.org"
Cc:
Sent: Friday, 31 August 2012, 17:18
Subject: loading 'RcmdrPlugin.FactoMineR' pachage in R
Hi everybody
I have a question about loading 'RcmdrPlugin.FactoMineR'
pachage in R.
I have installed Rcmdr, FactoM
Hello,
I wanted to know if there was way to convert a histogram of a data-set to a
kernel density estimate directly in R ?
Specifically, I have a histogram [bins, counts] of samples {X1 ...
XN} of a quantized variable X where there is one bin for each level of X,
and I'ld like to directly get a kd
Suggstion:
You need to send us more information, i.e. the code that genrated daty, or a
listing of the daty structure, and a copy of the listing
produced by epi.2by2
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Ger
On Thu, Aug 30, 2012 at 12:50 AM, Yihui Xie wrote:
> Do you know what environments are allowed inside \subfloat{}? The
>
No, not really. From what I can tell, \subfloat{} is provided by the
`subfig' package. Here's what their docs have to say about
compatibility with verbatim and fancyvrb packages
Hi all,
I want to know how to perform the test Breslow-Day test for homogeneity of
odds ratios (OR) stratified for svytable. This test is obtained with the
following code:
epi.2by2 (dat = daty, method = "case.control" conf.level = 0.95,
units = 100, homogeneity = "breslow.day", verbose =
I took some time to think about it and don't know that it was the case
for me. If the openmpi-bin package was missing, I wouldn't have been
able to even use openmpi and during my trouble, I would check the mpi
software each time I installed it to verify that it worked (using some
simple example
The OP appears to be confused about argument lists and argument passing
(which has nothing to do with "imputed variables" btw). Here is an
explanation providing a more explicit explanation than RUI's post.
The formal arguments of fun1 are "x", "y",and "z".
The formal arguments of fun2 are "aa" and
Completely OT for this list. Post elsewhere.
-- Bert
On Thu, Aug 30, 2012 at 11:13 PM, carol white wrote:
> Hi,
> It might be a trivial question but I just wonder if you could advise good
> theoretical tutorials, reviews on NGS (different platforms) quality control
> like nucleotides quality b
On Thu, 30 Aug 2012, Salma Wafi wrote:
I am trying to get some estimator based on lognormal distribution when we
have left,interval, and right censored data.
Take a look at the NADA package. For left-censored data you can use cenmle
with dist = 'lognormal'. Survival analyses work well for ri
Hello,
I have again a "good practices"/programming theory question regarding
data.frames.
One of the fundamental objects that I use is the data frame with a particular
set of columns that I would fill or get information from, and an entire system
would revolve around getting information from o
Hello,
Em 31-08-2012 11:35, Martin Maechler escreveu:
Hi Rui,
I think when people are asking how to do such basic things in R,
the answer should *not* be to use a (non-base / -recommended)
package...
You're right, that's why I've called it an alternative.
but then, you may have really want
On 31-08-2012, at 03:54, Salma Wafi wrote:
> Hi ,
> I am trying to get some estimator based on lognormal distribution when we
> have left,interval, and right censored data. Since, there is now avalible
> pakage in R can help me in this, I had to write my own code using Newton
> Raphson method
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Sam Steingold
> Sent: Thursday, August 30, 2012 9:17 PM
> To: William Dunlap
> Cc: r-help@r-project.org
> Subject: Re: [R] apply --> data.frame
>
> > * William Dunlap [2012-
49 matches
Mail list logo