On Dec 14, 2012, at 2:18 PM, Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> Hi David,
>
> Thank you so much for helping me with the code.
>
> Your suggested code gives me the following results. Please see below. I don't
> understand why I am getting two blocks of prints (5 columns, and then 7
> colu
Hi Pradip,
May be this helps:
dat1<-read.table(text="
contrast_level1 contrast_level2 mean_level1 mean_level2 rel_diff p_mean
cohens_d
1 wh 2+hi 18.7 11.91 0.574 1.64e-05
0.1753
2 wh 2+rc 18.7 14.46 0.297 9.24e-
HI Bill,
bases
#$O
#[1] "Oak Harbor"
#$P
#[1] "Pensicola"
#
#$Q
#[1] "Quonset Point"
res2<- lapply(bases,function(x) {if(names(bases)[match.call()[[2]][[3]]]%in%
"P") tolower(x) else paste0("(",x,")")})
res2
#$O
#[1] "(Oak Harbor)"
#
#$P
#[1] "pensicola"
#
#$Q
#[1] "(Quonset Point)"
#the names
Here is a pretty simple function.
-tgs
ColorBlocks <- function(rows, columns, ColorMatrix, RowNames, ColumnNames,
TextMatrix = NULL){
# This function takes the following inputs:
# rows : a numeric vector denoting the relative heights of rows
# columns : a numeric vector denoting the relative widt
Hi David,
Thank you so much for helping me with the code.
Your suggested code gives me the following results. Please see below. I don't
understand why I am getting two blocks of prints (5 columns, and then 7
columns), with some columns repeated.
Regards,
Pradip
#
Yes, my example should have either applied lapply to
structure(seq_along(bases), names=names(bases))
instead of just
seq_along(bases)
or added the names(bases) to the ouput of lapply (assuming
one wanted the names of 'bases' on the output).
Bill Dunlap
Spotfire, TIBCO Software
wdunlap t
> lapply(lapply(Dat,My_Function),function(x)
> {if(names(Dat)[match.call()[[2]][[3]]]%in%
> "P") NULL else x})
match.call()[[2]][[3]], gack!
In lapply(X, FUN), FUN is applied to X[[i]], which has lost the names attribute
that X
may have had. X[i] retains a part of the names attribute (since it
Hi,
If you want the list element "P" to be present as NULL in the result
you could use this:
set.seed(51)
lapply(lapply(Dat,My_Function),function(x)
{if(names(Dat)[match.call()[[2]][[3]]]%in% "P") NULL else x})
A.K.
- Original Message -
From: Christofer Bogaso
To: r-help@r-project.or
On Dec 14, 2012, at 11:48 AM, Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> Hi List,
>
> My goal is to force R not to print in scientific notation in the sixth column
> (rel_diff - for the p-value) of my data frame (not a matrix).
>
> I have used the format.pval () and printCoefmat () functions on th
Hi List,
My goal is to force R not to print in scientific notation in the sixth column
(rel_diff - for the p-value) of my data frame (not a matrix).
I have used the format.pval () and printCoefmat () functions on the data frame.
The R script is appended below.
This issue is that use of the for
On 14 December 2012 13:46, Simon Urbanek wrote:
> You may be a bit misinformed about with tail recursion means - it still needs
> to evaluate the function for each recursion step, the only difference is that
> in
> such special case there is no additional information that needs to be stored
> -
HI,
Try:
dat2[,Time1:=c(0,diff(Time)),by=ID]
dat2[,CumSTime1:=cumsum(Time1),by=ID]
head(dat2,4)
# ID Time Time1 CumSTime1
#1: 1 3 0 0
#2: 1 6 3 3
#3: 1 7 1 4
#4: 1 10 3 7
A.K.
- Original Message -
From: bibek sharma
To:
Hi,
You could also use library(data.table) to do this faster.
dat1<-read.table(text="
ID Time
1 3
1 6
1 7
1 10
1 16
2 12
2 18
2 19
2 25
2 28
2 30
",sep="",header=TRUE)
library(data.table)
dat2<-data.table(dat1)
res<-dat2[,Time1:=c(0,diff(Time)),by=ID]
head(res,
How about
Dat1 <- lapply(subset(Dat, Dat!="P"), My_Function)
--Mark
From: Christofer Bogaso
To: r-help@r-project.org
Sent: Friday, December 14, 2012 1:58 PM
Subject: [R] A question on list and lapply
Dear all, let say I have following list:
Dat <- vecto
What about:
lapply(Dat[names(Dat) != "P"], My_Function)
You could use %in% if you actually want to match a longer set of names.
Sarah
On Fri, Dec 14, 2012 at 1:58 PM, Christofer Bogaso
wrote:
> Dear all, let say I have following list:
>
> Dat <- vector("list", length = 26)
> names(Dat) <- LETT
Dear all, let say I have following list:
Dat <- vector("list", length = 26)
names(Dat) <- LETTERS
My_Function <- function(x) return(rnorm(5))
Dat1 <- lapply(Dat, My_Function)
However I want to apply my function 'My_Function' for all elements of
'Dat' except the elements having 'names(Dat) == "
On 14/12/2012 13:22, Jon Olav Skoien wrote:
Uwe,
I am unfortunately not able to upgrade to R 2.15.2 right now, but I have
Why not? Note that is part of the R-help contract: we only offer any
support for the current version of R (see the posting guide).
The posting guide also asked for 'at
On 14.12.2012 14:22, Jon Olav Skoien wrote:
Uwe,
I am unfortunately not able to upgrade to R 2.15.2 right now, but I have
seen a similar problem with several older R versions. If you want to
test with a shorter script, you can try the lines below. These provoke a
crash from a fresh R session o
Thomas,
This is a big help for getting me started. Brand new to R, so I'm unfamiliar
with how to 'manually' drawing graphs (instead of packages).
The graph your code makes is more like a Marimekko chart. What I'm thinking of
is like a heatmap but each row has a different width, and each colum
On 14.12.2012 16:55, Raeanne Miller wrote:
Hi All,
Another quick question - I noticed that COZIGAM has been removed from CRAN, and
that you are referred to the archive for previous versions (last updated 23
July 2012). Is this package still ok to use? Or is there an alternative which
might
Inline.
Note: My comments subject to confirmation by true experts.
On Thu, Dec 13, 2012 at 11:09 PM, Christiana Anagnostou <
canagnos...@zoologie.uni-kiel.de> wrote:
> Dear R helpers,
>
> For an allometric analysis (allometric equation y = a*x^b) I would like
> to apply a non-linear regression in
Hello,
How can you expect to see the fit line if you are ploting x and y
values, not their logarithms?
And your definitions of x and y are wrong, they should use c().
x <- c(1,2,3,4,5)
y <- c(6,7,8,9,10)
plot(log(x), log(y))
fit <- lm(log(y) ~ log(x)) # Same as glm
abline(fit)
Please read
Hello,
There are several ways of doing this, perhaps the easiest is with ?matplot.
You should provide some data example, like the posting guide says. Since
you haven't, I've made up some.
y <- replicate(3, cumsum(rnorm(10)))
x <- matrix(c(1:10, y), ncol = 4)
matplot(x[, 1], x[, -1], type = "l
Hi Bibek,
how about this?
dta<-read.table(textConnection("ID Time
1 3
1 6
1 7
1 10
1 16
2 12
2 18
2 19
2 25
2 28
2 30"),header=T)
dta$delta<-with(dta,ave(Time,ID,FUN=function(x)c(0,diff(x
dta
hth.
Am 14.12.2012 16:51, sc
dataset<-data.frame(id=c(1,1,2,3,3,3),time=c(3,5,1,2,4,6))
dataset
id time
1 13
2 15
3 21
4 32
5 34
6 36
ids<-unique(dataset$id)
for(id in ids){
+ dataset$time[dataset$id==id]<-c(0,diff(dataset$time[dataset$id==id]))
+ }
dataset
id time
1 10
2 1
HI,
Try this:
dat1<-read.table(text="
ID Time
1 3
1 6
1 7
1 10
1 16
2 12
2 18
2 19
2 25
2 28
2 30
",sep="",header=TRUE)
dat1$Time1<-ave(dat1$Time,dat1$ID,FUN=function(x) c(0,diff(x)))
head(dat1,3)
# ID Time Time1
#1 1 3 0
#2 1 6 3
#3 1 7
Neal-
Perhaps the following code is a start for what you want.
-tgs
par(mar=c(1,1,1,1),
oma = c(0,0,0,0),
mgp=c(1.5,.2,0),
tcl=0,
cex.axis=.75,
col.axis="black",
pch=16)
Z <- textConnection("
country A1 A2 A3
A 3 4 5
B 6 9 8
C 6 9 5")
ddd <- read.table(Z,header=TRUE)
close(Z)
Count
On 13 December 2012 23:21, Rui Barradas wrote:
> But it does, each recursive call will load another copy of the function, and
> another copy of the variables used.
> In fact, the cost can become quite large since everything is loaded in
> memory again.
>
> Hope this helps,
>
Many thanks for the r
I want to plot the regression line of a log regression into a plot with my
normal, nonlog, data.
for example
x <- (1,2,3,4,5)
y <- (6,7,8,9,10)
plot (x,y)
I tried a log-regression by
a <- glm (log(y) ~ log(x))
and then i tried to insert the answer to my graph, where the standard values
are s
Hi All,
Another quick question - I noticed that COZIGAM has been removed from CRAN, and
that you are referred to the archive for previous versions (last updated 23
July 2012). Is this package still ok to use? Or is there an alternative which
might also fit zero-inflated GAMs?
Thanks,
Raeanne
Hi R users,
I've previously updated my R installation to R 2.15.2 in my Arch Linux
64 bit. I haven't used it in a while after updating, but now that I'm
using it again, I find that the graphics device is not functioning
properly.
For any plots that I create, it's going to show a blank window. Upo
Hello,
I'm very new to R, and have managed to plot xy graphs, but can't seem to
plot a matrix properly.
The first column is my time points, and the following columns 2-4 are the
replicates of my experiment.
I've tried using row.names=1 to make the first column the value for that row
(whereas bef
Thanks John,
I appreciate your help.
With the help of Dennis Murphy, code along the lines of this
climData_melt <- melt(clim.data, id = 'date', measure = c("GISS", "HAD",
"NOAA", "RSS", "UAH"))
actually gets the data into the correct form very simply and from there its
easy to plot with f
Dear R helpers,
For an allometric analysis (allometric equation y = a*x^b) I would like
to apply a non-linear regression instead of using log-log
transformations of the measured parameters x and y and a Model II linear
regression. Since both of the variables x and y are random, I would like
to
I always liked Johan Bring's (1994. How to standardize regression
coefficients. Am. Stat. 48(3):209-213.) arguments for standardizing the
beta estimates in a linear model by their partial standard deviations which
equates to comparing ratios of t-statistics between variables to determine
their re
Hello R User,
In the sample data given below, time is recorded for each id
subsequently. For the analysis, for each id, I would like to set 1st
recorded time to zero and thereafter find the difference from previous
time. I.e. for ID==1, I would like to see Time=0,3,1,3,6. This needs
to be implement
I think David was pointing out that reshape() is not a reshape2 function. It
is in the stats package.
I am not sure exactly what you are doing but perhaps something along the lines
of
library(reshape2)
mm <- melt(clim.data, id = Cs("yr_frac", "yr_mn","AMO", "NINO34", "SSTA"))
is
At 08:33 14/12/2012, Jeremy Goss wrote:
Dear users,
Does anyone have any idea how to generate standardised beta coefficients
for a ZINB model in R to compare which explanatory variables are having the
greatest impact on the dependent variable?
You might like to look at Ulrike Grömping's work
Hi,
I try to execute a winBUGS model within R on a Mac.
I use wine and the R2WinBUGS package.
Now I have a small problem with the path variables;
the path to the bugs directory include paranthesis and because of that it won't
run.
error message:
sh: -c: line 0: syntax error near unexpected toke
Uwe,
I am unfortunately not able to upgrade to R 2.15.2 right now, but I have
seen a similar problem with several older R versions. If you want to
test with a shorter script, you can try the lines below. These provoke a
crash from a fresh R session on my machine (R 2.15.1 Windows 7):
Rprof()
On 12-12-14 8:00 AM, ONKELINX, Thierry wrote:
Dear all,
I'm having troubles migrating a large matrix from one system to another.
#system 1: Ubuntu 12.04, 64-bit, running R 2.15.2
# do some simulations
# save the simulations
save(Output, file = "Simulations.Rdata")
#Output is a numeric matrix
Dear all,
I'm having troubles migrating a large matrix from one system to another.
#system 1: Ubuntu 12.04, 64-bit, running R 2.15.2
# do some simulations
# save the simulations
> save(Output, file = "Simulations.Rdata")
#Output is a numeric matrix with 6 columns and about 2M rows.
Use ftp to tr
On Dec 14, 2012, at 6:25 AM, Suzen, Mehmet wrote:
> On 14 December 2012 12:13, Suzen, Mehmet wrote:
>> On 13 December 2012 23:21, Rui Barradas wrote:
>>> But it does, each recursive call will load another copy of the function, and
>>> another copy of the variables used.
>>> In fact, the cost ca
On 14 December 2012 12:13, Suzen, Mehmet wrote:
> On 13 December 2012 23:21, Rui Barradas wrote:
>> But it does, each recursive call will load another copy of the function, and
>> another copy of the variables used.
>> In fact, the cost can become quite large since everything is loaded in
>> memo
Dear R users,
The PST package (version 0.81) is now available on the CRAN. It enables
the modelling and analysis of categorical sequences with probabilistic
suffix trees (PST).
The package fits variable length Markov chain models and store them in
PSTs. It is specifically adapted to the fiel
Dear users,
Does anyone have any idea how to generate standardised beta coefficients
for a ZINB model in R to compare which explanatory variables are having the
greatest impact on the dependent variable?
Thanks,
Jeremy
[[alternative HTML version deleted]]
___
HI, R Users,
I met the following problem:
I was trying to import data of one table in .accdb database into my ODBC
database for being imported into R. The table contains 1021965 records.
I always got the following
error msg even I change the drive:
The query can not be completed. Either the
47 matches
Mail list logo