plot(y~x, type="p", xlim = x[c(2,4)])
?
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of wangxipei
Sent: Tuesday, 18 January 2011 1:27 PM
To: r-help
Subject: [R] plot continuous data vs clock time
Dear R users,
I have a question a
Dear R users,
I have a question about ploting clock time, the example is as below:
y<-seq(from=1, to=30, by=5)
x<-c("0:01","1:20", "8:40", "9:25", "15:30", "21:23")
x<-as.POSIXct(strptime(paste(x),"%H:%M"))
plot(y~x, type="p")
I got the plot, but if I want to plot the x range fr
Hi:
Here's an attempt to use merge() on your data, but I don't know if it
satisfies your needs.
# dput(bs)
bs <- structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Site1", "Site2"), class =
"factor"),
data = c(2004L, 2005L, 2006L, 2007L, 200
Hi Jim,
Ultimately, I'm going to want to count the frequency of dates by particular
time periods (months, quarters, years) for each state and then plot the data. I
know there are commands in ggplots that will do that, so I'm not too worried
about that, but I was stuck on getting 50 text files (
On Mon, Jan 17, 2011 at 3:51 PM, michael.hopgood wrote:
>
> Dear R family,
> I am a relative newbie and have been dabbling with R for a little while.
> Simple things really, but my employers are beginning to see the benefits of
> using R instead of excel. We have a remote monitoring station measur
readLines worked great Jim, thanks!
Simon Kiss
On 2011-01-17, at 7:44 PM, jim holtman wrote:
> It sounds like you want to use 'readLines' and not 'read.table'
>
>> x <- readLines(textConnection("January 11, 2009
> + January 11, 2009
> + October 19, 2008
> + October 13, 2008
> + August 16, 2008
>
Hi:
Try this little utility function to see if it meets your needs; the new
variable is for testing; it takes a data frame, adjustment date and
adjustment amount as parameters.
headAdj <- function(df, day, amt) {
# Check for four or two number year and format accordingly
u <- unlist(strsp
It should work just fine. If you want to send me a small subset of
the your data and the script you are using, I can see what it is doing
and suggest a solution. I use that approach all the time to read in
data.
On Mon, Jan 17, 2011 at 8:07 PM, Simon Kiss wrote:
> Hi Jim,
> Ultimately, I'm goin
Hi, assume that I have a repeated measure dataset with 3 time points: baseline,
day 5 and day 10. There are 4 treatment groups (vehicle, treatment 1, treatment
2 and treatment 3). 20 subjects per treatment group. A simple straight-forward
way to analyze the data is to use mixed model:
model 1:
It sounds like you want to use 'readLines' and not 'read.table'
> x <- readLines(textConnection("January 11, 2009
+ January 11, 2009
+ October 19, 2008
+ October 13, 2008
+ August 16, 2008
+ June 19, 2008
+ April 19, 2008
+ April 16, 2008
+ February 9, 2008
+ September 2, 2007"))
> closeAllConnect
I believe you've fallen into one of the R FAQs, namely the difference
between a float and an integer.
There are probably much better ways to set up your 'before' and 'after'
gridpoint references, but you could start out by replacing the
offending line with
positions <- which(round(benchmark
Thanks so Peter, works great!
Surrey
--
View this message in context:
http://r.789695.n4.nabble.com/Selecting-the-first-occurrence-of-a-value-after-an-occurrence-of-a-different-value-tp3217340p3221271.html
Sent from the R help mailing list archive at Nabble.com.
__
I'm working with a data collected through complex survey design. My goal is to
conduct a factor analysis to extract two a priori, known factors, and to get
factor scores for these factors. Unfortunately, the "svyfactanal" procedure
from the Survey package does not allow for the calculation of ei
Dear jim,
Yes, it's true, the data are separated onto new lines as follows:
January 11, 2009
January 11, 2009
October 19, 2008
October 13, 2008
August 16, 2008
June 19, 2008
April 19, 2008
April 16, 2008
February 9, 2008
September 2, 2007
I tried your attempt and it didn't work either; it
g'day all,
I need help with this please.
I have a dataset of site names and years they were trapped in (a subset of
it is bs, below) and a dataset of sites that actually caught animals
(subsetted as brep, below). I need to add to brep, a row with a zero in the
classcount column, for every yea
2011/1/17 Sebastián Daza :
> Hi everyone,
> I am trying to run Sweave.bat (batchfiles_0.6-1) from the command line on
> Windows, but I get this error:
>
> C:\batchfiles_0.6-1>Sweave.bat Sweave-test-1
> "Error: rterm.exe not found"
>
> I don't know how to set up the path if this one were the problem
> library(plyr)
> # Function to sum y by A-B combinations for a generic data frame
> dsum <- function(d) ddply(d, .(A, B), summarise, sumY = sum(y))
See count in plyr 1.4 for a much much faster way of doing this.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statist
On Mon, Jan 17, 2011 at 2:20 PM, Sean Zhang wrote:
> Dear R-Helpers,
>
> I wonder whether there is a function which cuts a multiple dimensional array
> along a chosen dimension and then store each piece (still an array of one
> dimension less) into a list.
> For example,
>
> arr <- array(seq(1*2*3
Hi:
Because R does not have a direct interface to MySQL?
You need to load a communication package - the two most common ones are
RODBC and RMySQL. The former requires that you register your MySQL database
table(s) with ODBC before using the RODBC package on them, whereas the
latter works with spe
Hi Michael,
This can be accomplished using the basic extract and assign functions:
dat <- structure(list(Date = structure(1:10, .Label = c("10-01-01",
"10-01-02", "10-01-03", "10-01-04", "10-01-05", "10-01-06", "10-01-07",
"10-01-08", "10-01-09", "10-01-10"), class = "factor"), Waterhead = c(100,
> Date: Mon, 17 Jan 2011 12:51:43 -0800
> From: michael.hopg...@mrm.se
> To: r-help@r-project.org
> Subject: [R] Extraction and replacement of data in a data frame
>
>
> Dear R family,
> I am a relative newbie and have been dabbling with R for a litt
Hi everyone,
I am trying to run Sweave.bat (batchfiles_0.6-1) from the command line
on Windows, but I get this error:
C:\batchfiles_0.6-1>Sweave.bat Sweave-test-1
"Error: rterm.exe not found"
I don't know how to set up the path if this one were the problem... I
ran rcmd.bat and I got this...
Hi everyone,
I am trying to run Sweave.bat (batchfiles_0.6-1) from the command line
on Windows, but I get this error:
C:\batchfiles_0.6-1>Sweave.bat Sweave-test-1
"Error: rterm.exe not found"
I don't know how to set up the path if this one were the problem... I
ran rcmd.bat and I got this...
Thanks Dennis, looks like there's even less boiler plate code with plyr. By
the way, what I labelled "W.SE" is meant to represent the weighted standard
error of the mean. Your "WSE" calculations appear to be providing the weighted
standard deviation of the variable. Is this a matter of needin
Hi,
I've got 2 very good solutions, thank you very much. One, from Henrique
Dallazuanna using the library reshape and one line of code - although it will
take me quite some time to understand it. Here it is what he sent:
library(reshape)
xtabs(rowSums(cbind(value.x, value.y), na.rm = TRUE) ~ X
You have the capability of using the Nabble interface to post plain
text. I have checked. There is a little button above your composition
frame that lets you change to plain text.
On Jan 17, 2011, at 4:38 PM, André Dias wrote:
OK!!
So, the ideia is from the 1st matrix get the 2nd matrix
Hi:
Try this based on the following toy example:
### Generate a list of named data frames
# There are more efficient ways to do this with replicate, but I forgot :)
# A function to generate a data frame
dmake <- function() data.frame(A = factor(rep(1:5, each = 10)),
Hi,
My code:
e <- rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 <- c(rep(1,50))
x1 <- rnorm(n=50,mean=2,sd=1)
x2 <- rnorm(n=50,mean=2,sd=1)
x3 <- rnorm(n=50,mean=2,sd=1)
x4 <- rnorm(n=50,mean=2,sd=1)
y <- 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10 #influential obser
I have a local installation of MySQL on my computer.
I enter the following to access MySQL from the command line:
/Applications/MAMP/Library/bin/mysql -h localhost -u root -p
I am then prompted for a password, and I use: root
This connects me to MySQL in the command line.
I now want to access My
Altay, simply run your tests under control of an exception handler:
help(try)
help(tryCatch)
On Monday 17 January 2011 22:05:07 Altay wrote:
> Hi, everybody.
>
> I am working processing EEG data from 1000 pacients. I have a specific
> syntax to perform the Spectral Analysis and a loop to
Dear R family,
I am a relative newbie and have been dabbling with R for a little while.
Simple things really, but my employers are beginning to see the benefits of
using R instead of excel. We have a remote monitoring station measuring
groundwater levels. We download the date as a .csv file and
Dear list,
I'm writing a function to re-grid a data set from finer to coarser
resolutions in R as follows (I use this function with sapply/apply):
gridResize <- function(startVec = stop("What's your input vector"),
to = stop("Missing 'to': How long do you want the fnial vector to be?")){
from <-
Pete Brecknock wrote:
>
> try ...
>
> new_m = m[c(2,7,8),c(1,4,6,7)]
>
> HTH
>
> Pete
>
Hi Pete,
I haven't understood what you wanted to say here. Can you explain please?
thanks
ADias
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-
Dear R family,
I am a relative newbie and have been dabbling with R for a little while.
Simple things really, but my employers are beginning to see the benefits of
using R instead of excel. We have a remote monitoring station measuring
groundwater levels. We download the date as a .csv file and
Mauricio,
I tried your matrix allocation on Gentoo-hardened 32 and
64 bit systems. Both work ok, using R-2.11.1 and R-2.12.2 respectively,
and both use a recent 2.6.36 kernel revision.
This is from the 32 bit system with 512 MB physical memory:
>system("free")
total
Dear R-Helpers,
I wonder whether there is a function which cuts a multiple dimensional array
along a chosen dimension and then store each piece (still an array of one
dimension less) into a list.
For example,
arr <- array(seq(1*2*3*4),dim=c(1,2,3,4)) # I made a point to set the
length of the fir
It is currently not possible to pass weights in summaryBy.
Regards
Søren
Fra: Joshua Wiley [jwiley.ps...@gmail.com]
Sendt: 17. januar 2011 08:16
Til: Solomon Messing
Cc: r-help@r-project.org; Søren Højsgaard
Emne: Re: [R] Using summaryBy with weighted data
OK!!
So, the ideia is from the 1st matrix get the 2nd matrix with the use of a
vector.
is it possible?
In the example I have a 10x10 matrix and I get from that one a second 4x3
matrix selected from a vector.
thanks
ADias
2011/1/17 David Winsemius
>
> On Jan 17, 2011, at 11:16 AM, ADias wrot
I am making considerable use of Harrell's rms package, but I do not use
Latex for writing. (I have enough trouble convincing my co-authors to
use Openoffice!). rms makes copious use of Latex output for various
mixed graphical and text outputs, amongst other things.
Does someone have a conve
Hi:
Does this do what you need?
wstats <- function(d) {
require(Hmisc)
N <- length(d$response[!is.na(d$response)])
c(WM = wtd.mean(d$response, d$weights),
WSE = sqrt(wtd.var(d$response, d$weights)),
N = N)
}
library(plyr)
dd
On Jan 17, 2011, at 11:16 AM, ADias wrote:
Hi,
yes it works perfectly.
I have another question:
Is there way of selecting with a vector the values I wish to take
out from a
matrix.
Example:
I have this matrix and I want to take out the numbers in bold and
get the
second matrix below
Hi, everybody.
I am working processing EEG data from 1000 pacients. I have a specific
syntax to perform the Spectral Analysis and a loop to analyse all subjects.
each subject data are in separate folders (P1, P2 P3...)
My question is: in some cases, some errors can appear in one subject. I want
You could write a batch file and then have your OS schedule to run R on the
batch file whenever you want (see Rscript for one approach of running the
batch).
Inside of R you can use Sys.sleep to wait a certain amount of time before
running the next command. If you load the tcltk2 package then
Try this:
testdat[seq(1,10,3),] <- t(replicate(4, c(1,0,0,0,0,0,0,0,0,0)))
On Mon, Jan 17, 2011 at 6:29 PM, Brant Inman wrote:
> R-helpers,
>
> Below is a simple example of some output that I am getting while trying to
> work with a data frame in R 2.12.1 for Mac.
>
> -
> > testdat <- data
R-helpers,
Below is a simple example of some output that I am getting while trying to work
with a data frame in R 2.12.1 for Mac.
-
> testdat <- data.frame(matrix(ncol=10, nrow=10))
> colnames(testdat) <- c('a','b','c','d','e','f','g','h','i','j')
> testdat[seq(1,10,3),] <- c(1,0,0,0,0,0,0,0
Try this:
library(reshape)
xtabs(rowSums(cbind(value.x, value.y), na.rm = TRUE) ~ X1 + X2,
merge(melt(m1), melt(m2), by = c('X1', 'X2'), all = TRUE), exclude = FALSE)
On Mon, Jan 17, 2011 at 5:59 PM, Monica Pisica wrote:
>
> Hi,
>
> I am having some difficulties with matrix operations. It is a
Monica -
Perhaps this small example can demonstrate how factors can
solve your problem:
d1 =
data.frame(cat=sample(c('cat2','cat5','cat6'),100,replace=TRUE),group=sample(c('land','water'),100,replace=TRUE))
d2 =
data.frame(cat=sample(c('cat1','cat3','cat4'),100,replace=TRUE),group=sample(c(
I believe you want to select a subset of rows and subset of columns of your
original matrix m.
If you had wanted only the first row of m, you could have used m[1,]
Alternatively, if you had wanted only the second column of m then you could
have used m[,2]
m[1,2] would give you the element at
Hi,
I am having some difficulties with matrix operations. It is a little hard to
explain it so please bear with me. I have a very large data set, large enough
that it needs to be split in parts in order to deal with. I can work things on
these "parts" but the problem lies in adding together th
I got it to work:
# To get a percentile of a single-variable function:
# Step 1: Integrate over the domain to ge the normalization constant:
Z<-integrate(function(x) sqrt(1+x^-1), 1,2)$value
Z
# Step 2: Find the .975 percentile
x975<-uniroot(function(t) integrate(function(x) sqrt(1+x^-1), 1,
t)$val
On 2011-01-17 07:44, eric wrote:
What am I doing wrong here ? And what's the right way to calculate the log
differences in a column in a df ?
# first 3 rows of 5000 rows
y[1:3,]
Date Open High Low Close
1 1983-03-30 29.96 30.51 29.96 30.35
2 1983-03-31 30.35 30.55 30.20 30.24
3 1983-04-0
try:
mylist <- lapply(a, read.table, header = TRUE, sep = '\n')
also is the separator really '\n' meaning a new-line? What exactly
does the data look like?
On Mon, Jan 17, 2011 at 11:47 AM, Simon Kiss wrote:
> Hello,
> I'm trying to read in 50 text filess with dates as content to create a list
Dear all,
I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a
row-by-row basis). However, there are a slightly different number of rows in
each data frame, so I'm receiving the following error: "Error in
Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) :
+ on
Apologies if this is posted twice. The r-help mailing system gave an error
(reported to moderator) on first try, but it may have gone through.
Original Message
Subject: Re: R-help Digest, Vol 95, Issue 17
From:"Prof. John C Nash"
Date:
Thanks Josh. I built on your example and ended up with the code below--if you
or anyone sees any issues please let me know. It would be great if there were
a slicker way to get these kinds of summary stats in R, but this gets the job
done.
# takes data frame z with weights w and data x, retur
--- On Mon, 1/17/11, Raymond Wong wrote:
From: Raymond Wong
Subject: Re: [R] help in calculating ar on ranked vector
To: "Uwe Ligges"
Received: Monday, January 17, 2011, 11:56 AM
Thanks Uwe:
Here is my code. the first set of print statements work, but not the second.
#
z<-as.vecto
For those issues with optimization methods (optim, optimx, and others) I see, a
good
percentage are because the objective function (or gradient if user-supplied) is
mis-coded.
However, an almost equal number are due to functions getting into overflow or
underflow
territory and yielding quantitie
Hello,
I'm trying to read in 50 text filess with dates as content to create a list of
tables.
a is the list of filenames that need to be read in.
The following command returns the following error
mylist<-lapply(a, read.table(header=TRUE, sep="\n"))
Error in read.table(header = TRUE, sep = "\n
Hi,
yes it works perfectly.
I have another question:
Is there way of selecting with a vector the values I wish to take out from a
matrix.
Example:
I have this matrix and I want to take out the numbers in bold and get the
second matrix below
>m
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,
Following the advice a colleague, I put the gc() and gcinfo(TRUE)
commands just before the line I got the problem, and their output
were:
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 471485 12.61704095 45.6 7920371 211.5
Vcells 6408885 48.9 113919753 869.2 34765159
Dear R HELP,
ABOUT glmmPQL and the anova command. Here is an example of a repeated-measures
ANOVA focussing on the way starling masses vary according to (i) roost
situation and (ii) time (two time points only).
library(nlme);library(MASS)
stmass=c(78,88,87,88,83,82,81,80,80,89,78,78,85,81,78,81
What am I doing wrong here ? And what's the right way to calculate the log
differences in a column in a df ?
# first 3 rows of 5000 rows
y[1:3,]
Date Open High Low Close
1 1983-03-30 29.96 30.51 29.96 30.35
2 1983-03-31 30.35 30.55 30.20 30.24
3 1983-04-04 30.25 30.65 30.24 30.39
#equation
Dear list i have a sample question
I have a dataframe of 1500 species and 13 life history traits.
small example code:
traits <- data.frame(letters[1:9],
sample(letters, 9),
sample(letters, 9),
sample(letters, 9),
sample(letters, 9),
sample(letters, 9),
days=Sys.Date()-1:70
price=abs(rnorm(70))
regular=rep(c(0,0,0,0,1,0,1,0,0,1),c(7,7,7,7,7,7,7,7,7,7))
y=data.frame(cbind(days,price,regular))
y is like
days price regular
1 14990 0.16149463 0
2 14989 1.69519358 0
3 14988 1.57821998 0
4 14987 0.47614311 0
5 149
Peter Ehlers wrote:
> It is hardly R's fault that Excel users routinely commit
> crimes against data.
A ‘fortune’ candidate?
--
Karl Ove Hufthammer
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the p
David Scott wrote:
> As a further note, this is a reminder that whenever you get data via a
> spreadsheet the first thing to do is examine it and clean up any
> problems. A basic requirement is to tabulate any categorical variable.
I like using the ‘describe’ function in the ‘Hmisc’ package for t
On Mon, Jan 17, 2011 at 9:23 AM, Bert Gunter wrote:
> Folks:
>
> I know this may be overreaching, but are we missing what's important?
> WHY do the zeros occur? Are they values less then a known or unknown
> LOD? -- and/or is there positive mass on zero? In either case, using
> logs to calculate a
Folks:
I know this may be overreaching, but are we missing what's important?
WHY do the zeros occur? Are they values less then a known or unknown
LOD? -- and/or is there positive mass on zero? In either case, using
logs to calculate a geometric mean may not make sense. Paraphrasing
Greg Snow, what
Just in case some of x are negative (the desired median still exists, as
long as the two middle values are non -ve), how about:
x <- runif(20, -1, 100)
exp(median(log(pmax(0,x
It'll give -Inf if the two middle values are negative, when I guess we
should get NaN, but I can't see a 1-line way
try ...
new_m = m[c(2,7,8),c(1,4,6,7)]
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221234.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proje
What happens if you just load the R2wd package then run wdGet() yourself?
Also what OS, version of R, version of TeachingDemos, and version of R2wd are
you using?
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original
Fabrice Tourre wrote:
>
> How to plot as the coordinate as in my attachment? I want to trim the
> coordinate and one of plot as the figure in attachment. Does any one
> have such example?
>
http://markmail.org/message/3jn2sqoep36ckswb
(for a lattice-lookalike)
and package
plotrix
Dieter
ADias wrote:
>
> Is there an expression to double the values of a matrix - without using a
> loop?
>
>
Why so complicated?
Dieter
> m = matrix(rep(1,20),nrow=4)
> m
[,1] [,2] [,3] [,4] [,5]
[1,]11111
[2,]11111
[3,]11111
[4,]
I've been reminded by Prof. Brian Ripley that R's
log() function will indeed handle zeros appropriately.
Apologies to S Ellison and Hadley Wickham.
Peter Ehlers
On 2011-01-17 06:55, Peter Ehlers wrote:
On 2011-01-17 02:19, S Ellison wrote:
Will this do?
x<- runif(20, 1, 100)
exp( median( lo
As this is apparently a post hoc test, this is wrong. The results are
biased. You have provided a nice example of how to do irreproducible
science.
Consult a local statistician for what this means if you do not know.
-- Bert Gunter
On Mon, Jan 17, 2011 at 4:35 AM, Sascha Vieweg wrote:
> A multi
On 2011-01-17 02:19, S Ellison wrote:
Will this do?
x<- runif(20, 1, 100)
exp( median( log( x) ) )
S Ellison
That's what Hadley proposed, too. It's fine for
your example, but there is potentially a small
problem with this method: the data must be positive.
Since it's not unusual to see data
I was distracted enough by the possibility of hijacking hist() for this
to give it a go.
The following code implements a basic hanging rootogram based on a
normal density with hist() breaks used as bins and bin midpoints used as
the hanging location (not exact, I suspect, but perhaops good enough
Hi,
Looks like the function "theta" takes a variable "data", but that
variable is not being used in the body of the function (you are using
the global dataX and dataY, which will be the same each time the
function is called).
Martyn
-Original Message-
From: r-help-boun...@r-project.org [
Hi,
Is there an expression to double the values of a matrix - without using a
loop?
What I need is this:
Suppose we have this matrix
> m
[,1] [,2] [,3]
[1,]7 174
[2,] 11 10 18
[3,] 15 19 18
and I want this matrix
[,1] [,2] [,3]
[1,] 112 102 115
Thanks for your answer Martin, but -unfortunately- the decision about
installing a 32 bits OS in the 64 bits machine, was taken by the IT
guys of my work and not by me.
By the way, due to strong limitations about software installation in
my work place, this problem didn't happen in Ubuntu, but in
Hi everyones, my function like;
e <- rnorm(n=50, mean=0, sd=sqrt(0.5625))
x0 <- c(rep(1,50))
x1 <- rnorm(n=50,mean=2,sd=1)
x2 <- rnorm(n=50,mean=2,sd=1)
x3 <- rnorm(n=50,mean=2,sd=1)
x4 <- rnorm(n=50,mean=2,sd=1)
y <- 1+ 2*x1+4*x2+3*x3+2*x4+e
x2[1] = 10 #influential observarion
y[1] = 10
Dear John,
I've wanted to extend the effects package to mixed-effects models for some
time now. The basics are quite simple and you should be able to do the
computations yourself using the estimated fixed effects and their covariance
matrix.
The tricky computations are for models that have data-
On 2011-01-17 04:14, Tonja Krueger wrote:
Hi List,
Can someone help me to calculate the coordinates of the red and green points?
In this
example I found their approximate location by trying, but as I have to analyse
many similar curves, I’d rather calculate the exact location.
data<-
c(0.008248
On 2011-01-17 02:26, Fabrice Tourre wrote:
Hi all,
How to plot as the coordinate as in my attachment? I want to trim the
coordinate and one of plot as the figure in attachment. Does any one
have such example?
Thanks.
Maybe you're looking for something like axis.break
or gap.plot in the plotri
typo ...
should have been
m = matrix(c(7,11,15,17,10,19,4,18,18), nrow = 3, ncol=3)
sum_m = sum(m)
new_m = sum_m-m
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221216.html
Sent from the R help mailing list archive at Nabble
If I have understood your question correctly, how about the following ...
m = matrix(c(7,11,15,17,10,19,4,18,18), nrow = 3, ncol=3)
sum_m = sum(m)
new_m = summ-m
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix-tp3221213p3221215
begin included message
I'm trying to estimate a Cox proportional hazard model with time-varying
covariates using coxph. The parameter estimates are fine but there is
something wrong with the survival curves I get with survfit (results are
not plausible).
-- end inclusion
This s
or
d = data.frame(Col1=c(1,2,3),Col2=c(2,3,4),Col3=c(3,4,5))
names(d)
names(d)[1] = "NewName1"
names(d)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/data-frame-column-name-change-tp3220684p3221214.html
Sent from the R help mailing list archive at Nabble.com.
You might use the plyr package to get group-wise weighted means
library(plyr)
ddply(mydata,~group,summarise, b=mean(weights),
c=weighted.mean(response,weights))
hth
david freedman
--
View this message in context:
http://r.789695.n4.nabble.com/Using-summaryBy-with-weighted-data-tp3220761p32212
building on the previous responses, does this give you what you want:
> x
A B
1 1 1
2 2 NA
3 NA NA
4 NA 4
> # determine where the NAs are
> row.na <- apply(x, 1, is.na)
> # now convert to list of columns with NAs
> apply(row.na, 2, function(a) paste(colnames(x)[a], collapse = ','))
[1] ""
Hi Nidhi,
> ... On the other hand, I also found that JRI.jar is missing from
> both of these (piodev...) installations. ...
this is resolved now in the /mnt/tools/r installation.
Background: When compiling R, one needs to provide an option
"--enable-R-shlib" in order that R is capable of dynamic
Maybe something along the lines:
apply(df,1, FUN=function(x) which(is.na(x)))
It's not exactly what you want, but it might work combined with the
other solutions
HTH,
Ivan
Le 1/17/2011 12:23, Johannes Graumann a écrit :
Both versions do not do what I am looking for, as they do not differenti
Hi
Try the following...
df <- data.frame(A = c(1,1,3,2,2,3,3),
B = c(2,1,1,2,7,8,7),
K = c("a.1", "d.2", "f.3",
"a.1", "k.4", "f.9", "f.5"))
df$ID<-rownames(df)
df$K<-as.character(as.character(df$K))
changefunction<-function(z)
{
tmp <- lapply(split(z, z[,4]),
function(x) within(x, if(A==3
A multinomial logit model (N=192) revealed (besides others) the
following statistics for the outcome, y, and one predictor, x:
- y = A (baseline, n=34)
- y = B (n=26), B(x)=0.7323 (SE=0.2384)
- y = C (n=132), B(x)=0.6535 (SE=0.2041)
With a t-test I want to explore whether the two predictors dif
Hi List,
Can someone help me to calculate the coordinates of the red and green points?
In this
example I found their approximate location by trying, but as I have to analyse
many similar curves, I’d rather calculate the exact location.
data<-
c(0.008248005, 0.061242387, 0.099095516, 0.189943027,
On 16/01/2011 9:31 PM, l.chhay wrote:
Dear R community,
I have been getting this warning message after running a function sourced
from an R script, and can't seem to work out why R is looking for a folder
that wasn't even specified (it attaches a \NA to the specified directory,
where assess_rev
Dear R community,and especially Giovanni Millo,
For my master's thesis i need to simulate a panel data with the fixed
effects correlated with the predicor, so i run the
the following code:
set.seed(1970)
###Panel data simulation with alphai correlated
with xi#
Dear R community,and especially Giovanni Millo,
For my master's thesis i need to simulate a panel data with the fixed
effects correlated with the predicor, so i run the
the following code:
set.seed(1970)
###Panel data simulation with alphai correlated
with xi###
> "MZ" == Mauricio Zambrano
> on Mon, 17 Jan 2011 11:46:44 +0100 writes:
MZ> Dear R community,
MZ> I'm running R 32 bits in a 64-bits machine (with 16Gb of Ram) using a
MZ> PAE kernel, as you can see here:
MZ> $ uname -a
MZ> Linux mymachine 2.6.18-238.el5PAE #1 SM
Try this:
factor(sapply(apply(is.na(df), 1, which), sum), labels = c("NA", "TWO",
"BOTH", "ONE"))
On Mon, Jan 17, 2011 at 9:23 AM, Johannes Graumann wrote:
> Both versions do not do what I am looking for, as they do not differentiate
> where the NA is, if there is just one.
> My original wished
1 - 100 of 117 matches
Mail list logo