Hi guys,
Very new to R and your help would be highly appreciated for the following
problem. I am trying to create a simple function which registers values
within an array through a for loop. These are the steps I have followed:
1) Declared 2 global matrices
2) Create function mat() with i as an
Hello All,
I have a question regarding using Poission Regression, I would like to Model
the number of hospitalizations by a set of covariates.
The issue I ran into is "lack of fit" even after I tried to solve the
"overdispersion" problem with negetive binomial.
What would you suggest?
1. Is t
On 11/10/2010 11:31 AM, Rolf Turner wrote:
I would like to centre titles for pairs of plots in a 3-x-2
array. Each row of the array corresponds to a calendar year
and I would like to have the year value centred between the
two plots in the row, and just above their upper edges.
I have attached
If you want to assign to a variable in your workspace, rather than a
local variable in your function, you can use the <<- operator (double
headed arrow) like this...
mat <- function(i) {
for (k in i:10) {
y[k] <<- k+1
f[k] <<- y[k-1] / 2
}
}
Type ?"<<-" for the help page.
Michael
O
Hi guys,
Very new to R and your help would be highly appreciated for the following
problem. I am trying to create a simple function which registers values
within an array through a for loop. These are the steps I have followed:
1) Declared 2 global matrices
2) Create function mat() with i as
Try on these lines
library(MASS)
data(Boston)
Boston$crim<-paste(Boston$crim,"Test",sep="-")
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of sachinthaka.abeyward...@allianz.com.au
Sent: 10 November 2010 10:39
To: R-help Forum
Subject
Thank you. It works fine.
--
View this message in context:
http://r.789695.n4.nabble.com/Which-value-not-present-tp3035455p3035575.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/
I don't see enough information to help here, and this is rather
an R-devel topic (see the posting guide for the difference).
Which compiler and which version?
What level of optimization and other compiler flags?
32- or 64-bit build?
The Sun Studio compiler works (see the R-admin manual and the
Hi James,
The following is probably more an expression of empathy than direct help :)
I've used rjags quite a bit but have often found it to be very picky
about the formulation of the model. Scripts that run without problem
under WinBUGS (for instance) provoke errors with jags and more often
than
Hi Sachin,
That's OK - you don't need to know the dimensions up front and you can
add new vectors, or elements to an existing vector, as required.
# empty list to start with
X <- list()
# we get a vector
v1 <- c(1, 2, 3, 4, 5)
# add it to the ragged array
X <- c(X, list(v1))
# get another coup
Peter Langfelder wrote:
>
> Sorry, I'm not sure what you want to do in points 2-4. Shrink the
> mountain vertically or horizontally? You can for example look up image
> resizing algorithms if you want to shrink the area under the mountain
> but keep the shape of the mountain (approximately) the
Hi Michael,
Thanks for that. Its a starting point I guess. But what if I didn't know
the length of the outer vector is? (i.e. all dimensions are variable). Or
for that matter I don't actually know what the initial dimensions are going
to be. All of it is created within a for loop.
I was hoping fo
Hi:
Is this what you're looking for?
x <- 1:10
1 + sum((1/x)^(1:10))
[1] 2.291286
1 + sum(x^(-(1:10)))
[1] 2.291286
Since this may be a homework question, I'll let you figure out how to turn
it into a function - it only needs one change.
On Tue, Nov 9, 2010 at 7:16 PM, vicho wrote:
>
> I wan
On Tue, Nov 9, 2010 at 9:09 PM, wrote:
>
> Hi All,
>
> Suppose I want to concatenate a zero to all the values to a column called
> period in data frame A. I want to do the following but the following
> command actually deletes the entire column altogether.
>
> A$period<-cat(A$period,"0",sep="");
You want the paste command (cat is for printing to the console)...
A$period <- paste(A$period, 0, sep="")
Michael
On 10 November 2010 16:09, wrote:
>
> Hi All,
>
> Suppose I want to concatenate a zero to all the values to a column called
> period in data frame A. I want to do the following bu
Hello Sachin,
You have a "ragged array" and you can easily store this as a list of vectors...
x <- list(c(0,0,1,1), c(1,3,5), 4, c(7, -1, 8, 9, 10, 6))
The only gotcha with this is that you will then need to use double
brackets for the first index when retrieving values (single brackets
will ret
Hi All,
Suppose I want to concatenate a zero to all the values to a column called
period in data frame A. I want to do the following but the following
command actually deletes the entire column altogether.
A$period<-cat(A$period,"0",sep="");
Any help would be appreciated.
Thanks,
Sachin
p.s.
Hi Erik,
Thanks for replying. Only problem with that is that each row has 5 elements
(or 5 columns). I want varying number of columns as shown in my example.
x<- 0 0 1 1
1 3 5
4
Also look at the grconvertX function for a different way of finding the
coordinates to plot at.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun
Dear experts,
I need to write R code for lim(I+X/n)^n with "repeat loop". (note: limit is
n from 1 to infinity, I is identity matrix, X is square symmetric matrix)
Can anyone please provide help with my question.
Thank you.
--
View this message in context:
http://r.789695.n4.nabble.com/matrix
On 11/09/2010 09:16 PM, vicho wrote:
I want to make a function for geometric seqeunce
since
testing=function(x){i=1;ans=1;while(true){ans=ans+(1/x)^i ; i=i+1}
;return(ans)}
doesn't work... the program is freeze...
What exactly are you trying to do? Where does "true" get set?
Did you mean T
This type of object has the "matrix" class in R.
So just use ?matrix to create it.
matrix(1:25, ncol = 5)
for example.
On 11/09/2010 08:55 PM, sachinthaka.abeyward...@allianz.com.au wrote:
Hi All,
I want to have an array/ matrix that looks this
x<- 0 0 1 1
1
On Tue, Nov 9, 2010 at 11:23 AM, thornbird wrote:
>
> Thanks for your suggestion. I received a few error messages. Can anyone help
> me figure out why I get the following error messages and how to solve them
> by revising my code? The data is shown in the post above. Thanks.
>
>
>> library(zoo)
>>
Not sure if this is the best way ... but something similar to my question
from yesterday that I could solve as follows.
> tD <- read.csv("Book1.csv")
> tD
X0 X0.1 X1 X1.1 X X.1
1 13 5 NA NA NA
2 44 NA NA NA NA
3 7 -1 89 10 6
> x1 <- tD[1,1:3]
>
> x2 <- tD[2,1:2]
>
>
length(result) == 0
> result <- integer(0)
> result
integer(0)
> length(result) == 0
[1] TRUE
>
On Tue, Nov 9, 2010 at 9:55 PM, vioravis wrote:
>
> I am trying to use which function to obtain the index of a value in a
> dataframe. Depending on whether the value is present in the dataframe or no
I want to make a function for geometric seqeunce
since
testing=function(x){i=1;ans=1;while(true){ans=ans+(1/x)^i ; i=i+1}
;return(ans)}
doesn't work... the program is freeze... from my research, i know i should
use iterators.
I read iterators.pdf at
http://cran.r-project.org/web/packages/itera
Hi All,
I want to have an array/ matrix that looks this
x<- 0 0 1 1
1 3 5
4 4
7 -1 8 9 10 6
I hope this makes sense. So basically if I want x[1,3] it will access 0 and
similarly x[4,2], -1.
Thanks in ad
I am trying to use which function to obtain the index of a value in a
dataframe. Depending on whether the value is present in the dataframe or not
I am performing further operations to the dataframe.
However, if the value is not present in the dataframe, I am getting an
integer(0).
How do I chec
Hi:
library(sos)
findFn('truncated Pareto')
On my system, it scared up 17 matches. It looks like the VGAM package would
be a reasonable place to start looking.
HTH,
Dennis
On Tue, Nov 9, 2010 at 8:50 AM, cassie jones wrote:
> Dear all,
>
> I am trying to simulate from truncated Pareto distribu
That's cute. I had *thought* about using layout(), but of
course didn't see the trick of specifying *9* plots and doing
each of the text()s in a new plot. Very suave! :-)
Thanks.
cheers,
Rolf
On 10/11/2010, at 3:32 PM, Paul Murrell wrote:
> Hi
>
> Here's one approac
Hi
Here's one approach ...
# The layout's the important bit
layout(rbind(c(7, 7),
c(1, 2),
c(8, 8),
c(3, 4),
c(9, 9),
c(5, 6)),
heights=c(1, 5, 1, 5, 1, 5))
# Dummy plots
par(mar=c(5.1, 3.1, 0, 2))
plot(1:10, xlab="", ylab=
Hi:
Did you mean
panel.text(x,y/2,label = round(y,3),cex=1)
??
HTH,
Dennis
On Tue, Nov 9, 2010 at 1:11 AM, Ashraf Yassen wrote:
> Dear All,
>
> Now with data. Any suggestion how to center the text in the filling would
> be
> appreciated.
>
> Kind regards,
> Ashraf
>
> library(lattice)
> a<-c(
Hi:
This sounds like a 'doubly repeated measures problem'. Are any treatments
assigned to individuals or is this a purely observational study?
Is the time horizon of the between-visit factor (much?) longer than that of
the within-visit factor? You could try to assess the strength of correlation
o
I have figured out a *slightly* less kludgy way of accomplishing
my goal. Still a bit of a hack, but it works and seems to be
consistent across graphics devices.
Essentially it's this: After the *first* plot in each row, do:
U <- par()$usr
XD <- diff(U[1:2])
YD <- diff(
On Tue, Nov 9, 2010 at 11:18 AM, nathan.kupp wrote:
>
> R, by default, has some of the most cryptic error / debug messages ever
> invented.
I nominate the html 404 error for that.
> The error message encountered by the two posters:
>
> Error in if (any(co)) { : missing value where TRUE/FALSE nee
On Tue, Nov 9, 2010 at 11:49 AM, cameron wrote:
>
> Help make this simpler – count business day
>
>
> I am a beginner in R and this is my first post
>
> Want to count the day in month. For example
>
> Day
> 2010-09-01 1 Wed
> 2010-09-02 2 Thurs
> 2010-09-03 3 Friday
>
Hi all,
I looked for a function that would retrieve all(!) names of an arbitrary
deeply nested named list. Also, names should optionally be arranged in a
way that reflects the list's hierarchy structure (i.e. 'a$a.1$a.1.1' etc.)
Also, there should be a recursive index linked to a respective list
> the exponent of asymmetric matrix makes me very curious.
> can anyone please explain to me "what will happen if we apply exponent to
> the asymmetric matrix"?
The gates of Hell will open, the world will come to an end, and we
will all perish in a firestorm :)
Sorry, couldn't resist. Exponentiat
Try this:
> x
V1 V2 V3
1 1 15 34
2 1 4 66
3 1 24 65
4 2 23 47
5 2 9 36
6 3 58 9
7 3 38 64
8 3 12 64
9 3 4 15
10 4 1 88
11 4 23 90
x[tapply(seq(nrow(x)), x$V1, sample, 1),]
On Tue, Nov 9, 2010 at 9:01 PM, Achim Eberhart <
a.eberh...@pgrad.unimelb.edu.au> wrote:
> G'
Dear Experts,
the exponent of asymmetric matrix makes me very curious.
can anyone please explain to me "what will happen if we apply exponent to
the asymmetric matrix"?
Thank you very much
--
View this message in context:
http://r.789695.n4.nabble.com/Exponent-of-asymmetric-matrix-tp3035374p3
On Nov 9, 2010, at 2:18 PM, nathan.kupp wrote:
R, by default, has some of the most cryptic error / debug messages
ever
invented. The error message encountered by the two posters:
Error in if (any(co)) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In FUN(newX[, i],
G'day R-helpers,
I want to subsample rows of a large table based on the value in its
first column. Of all rows sharing the same value in the first column I
want to RANDOMLY extract only one.
Thanks in advance,
Achim
example input
1 15 34
1 4 66
1 24 65
2
I would like to centre titles for pairs of plots in a 3-x-2
array. Each row of the array corresponds to a calendar year
and I would like to have the year value centred between the
two plots in the row, and just above their upper edges.
I have attached an example in "demo.pdf" showing roughly
wha
>> >> zCenter = mean(Z)
>> >
>> > How can that be right? Suppose your mountain is very flat, so that
>> > your mountain is effectively a cube. The Z values are all the same,
>> > and so their mean is the same. However the centre of mass is, by
>> > symmetry, clearly at height/2.
>> >
>> > Similar
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Peter Langfelder
> Sent: Tuesday, November 09, 2010 3:49 PM
> To: Barry Rowlingson
> Cc: r-help@r-project.org; Ab Hu
> Subject: Re: [R] Centre of gravity of a mountain
>
> On Tue
On Tue, Nov 9, 2010 at 3:40 PM, Barry Rowlingson
wrote:
> On Mon, Nov 8, 2010 at 5:15 PM, Peter Langfelder
> wrote:
>
>> If you also need the z coordinate, it simply the mean of the matrix Z.
>>
>> zCenter = mean(Z)
>
> How can that be right? Suppose your mountain is very flat, so that
> your mo
On Mon, Nov 8, 2010 at 5:15 PM, Peter Langfelder
wrote:
> If you also need the z coordinate, it simply the mean of the matrix Z.
>
> zCenter = mean(Z)
How can that be right? Suppose your mountain is very flat, so that
your mountain is effectively a cube. The Z values are all the same,
and so th
Arunava Chakravartty gmail.com> writes:
> I have a data set with two y variables (y1 and y2) and one dependent
> variable(x) and a 1 strata variable Z. It so happens that y1 and y2 have
> very different scales such that single y-axis scale does not allow the data
> to be visualized fully.
http:/
Hi,
I have a data set with two y variables (y1 and y2) and one dependent
variable(x) and a 1 strata variable Z. It so happens that y1 and y2 have
very different scales such that single y-axis scale doesnot allow the data
to be visualized fully.
I am trying the following lattce graphics to do my p
On 11/ 9/10 10:30 PM, Dr. David Kirkby wrote:
On 11/ 9/10 09:22 PM, Zhang,Jun wrote:
It's been a few days I cannot compile to get R-2.12.0 working at sparc
Solaris 10. Seems the R software installation is OK, but the
recommended package called Matrix stopped me, since I can finish the
installati
On Mon, Nov 8, 2010 at 11:31 PM, Ab Hu wrote:
>
> Thanks! Works great.
> I have more questions on this, so I'll continue here:
>
> Now that I have the weighted mean, is it possible to reduce the size of
> mountain based on this weighted mean such the original matrix remains 21x21
> while the mount
blackscorpio wrote:
>
> Thank you for your answer. I have already tried lrm and it's true that it
> works better than polr in such a case. Nevertheless lrm does not work with
> the addterm and dropterm functions (to my knowledge) and I need to use
> them. Maybe do you know alternate functions th
On 11/ 9/10 09:22 PM, Zhang,Jun wrote:
It's been a few days I cannot compile to get R-2.12.0 working at sparc Solaris
10. Seems the R software installation is OK, but the recommended package called
Matrix stopped me, since I can finish the installation with the configure
option -with-recommend
A=matrix(0,nr=3,nc=4)
A[sample(prod(dim(A)),1)]=1
>>>
From: "Barroso, Judit"
To:"r-help@r-project.org"
Date: 10/Nov/2010 11:12a
Subject: [R] Change a value in a matrix randomly
I have a matrix of ceros, for example:
0 0 0 0
0 0 0
Tena koe Judit
If it is really a matrix (and not a data.frame) and you wish to change a
randomly selected zero to a one, then
judit <- matrix(0, nrow=3, ncol=4)
judit[sample(1:length(judit), 1)] <- 1
will do. This uses the fact that a matrix is a vector with a dim attribute.
HTH
Peter A
To superimpose anything onto a barplot you just need to know the x axis
locations of the bars, then everything behaves as expected. You can find
this by writing the barplot to an object, ie:
bp <- barplot(c(1:5),beside=TRUE)
bp is now a matrix containing the actual x axis locations of the bars (i
I have a matrix of ceros, for example:
0 0 0 0
0 0 0 0
0 0 0 0
And I would like that one of these values turn into 1, for example if one
condition is got, but not in a concrete posi
It's been a few days I cannot compile to get R-2.12.0 working at sparc Solaris
10. Seems the R software installation is OK, but the recommended package called
Matrix stopped me, since I can finish the installation with the configure
option -with-recommended-packages=no. I then run
Ø Install.pa
On Tue, Nov 9, 2010 at 12:41 PM, patrick nguyen
wrote:
> Hi
>
>
> I'm having problems displaying multiple chart.StackedBar from
> PerformanceAnalysis library on a single plot. I've tried using
I am assuming you mean the PerformanceAnalytics package, at least that
is what I will talk about.
> pa
Hello,
I am using R.12.2.0. I am trying to generate bootstrap confidence intervals
using bootcov from the rms package. I am able to impute the missing data
using aregImpute and to perform a linear regression on the imputed datasets
using fit.mult.impute, but I am unable to use bootcov to generat
It's been a few days I cannot compile to get R-2.12.0 working at sparc Solaris
10. Seems the R software installation is OK, but the recommended package called
Matrix stopped me, since I can finish the installation with the configure
option -with-recommended-packages=no. I then run
Ø Install.pa
Hi,
try
par(new=T)
patrick nguyen writes:
Hi
I'm having problems displaying multiple chart.StackedBar from
PerformanceAnalysis library on a single plot. I've tried using
par(mfrow=c(2,1)) but that doesn't work.
If I do it with barplot(), it works fine and I see both plots on a single p
Dear Mme/Mr.
Hope you are doing well. I am doing some genetic analysis using The R software
and I have difficulties to find how I can perform an Interaction/epistasis
analysis using 3 or more SNPs (=markers) ? (In the instructive manual, there is
only an interaction/epistasis analysis with 2 ma
R, by default, has some of the most cryptic error / debug messages ever
invented. The error message encountered by the two posters:
Error in if (any(co)) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In FUN(newX[, i], ...) : NAs introduced by coercion
results from the i
Hi
I'm having problems displaying multiple chart.StackedBar from
PerformanceAnalysis library on a single plot. I've tried using
par(mfrow=c(2,1)) but that doesn't work.
If I do it with barplot(), it works fine and I see both plots on a single plot.
> plot(mfrow=c(2,1))
> barplot(blahblah)
> b
I am unfamiliar with the chart.StackedBar function, but since barplot works
as expected I thought I'd check that you do know you can obtain stacked bar
charts using barplot also? (beside = FALSE).
On 10 November 2010 09:41, patrick nguyen wrote:
> Hi
>
>
> I'm having problems displaying multiple
Thanks!
now it's just a matter of 'superposing' the density onto the barplot
I am looking at the example here,
but it does not seem to applicable to barplot.
casper
--
View this message in context:
http://r.789695.n4.nabble.com/how-do-i-plot-this-hist-tp3032796p3035110.html
Sent from the R h
Hi
I'm having problems displaying multiple chart.StackedBar from
PerformanceAnalysis library on a single plot. I've tried using
par(mfrow=c(2,1)) but that doesn't work.
If I do it with barplot(), it works fine and I see both plots on a single plot.
> plot(mfrow=c(2,1))
> barplot(blahblah)
>
Hi
r-help-boun...@r-project.org napsal dne 09.11.2010 20:25:09:
> casperyc
> Odeslal: r-help-boun...@r-project.org
>
> 09.11.2010 20:25
>
> Re: [R] how do i plot this "hist"?
>
>
> Hi all,
>
> Thank you both. The codes work perfectly.
>
> I now use
>
> barplot(t(x.m)[-1,], names.arg = x.
Hi
r-help-boun...@r-project.org napsal dne 09.11.2010 18:33:54:
> Kate Hsu
> Odeslal: r-help-boun...@r-project.org
>
> 09.11.2010 18:33
>
> Komu
>
> r-help@r-project.org
>
> Kopie
>
> Předmět
>
> [R] Question regarding to replace
>
> Dear r-users,
>
> Basically, I have a data as follow
Thank you very much David for the advice !
I haven't checked the plyr and data.table packages but here is the script to
replace the for loop ::
dfrlm1<-as.data.frame(do.call("rbind", lapply(split(df1, df1$Name),
function(X){coef(rlm(col2 ~ col3, data=X))})))
names(dfrlm1)<-c("Intercept", "Slope")
Installation of rcom, statconnDCOM and RBloomberg
Hi folks,
Win7 64bit
R version 2.11.1 (2010-05-31)
Perform following steps to install rcom, statconnDCOM and RBloomberg
1) rcom installation
login Win7 as administrator and start R
> install.packages("rcom")
--- Please select a CRAN mirror fo
Hi
r-help-boun...@r-project.org napsal dne 09.11.2010 10:26:09:
> "Santosh Srinivas"
> Odeslal: r-help-boun...@r-project.org
>
> 09.11.2010 10:26
>
>
> Re: [R] Creating a list to store output objects from a recursive loop
>
> Figured this out this ways I think
>
> outPut <- list(list(resul
Hi all,
Thank you both. The codes work perfectly.
I now use
barplot(t(x.m)[-1,], names.arg = x.m[,1])
to make the 'histogram' plot.
Now how do I add a dentity line to it?
like 'superpose' on the graph?
say if I got a Normal with mean 100 and variance 3...
And I can work out the mean and vari
Hello Nasrin,
I think you might be wanting to use
rbind
instead of
merge
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-
aov.pen = aov(y ~ blend + treatment)
summary(aov.pen)
tukey.1 = function(aov.obj,data) {
vnames=names(aov.obj$contrasts)
if(length(vnames) != 2)
stop("the model must be two-way")
vara=data[,vnames[1]]
varb=data[,vnames[2]]
na=length(levels(vara))
nb=length(levels(varb))
resp=data[,as.charact
apologies for omitting the data
conc response curve
150 0.7533954 1
250 0.7755960 2
350 0.8001151 3
489 0.2858031 1
589 0.2883478 2
689 0.2954936 3
7 158 0.4296482 1
8 158 0.4406220 2
9 158 0.4567403 3
10 282 0.6484347
Hello;
I have a problem merging data sets. I use this command:
FileNames <- list.files(path="C:/updated_CFL_Rad_files/2007/11",
full.names=TRUE)
> dataMerge <- data.frame()
> for(f in FileNames){
+ ReadInMerge <- read.csv(file=f, header=T, na.strings="NULL")
+ dataMerge <- merge(dataMerge, Re
Hi Scott,
You can put the vline data in a separate data.frame:
dat <- data.frame(x=rnorm(20), y=rnorm(20), z=rep(c("a", "b"), each=10))
vline.dat <- data.frame(z=levels(dat$z), vl=c(0,1))
library(ggplot2)
ggplot(dat, aes(x=x, y=y)) +
geom_point() +
geom_vline(aes(xintercept=vl), data=vline.da
We cannot help since we do not have the data.
Uwe
On 09.11.2010 16:40, Robert Kinley wrote:
hello ...
Can anyone help me with this :
In R.exe 2.6 , Unix , :-
plot.data<-model[[i]]$data$conc
newdata<-seq(min(plot.data),max(plot.data),by=1)
model.pred<-predict(model[[i]],data.frame(newdata),
On Tue, Nov 9, 2010 at 2:06 AM, Marcus Drescher wrote:
> Dear all,
>
> if I plot a lattice xyplot like:
>
> library(lattice); require(stats);
> Depth <- equal.count(quakes$depth, number=8, overlap=.1)
>
> xyplot(lat ~ long | Depth, data = quakes)
>
>
> How can I manipulate the group title format (
Try this:
sapply(exclude, grep, x = dataset, value = TRUE)
On Tue, Nov 9, 2010 at 2:36 PM, Broeckling,Corey <
corey.broeckl...@colostate.edu> wrote:
> Hello R Helpers,
>
> Business - 64 bit windows 7, R 2.11.1
>
>
>
> I am trying to match the character contents of one list, called 'exclude',
>
Hello R Helpers,
Business - 64 bit windows 7, R 2.11.1
I am trying to match the character contents of one list, called 'exclude', to
those of a second list, called 'dataset'
dataset is a list of file names with folder locations, and looks like this when
called:
> dataset
[1] "A/10-10-29a-
Maybe:
gsub("\\.(\\d{1}\\s)", ".0\\1", x)
On Tue, Nov 9, 2010 at 3:43 PM, Dimitri Liakhovitski <
dimitri.liakhovit...@gmail.com> wrote:
> Thanks a lot, Henrique,
> but I realised, my strings look a bit more complicated, like this:
> x<-c("starts 2000.1 some words","starts 2001.2 different
> wo
On Tue, Nov 9, 2010 at 9:43 AM, Joshua Wiley wrote:
> On Tue, Nov 9, 2010 at 9:39 AM, Joshua Wiley wrote:
>> Hi Kate,
>>
>> is.na() does not work on entire data frames.
>
> whoops, I did not mean that. is.na() has a data frame method, but
> there are assignment issues (as you saw) when you use i
Help make this simpler – count business day
I am a beginner in R and this is my first post
Want to count the day in month. For example
Day
2010-09-01 1 Wed
2010-09-02 2 Thurs
2010-09-03 3 Friday
2010-09-07 4 Tuesday
2010-09-08 5 Wed
2010-09-09 6 Th
Hello,
I am plotting many histograms together using facet_grid in ggplot2. However,
I want to then add a vertical line to each histogram, or facet, each of
which vertical lines are at different x-values.
The following example adds all vertical lines to each facet:
ggplot(data,aes(values)) + geom_
Thanks for your suggestion. I received a few error messages. Can anyone help
me figure out why I get the following error messages and how to solve them
by revising my code? The data is shown in the post above. Thanks.
> library(zoo)
>
> colClasses <- c("character", "character", "numeric", "chara
Thanks a lot, Henrique,
but I realised, my strings look a bit more complicated, like this:
x<-c("starts 2000.1 some words","starts 2001.2 different
words","starts 2008.10 other stuff","starts 2010.12 sth else")
I tried to modify the gsub statement but can't get it working.
Thank you for your help!
On Tue, Nov 9, 2010 at 9:39 AM, Joshua Wiley wrote:
> Hi Kate,
>
> is.na() does not work on entire data frames.
whoops, I did not mean that. is.na() has a data frame method, but
there are assignment issues (as you saw) when you use it that way.
Josh
[snip]
Try this:
as.data.frame(append(iris, 1, after = 2))
On Tue, Nov 9, 2010 at 12:25 PM, Mohan L wrote:
> Dear All,
>
> I have a data frame with 5 column and 201 row data. I want to add one
> more column between column 1 and 2 with value of 1. So the new column
> has to be the second column fille
Kate -
As the error message indicates, num.strata is a
factor. This can occur when you're reading in data
and R encounters a non-numeric value which was not
specified in the na.strings= argument to read.table.
To do what you want, you'll need to convert it to a
character variable first:
You could use the "Reduce" function to get the sum of the matrices, then if
there are no missing vales just divide by the number of matrices. If there are
missing values then you would probably need to use Reduce again to count the
number of non-missing values.
Since all the matrices are the s
Could anyone give me some clues as to the best way to debug this error message?
I think it is from the passing of variables back to R from the jags function
which does Bayesian fitting. The curious part for me is that the error
messages seem random, yet the input data are always the same. An
Thanks a lot, Phil.
I decided to do it via the list - as you suggested, but had to do some
gymnastics, which Reduce will greatly help me to avoid now!
Dimitri
On Tue, Nov 9, 2010 at 12:36 PM, Phil Spector wrote:
> Dimitri -
> Usually the easiest way to solve problems like this
> is to put all t
Hi Kate,
is.na() does not work on entire data frames. You just need to specify
the column, for example:
data[is.na(data[, 8]), 8] <- 0
if the NAs were in column 8.
Best regards,
Josh
On Tue, Nov 9, 2010 at 9:33 AM, Kate Hsu wrote:
> Dear r-users,
>
> Basically, I have a data as follows,
>
Here are 2 possibilities:
cbind( iris[,1, drop=FALSE], 1, iris[,2:5] )
cbind( iris, 1) [ ,c(1,6,2:5) ]
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r
Dimitri -
Usually the easiest way to solve problems like this
is to put all the dataframes in a list, and then use
the Reduce() function to merge them all together at the
end. You don't give many details about how the data frames
are constructed, so it's hard to be specific about the
best way
Dear r-users,
Basically, I have a data as follows,
> data
S s1 s2 s3 s4 s5 prob obs num.strata
1 N N N N N N 0.108 32
2 Y N N N N Y 0.0005292 16
3 NNNYN N N N Y N 0.0005292 24
4 NNNYY N N N Y Y 0.0259308 8 1
OK, double oops. I first tested my code with length 100, then upped the number
but forgot to up the preallocation part, I should have used a variable there
instead so that only one place needed to be changed.
My version did have problems when I tried to do a vector of length 10,000, some
value
1 - 100 of 189 matches
Mail list logo