Hi,
I am passing a data frame and field name to a function. I've figured out how
I can create the formula based on the passed in field name, but I'm
struggling to create a vector based in that field.
for example if I hard code with the actual field name
Y = df$Target, everything works fine.
Thanks Gabor. That was exactly what I was looking for.
Ampy
ampc wrote:
Hi,
I have 2 date vectors d1 and d2.
d1 - structure(c(14526, 14495, 14464, 14433, 14402, 14371, 14340, 14309,
14278, 14247, 14216, 14185), class = Date)
d2 - structure(c(14526, 14509, 14488, 14466, 14453,
Hi All,
Thanks for your help. I need to reverse the digits of a number (unknown
lenght). Example 1234-4321
Tom
--
View this message in context:
http://www.nabble.com/How-do-I-reverse-the-digits-of-a-number-tp25838410p25838410.html
Sent from the R help mailing list archive at Nabble.com.
Manipulating Arrays
Using the below data:
df - structure(list(dim1 = structure(c(1L, 3L, 1L, 4L, 1L, 2L, 2L,
2L, 3L, 1L, 4L, 3L, 4L, 4L, 3L, 2L), .Label = c(a1, a2, a3,
a4), class = factor), dim2 = structure(c(2L, 1L, 2L, 2L,
4L, 3L, 1L, 3L, 1L, 3L, 2L, 4L, 3L, 4L, 1L, 4L), .Label = c(b1,
Hi,
I want to subset a data frame if one of the variables matches any in a list.
I could of course do something like this:
subset(dataset, var == 1 | var == 2 | var ==3)
but that's tedious.
I tried
varlist = c(1,2,3,4)
subset(dataset, any(var == varlist))
but it doesn't work because 'any'
Hi,
I think this is a case where you should use the ?[[ extraction
operator rather than $,
d = data.frame(a=1:3)
mytarget = a
d[[mytarget]]
HTH,
baptiste
2009/10/11 tdm ph...@philbrierley.com:
Hi,
I am passing a data frame and field name to a function. I've figured out how
I can create
This is pretty standard.
varList - 1:4
subData - subset(dataset, var %in% varList)
Should do it.
W.
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of
JustinNabble [justinmmcgr...@hotmail.com]
Sent: 11 October 2009 16:13
To:
Thanks, just the clue I needed, worked a treat.
baptiste auguie-5 wrote:
Hi,
I think this is a case where you should use the ?[[ extraction
operator rather than $,
d = data.frame(a=1:3)
mytarget = a
d[[mytarget]]
HTH,
baptiste
2009/10/11 tdm ph...@philbrierley.com:
Hi,
Thank you. I guess using predict() is probably closest to the R philosophy.
All the best,
Primož
2009/10/9 Henrique Dallazuanna www...@gmail.com:
Try with predict:
plot(x, y)
lines(0:10, predict(yfit, list(x = 0:10)))
2009/10/9 Primoz PETERLIN primozz.peter...@gmail.com:
Dear all,
Here
Can anybody tell me how to fix this error?
Thanks,
Tom
array_down = sort(sort_array,decreasing = 1)
Error in sort(sort_array, decreasing = 1) :
'decreasing' must be a length-1 logical vector.
--
View this message in context:
On 10/11/2009 10:55 AM, tom_p wrote:
Can anybody tell me how to fix this error?
Thanks,
Tom
'decreasing' must be a length-1 logical vector.
so either TRUE or FALSE
array_down = sort(sort_array,decreasing = TRUE )
array_down = sort(sort_array,decreasing = 1)
Error in sort(sort_array,
Hi,
the abind package can help you with the first query,
## add values
library(abind)
arr - abind(arr,arr[1,,,] * 2 + 1,along=1)
dim(arr)
as for the second, maybe you can use negative indexing,
## remove values
arr - arr[-2,,,]
HTH,
baptiste
2009/10/11 ampc ampc2...@gmail.com:
On Thu, 2009-10-08 at 16:14 -0400, Ashta wrote:
Hi all,
I have a matrix named x with N by C
I want to select every 5 th rrow from matrix x
I used the following code
n- nrow(x)
for(i in 1: n){
+ b - a[i+5,]
b
}
Error: subscript out of bounds
Can any body point out the problem?
Hi
jholtman wrote:
try this to get the column output:
cat(x, sep='\n', file='/tempxx.txt')
Thanks for your answer.
I've tried the command cat , but give me this error:
x-permn(c(2,3,5,7))
cat(x, file=/my_path/filename.txt,\n)
Error in cat(list(...), file, sep, fill, labels, append)
Hi,In Lattice graphs, can I use reorder function in a barchart as in the
case of dotchart? Or it can be used only with dotcharts?
Thanks
Chetty
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: chett...@gmail.com,vche...@bu.edu
[[alternative HTML
Try this:
library(tcltk)
as.numeric(tcl(string, reverse, 123))
[1] 321
On Sat, Oct 10, 2009 at 5:37 PM, tom_p t.p...@hotmail.com wrote:
Hi All,
Thanks for your help. I need to reverse the digits of a number (unknown
lenght). Example 1234-4321
Tom
--
View this message in context:
On Sun, Oct 11, 2009 at 12:53 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Try this:
library(tcltk)
as.numeric(tcl(string, reverse, 123))
[1] 321
The bit where the original poster said 'unknown length' worried me:
as.numeric(tcl(string, reverse, 12377656534))
[1] 0.4356568
zhijie zhang wrote:
Thanks for your ideas and suggestions. I need to point out that most of us
will create the Clustered-Stacked Column Chart in the matrix layout as David
gave above, but here i hope to display the graph side by side as the example
in the link
Jacob Wegelin wrote:
On Sat, Oct 10, 2009 at 8:51 PM, Peter Ehlers ehl...@ucalgary.ca wrote:
The key will show the levels of the 'groups' factor. So you will
have to ensure that the factor fed to groups has the levels
that you want displayed. ?xyplot explicitly states that
drop.unused.levels
Dear all,
I am searching the period of a time series usering R.
Is there some lag window functions in R?
Could you give me some books about spectral analysis usering R?
best wishes,
Wang
[[alternative HTML version deleted]]
__
On Sun, Oct 11, 2009 at 8:09 AM, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
On Sun, Oct 11, 2009 at 12:53 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Try this:
library(tcltk)
as.numeric(tcl(string, reverse, 123))
[1] 321
The bit where the original poster said 'unknown
On Oct 11, 2009, at 8:38 AM, sdlywjl666 wrote:
Dear all,
I am searching the period of a time series usering R.
Is there some lag window functions in R?
?lag
Could you give me some books about spectral analysis usering R?
best wishes,
Wang
You might try being more specific. The
Hi,
I have binary file with a set of tunable real parameters.
Upon execution the file returns 0 or 1 with some probability.
(therefore (nonlinear) logistic regression)
I need to find a set of parameters for which the probability of 1 is high.
I would like to create program that would repeatably
Andrew Choens andy.choens at gmail.com writes:
I am interested in hearing from members of the community, REvolution
Computing
employees/supporters (although please ID yourself as such) and most
anyone
else. I can see what they say on their website, but I'm interested in
getting
other
Hi,
I'm trying to plot a grouped data object for modelling maximum branch
size by distance from stem apex:
MAXBRD.group - groupedData(MAXBRD ~ Dtop | Type/Site/Tree,
inner=~Status, data=MAXBRD.data).
The following code produces a plot of MAXBRD ~ Dtop for each site type:
Hey Joris! Thanks, I can do that now, you've been a great help.
JorisMeys wrote:
Just saw I did something stupid. Both examples create a 2 by 2 grid in
your graph window, so you'll be able to plot 4 graphs in that window.
If you plot only 2 graphs, the lower half of the window will be
Sorry, this is an R newbie question:
I have managed to sucessfully do some of the basic access of a MySQL data base
with R but I have a question about the 'fetch' function.
The documentation refers to fetch(res, n, ...) but never fully describes the
ellipses (...) nor provides examples of what
Dear List,
I'm having problem with an exercise from The R book (M.J. Crawley) on page
567.
Here is the entire code upto the point where I get an error.
data(UCBAdmissions)
x - aperm(UCBAdmissions, c(2, 1, 3))
names(dimnames(x)) - c(Sex, Admit?, Department)
ftable(x)
fourfoldplot(x, margin = 2)
Hi Eiger,
Here a suggestion to get the output in the format you want:
# Package, data and path
require(combinat)
x - do.call(rbind,permn(c(23,46,70,71,89)))
f - C:/permutations.txt
# Original output
write.table(x, f, col.names = F, row.names = F)
# Transposed output
write.table(t(x),
On Sun, Oct 11, 2009 at 4:54 PM, romunov romu...@gmail.com wrote:
Dear List,
I'm having problem with an exercise from The R book (M.J. Crawley) on page
567.
Here is the entire code upto the point where I get an error.
data(UCBAdmissions)
x - aperm(UCBAdmissions, c(2, 1, 3))
Hi Romain,
It works for me:
model1 - glm(as.vector(x) ~dept*sex*admit,poisson)
model1
Call: glm(formula = as.vector(x) ~ dept * sex * admit, family = poisson)
Coefficients:
(Intercept) dept2 dept3 dept4
dept5
6.23832
On Sun, 11 Oct 2009, Ozan Bak???~_ wrote:
Hi R-users,
I would like to calculate weighted mean of several
variables by two factors where the weight vector is
the same for all variables.
Below, there is a simple example where I have only two
variables: v1,v2 both weighted by wt and my factors
Hi R users,
I'd be interested in what R users think about social networking around all
things R. For this, I've set up a social network @
www.rstuff.socialgo.comand it would be great if you could post your
comments on the forum created
for this discussion.
The News section has feeds from some of
Hi,
I'm new to R to and think it might be a good idea... who knows? I was
lurking in the R channel on freenode some days back and someone was
complaining about how no one ever talks there...
Anyway, signing up now...
Cheers,
Kenny
On Mon, Oct 12, 2009 at 1:10 AM, Harsh singhal...@gmail.com
Suppose I have the following hat matrix:
H=X(X'X)^{-1}X'
X is a n by p matrix, where n = p and X_{i,1} = 1
I'm wondering why H1 = 1. (Here, 1 is column vector, whose each
element is the number 1)
Thank you!
__
R-help@r-project.org mailing list
H projects vectors onto the range of X so any vector already in the
range of X gets projected onto itself.
On Sun, Oct 11, 2009 at 2:03 PM, Peng Yu pengyu...@gmail.com wrote:
Suppose I have the following hat matrix:
H=X(X'X)^{-1}X'
X is a n by p matrix, where n = p and X_{i,1} = 1
I'm
Dear Peng,
This seems a curious question to pose on r-help: The vector 1 is the first
column of X, and hence lies in the subspace spanned by the columns of X. H
projects any vector orthogonally onto the subspace spanned by X. Thus, if a
vector, such as 1, lies in this subspace, it's projected
Another, less geometric, way to think about this:
The fitted response for a linear model is a weighted average of the
observed responses. The i-th row of the hat matrix list the coefficients
of the average for the i-th fitted value. These values sum to 1 for each
row, and so H %*% 1=1.
Cheers...
Harsh-7 wrote:
Hi R users,
I'd be interested in what R users think about social networking around all
things R. For this, I've set up a social network @
www.rstuff.socialgo.comand it would be great if you could post your
comments on the forum created
for this discussion.
Could
Thank you Jorge and Barry for your input.
I've fiddled around a bit and as a result, am even more confused. If I start
R console via Notepad++ (I use Npp2R) and execute the model1, it goes
through just fine. Here is the sessionInfo() for this working session:
sessionInfo()
R version 2.9.2
Thanks baptiste. Works as expected.
ampy
ampc wrote:
Manipulating Arrays
Using the below data:
df - structure(list(dim1 = structure(c(1L, 3L, 1L, 4L, 1L, 2L, 2L,
2L, 3L, 1L, 4L, 3L, 4L, 4L, 3L, 2L), .Label = c(a1, a2, a3,
a4), class = factor), dim2 = structure(c(2L, 1L, 2L, 2L,
Check to see if you have an old workspace being loaded. You might have an
object called 'family' which you might need to remove.
--sundar
On Oct 11, 2009 12:15 PM, romunov romu...@gmail.com wrote:
Thank you Jorge and Barry for your input.
I've fiddled around a bit and as a result, am even more
Dear Simon,
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
Behalf Of Simon Bonner
Sent: October-11-09 2:33 PM
To: Peng Yu
Cc: r-h...@stat.math.ethz.ch
Subject: Re: [R] Why H1=1? (H's the hat matrix)
Another, less geometric, way to
Hello Sundar,
I checked the ls() and it was full of something (something that I should
have removed long ago but was not diligent enough). I have cleared the list
(via rm(list=ls()) and the glm function works fine now.
Cheers,
Roman
On Sun, Oct 11, 2009 at 9:21 PM, Sundar Dorai-Raj
I'm trying to save the random seed in a for loop. How can one go about doing
that and preserving the seed for the next session.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
Hi
Are you one of my 380 students? If so, please contact me directly about
any difficulties you are having with assignment work. Sending questions
via R-help like this is inefficient because there is a chance that I
might not spot it.
At the very least, you should declare to all of the
On Sun, Oct 11, 2009 at 7:51 PM, HBaize hba...@buttecounty.net wrote:
Harsh-7 wrote:
Hi R users,
I'd be interested in what R users think about social networking around all
things R. For this, I've set up a social network @
www.rstuff.socialgo.comand it would be great if you could post
Hey Galois (?),
See the help file for set.seed() (help(set.seed)).
In short, the current seed is stored in the variable .Random.seed. You
can save the seed with:
myseed - .Random.seed
Hope that helps,
Simon
-
Simon Bonner
Post-Doctoral Fellow
Department of Statistics, UBC
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1-rnorm(200. mean=0, std=1)
p2-rnorm(200. mean=0, std=1)
x - cbind(x, v1=ifelse(x[,'p1'] 0.4, 1, 0), v2=ifelse(x[,'p2'] 0.6, 0,
1))
I found the
Hi Ashta,
On Sun, Oct 11, 2009 at 4:06 PM, Ashta wrote:
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1-rnorm(200. mean=0, std=1)
p2-rnorm(200. mean=0, std=1)
Ashta wrote:
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1-rnorm(200. mean=0, std=1)
p2-rnorm(200. mean=0, std=1)
x - cbind(x, v1=ifelse(x[,'p1'] 0.4, 1, 0), v2=ifelse(x[,'p2'] 0.6, 0,
Hello there,
I wish to solve the following nonlinear System of equations:
+ u1 - Vmax11*S1/(S1 + Km11 *(1 + S2/Km21)) - Vmax12*S1/( S1 + Km12
*(1+S2/Km22)) == 0
+ u2 - Vmax22*S2/(S2 + Km22 *(1 + S1/Km12)) - Vmax21*S2/( S2 + Km21
*(1+S1/Km11)) == 0
+ Vmax11*S1/(S1 + Km11 *(1 + S2/Km21)) +
R-Help,
I been using nlme to fit a model with 2 random effects. The correlation
matrix I get with the VarCorr command does not seem to have the correct
value for the correlation entry. E.g., below is a VarCorr matrix of random
effects from data that I am working on:
Variance StdDev
There are two packages for solving nonlinear systems: one is the `BBsolve'
function in the BB package, and the other is `nleqslv' in the nleqslv
package.
Ravi.
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of
Hi there,
I have created the function below:
pirate-function(x){
a-x-1; b-a/5; c-a-b;
d-c-1; e-d/5; f-d-e;
g-f-1; h-g/5; i-g-h;
j-i-1; k-j/5; l-j-k;
m-l-1; n-m/5; o-m-n;
final-o/5;
final
}
I want to run this function until the output ('final') is an exact integer
(e.g. 893.0 rather than
CRAN (and crantastic) updates this week
New packages
* AGSDest (1.0)
Niklas Hack
http://crantastic.org/packages/AGSDest
Estimation in adaptive group sequential trials
* atmi (1.0)
Waldemar Kemler, Peter Schaffner,
http://crantastic.org/packages/atmi
Analysis and usage
Hi all,
I require 2 RMySQL libraries in order to query from a database.
'RMySQL_0.7-4' (newest version) results in an error when more than 1 field
is queried.
''RMySQL_0.5-11' (old version) resolves this issue where more than 1 field
can be queried without any errors. However, other queries
A.J. Rossini wrote:
Ubuntu is a commercial distribution, for loose definitions of commercial.
Why shouldn't they cut a deal with Revolution, who is doing a very similar
thing?
If you want something closer to the ideal of volunteer-driven free as in
beer and speech, you'll need to
jimdare wrote:
Hi there,
I have created the function below:
pirate-function(x){
a-x-1; b-a/5; c-a-b;
d-c-1; e-d/5; f-d-e;
g-f-1; h-g/5; i-g-h;
j-i-1; k-j/5; l-j-k;
m-l-1; n-m/5; o-m-n;
final-o/5;
final
}
I want to run this function until the output ('final') is an exact
Dear all,
I have a question about loading the data to barchart plot. I know this could
be a very easy question, but I just can not get my head around.
What I need to do is to create a trellis plots barchart style (horizontal
bar), with levels of one variable (ie. variable colour in my
Hey everybody, I have a matrix with three columns.
I want to plot two columns (independent variable) against one column (the
defendant). This is my code and the error associated with it:
plot(p, q, data=columns)
plot(pprime,q, add=TRUE)
Warning messages:
1: In plot.window(...) : add is not a
You're going about it the wrong way:
plot(p, q1)
lines(p, q2)
or
points(p, q2)
depending on what you want it to look like.
Sarah
On Sun, Oct 11, 2009 at 8:52 PM, Mehdi Khan mwk...@ucdavis.edu wrote:
Hey everybody, I have a matrix with three columns.
I want to plot two columns (independent
cls59 wrote:
jimdare wrote:
Hi there,
I have created the function below:
pirate-function(x){
a-x-1; b-a/5; c-a-b;
d-c-1; e-d/5; f-d-e;
g-f-1; h-g/5; i-g-h;
j-i-1; k-j/5; l-j-k;
m-l-1; n-m/5; o-m-n;
final-o/5;
final
}
I want to run this function until the output
x1=rnorm(100)
x2=rnorm(100)
e=rnorm(100)
y=1.5*x1+x2+e
plot(y~x1,pch=1,xlim=c(min(x1,x2),max(x1,x2)))
points(y~x2,pch=16)
HTH
Daniel
-
cuncta stricte discussurus
-
-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org
Okay it worked, is there any way I can define the scale though?
thanks a lot!
On Sun, Oct 11, 2009 at 6:08 PM, Daniel Malter dan...@umd.edu wrote:
x1=rnorm(100)
x2=rnorm(100)
e=rnorm(100)
y=1.5*x1+x2+e
plot(y~x1,pch=1,xlim=c(min(x1,x2),max(x1,x2)))
points(y~x2,pch=16)
HTH
Daniel
What do you mean by define the scale?
--
On Oct 11, 2009, at 9:26 PM, Mehdi Khan wrote:
Okay it worked, is there any way I can define the scale though?
thanks a lot!
On Sun, Oct 11, 2009 at 6:08 PM, Daniel Malter dan...@umd.edu wrote:
x1=rnorm(100)
x2=rnorm(100)
e=rnorm(100)
y=1.5*x1+x2+e
I am wondering if there is an implementation of PNN by Specht in R.
thank you so much!
--
==
WenSui Liu
Blog : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do. - Robert Schuller
__
Hi
I think the following will help:
#Load some packages
library(lattice)
library(reshape)
#Sample data
dataset.frame
-
data.frame(id=c(a,b,c,a,c,b,a),colour=c(blue,green,red,red,red,green,green))
# calculate the counts
dataset.table - table(dataset.frame)
#and reshape the table
dataset.melt -
68 matches
Mail list logo