On 03/08/11 05:52, wildernessness wrote:
Fairly new at this.
Trying to create a conditional density plot.
cdplot(status~harvd.l,data=phy)
Error in cdplot.formula(status~harvd.l,data=phy):
dependent variable should be a factor
What does this error mean? Status is a binary response of infestat
Hi Jimmy
Years ago I think that Splus introduced an argument when dumping of
old.style = T or something similar to dump it into a form that could
be read into R.
This may only be for data.frames etc not things like random forest objects
Regards
Duncan
Duncan Mackay
Department of Agronomy
On Mon, 01-Aug-2011 at 02:55PM -0400, Sushil Amirisetty wrote:
|>
|> Hi Everyone,
|>
|> When i try to install a package using
|>
|> > install.packages("agricolae")
|> --- Please select a CRAN mirror for use in this session ---
|> |
|>
|>
|> The cursor keeps blinking i dont get a popup m
Hi:
Here's one way; using the mdply() function in the plyr package:
k <- c(1,2,3,4,5)
i <- c(0,1,3,2,1)
# Takes two scalars k and i as input, outputs a data frame
ff <- function(k, i) data.frame(k = rep(k, i+1), i = seq(0, i, by = 1))
library('plyr')
mdply(data.frame(k, i), ff) # returns a da
What is teh reason some functions in the AICcmodavg package do not work with
'mer' class models?
One such example would be the 'importance' function.
Thanks
Ronny
--
View this message in context:
http://r.789695.n4.nabble.com/AICcmodavg-functions-and-mer-class-models-tp3714534p3714534.html
Sent
Dear Harrell,
Many thanks for your quick response!
However, after try and try, I still have difficulty to solve my questions.
I post my questions again. I hope someone can help me run the data and draw
the nomogram and calibration plot for me. I know that is not good but indeed
I have no way to go
Fairly new at this.
Trying to create a conditional density plot.
>cdplot(status~harvd.l,data=phy)
Error in cdplot.formula(status~harvd.l,data=phy):
dependent variable should be a factor
What does this error mean? Status is a binary response of infestation (0/1)
and harvd.l is the log of timber
G'day Kathie,
On Tue, 2 Aug 2011 19:56:00 -0700 (PDT)
Kathie wrote:
> Hi, R users,
>
> Here is an example.
>
> k <- c(1,2,3,4,5)
> i <- c(0,1,3,2,1)
>
> if k=1, then j=0 from i
> if k=2, then j=0, 1 from i
> if k=3, then j=0, 1, 2, 3 from i
> if k=4, then j=0, 1, 2 from i
> if k=5, then j=0,
Hi, R users,
Here is an example.
k <- c(1,2,3,4,5)
i <- c(0,1,3,2,1)
if k=1, then j=0 from i
if k=2, then j=0, 1 from i
if k=3, then j=0, 1, 2, 3 from i
if k=4, then j=0, 1, 2 from i
if k=5, then j=0, 1 from i
so i'd like to create a list like below.
> list
k j
1 1 0
2 2 0
3 2 1
4 3 0
5
Hi, R users,
Here is an example.
k <- c(1,2,3,4,5)
i <- c(0,1,3,2,1)
if k=1, then i=0
if k=2, then i=0, 1
if k=3, then i=0, 1, 2, 3
if k=4, then i=0, 1, 2
if k=5, then i=0, 1
so i'd like to create a list like below.
> list
k i
1 1 0
2 2 0
3 2 1
4 3 0
5 3 1
6 3 2
7 3 3
8 4 0
9 4 1
1
Hi Sverre,
On Tue, Aug 2, 2011 at 10:22 PM, Sverre Stausland
wrote:
> Dear helpers,
>
> I'm trying to extract certain rows from a matrix according to the
> values the rows have in a certain column. I've been googling for a
> while without result.
>
> Here's a reproducible example of a matrix (and
Dear helpers,
I'm trying to extract certain rows from a matrix according to the
values the rows have in a certain column. I've been googling for a
while without result.
Here's a reproducible example of a matrix (and the one I was playing
with initially):
> myrepo<-getOption("repos")
> myrepo["CR
Hi,
I have a randomforest object "cost.rf" that was created in splus 8.0,
now I need to use this trained RF model in R. So in Splus, I dump the RF
file as below
data.dump("cost.rf", file="cost.rf.txt", oldStyle=T)
then in R, restore the dumped file,
library(foreign)
data.restore("cost.rf.tx
Hello all,
I am newbie to R and have not been able to find too much stuff on a version of
VAR(p) I am working on.
Would someone be able to tell me if there is a more elegant way of writing A
function for the following? Many thanks in advance. Darius
I am regressing returns of 8 asset classes
I used matplot to plot multiple lines (over 300 lines). I'd like to draw a
polygon and shade the area between upper and lower boundary.
I know the plot function works pretty well with polygon(). How about matplot? I
have too many lines and my upper/lower boundaries are formed by many different
If the question is that the string contains all blanks, then a regular
expression will probably be best:
> OneBlank <- " "
> TwoBlanks <- " "
> ThreeBlanks <- " "
> NoBlanks <- "NoBlanks"
> bvec <- c(OneBlank, TwoBlanks ,ThreeBlanks ,NoBlanks)
> bvec <- c(OneBlank, TwoBlanks ,ThreeBlanks ,NoBla
On Tue, Aug 2, 2011 at 5:07 PM, John Sorkin wrote:
> windows 7
> R 2.12.1
>
> Is there any easy way to determine if a sting contains nothing but blanks? I
> need to check a series of strings of various length.
>
> OneBlank <- " "
> TwoBlanks <- " "
> ThreeBlanks <- " "
> NoBlanks <- "NoBlanks"
From a search at Barons site with "fitting distribution truncated
power"
http://finzi.psych.upenn.edu/R/library/brainwaver/html/fitting.html
http://finzi.psych.upenn.edu/R/library/gamlss/doc/gamlss-manual.pdf
http://finzi.psych.upenn.edu/R/library/bipartite/html/degreedistr.html
http://finzi.ps
On Aug 2, 2011, at 8:07 PM, John Sorkin wrote:
windows 7
R 2.12.1
Is there any easy way to determine if a sting contains nothing but
blanks? I need to check a series of strings of various length.
OneBlank <- " "
TwoBlanks <- " "
ThreeBlanks <- " "
NoBlanks <- "NoBlanks"
What I want wou
windows 7
R 2.12.1
Is there any easy way to determine if a sting contains nothing but blanks? I
need to check a series of strings of various length.
OneBlank <- " "
TwoBlanks <- " "
ThreeBlanks <- " "
NoBlanks <- "NoBlanks"
What I want would be a function such as ALLBLANKS that would return
Em Segunda 01 Agosto 2011, você escreveu:
> Is there a preferred language you would like to use in your package
> development? I randomly downloaded packages until I found some that
> helped me along my way, and might be able to help you pick one. If you
> are just looking at building a package of
Hey All,
I'm trying to use the xlsx package to read a series of excel spreadsheets
into R, but my code is failing at the first step.
I setwd into my the directory with the spreadsheets, and, as a test ask for
the first one:
read.xlsx(file = "Argentina Final.xls", sheetIndex = 1)
I promptly
Hi R helpers,
I tried to convert a list of LatLong coordinates (in DD format) into UTM
zone 11 NAD 27. I first tried this from PBSmapping:
library(PBSmapping)
LatLong<-cbind(c(56.85359, 56.85478),c(-118.4109, -118.4035))
colnames(LatLong)<-c("X","Y")
attr(LatLong, "projection") <- "UTM"
attr(Lat
On Thu, 2011-07-28 at 11:58 -0400, Sarah Goslee wrote:
> Hi Mark,
>
> On Thu, Jul 28, 2011 at 10:44 AM, wrote:
> >
> > 1. How can I plot the entire tree produced by rpart?
>
> What does plot() not do that you are expecting?
Not do any labelling... ;-)
text(tree)
where `tree` is your fitte
Are you sure it doesn't? na.rm=T works for me, so I think your problem is
elsewhere.
Specifically, the example given below consists of 27 character strings, not
numbers, so there' so surprise R doesn't want to give you a mean -- to R,
it's as logical as asking for the average of "a" and "Q5"
Try
I have the following:
Tout = c(".", ".",
+ "-51.0", " -9.6", " -9.6", " -9.6", " -9.6", " -9.6", " -9.6",
+ " -9.6", " -9.5", " -9.5", " -9.6", " -9.5", " -9.6", " -9.6",
+ " -9.5", " -9.4", " -9.3", " -9.3", " -9.3", " -9.2", " -9.0",
+ " -9.0", " -8.9", " -8.9", " -8.9")
How ca
Thanks to Peter Dalgaard and to Baptiste Auguie (off-list) for the
insights they provided.
cheers,
Rolf turner
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R
Dear R folks,
having simulation data in a vector n2off, I know that they should be
similar to a power function f [1], f(n) = n^(-1/r), r ∈ ℕ\{0}, and I
want to find the value for r best fitting the simulation data.
Furthermore I know that this is only true for big n, that means n2off(n)
~ f(n) ⇔
On 11-08-02 2:39 PM, wwreith wrote:
Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't
mean 3D as in x,y,z coordinates. Just a 2D bar graph with a 3D shaped bard.
See attached excel file for an example.
Before anyone asks I know that 3D looking bars don't add anything exce
On 8/2/2011 11:39 AM, wwreith wrote:
Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't
mean 3D as in x,y,z coordinates. Just a 2D bar graph with a 3D shaped bard.
See attached excel file for an example.
It is not possible.
Before anyone asks I know that 3D looking bars
On Wed, Aug 3, 2011 at 5:11 AM, r student wrote:
> Like below?
>
> plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
>
Yes
If you are doing lots of analyses with weighted data you might want to
look at the survey package. It also has a density estimator, in
svysmooth(), which works very mu
Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't
mean 3D as in x,y,z coordinates. Just a 2D bar graph with a 3D shaped bard.
See attached excel file for an example.
Before anyone asks I know that 3D looking bars don't add anything except
"prettiness".
http://r.789695.n4.
Hi,
This might be a simple problem but I don't know how to calculate a random
variable density the way panel.histogram does it before it creates the
actual density rectangles. The documentation says that it uses the density
function but the actual code suggests that the hist.constructor function
(
Hi:
One more possibility:
> names(my.vector[grep('recommended', my.vector)])
[1] "Matrix" "boot" "class" "cluster""codetools"
[6] "foreign""KernSmooth" "lattice""MASS" "Matrix"
[11] "mgcv" "nlme" "nnet" "rpart" "spatial"
[16] "survival"
>
Sverre,
Try this:
my.list <- split(names(my.vector), my.vector)
my.list$base
my.list$recommended
Jean
`·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º>
Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409 USA
From:
Sverre Sta
On Aug 2, 2011, at 2:21 PM, Sverre Stausland wrote:
Dear helpers,
I can create a vector with the priority of the packages that came with
R, like this:
installed.packages()[,"Priority"]->my.vector
my.vector
base boot class cluster codetools
"base" "re
Hi:
Here are a couple of ways. Since your data frame does not contain a
'c' in ID2, we redefine the factor to give it all five levels rather
than the observed four:
> df <- read.table(textConnection("
+ ID1 ID2 Value
+ a b 1
+ b d 1
+ c a 2
+ c e 1
+ d a 1
+ e d 2"), header = TRUE)
str(df)
> str(
Dear helpers,
I can create a vector with the priority of the packages that came with
R, like this:
> installed.packages()[,"Priority"]->my.vector
> my.vector
base boot class cluster codetools
"base" "recommended" "recommended" "recommended" "recommended"
Like below?
plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
On Tue, Aug 2, 2011 at 10:06 AM, David Winsemius wrote:
>
> On Aug 2, 2011, at 12:51 PM, r student wrote:
>
>> I'm trying to create a density plot using census data, where the
>> weights don't sum to 1.
>>
>>
>>> plot(density
On Aug 2, 2011, at 19:09 , Guillaume wrote:
> Hi Peter,
>
> Yes I have a large number of factors in the listBy table.
>
> Do you mean that aggregate() creates a complete cartesian product of the
> "by" columns ? (and creates combinations of values that do not exist in the
> orignial "by" table,
On Aug 2, 2011, at 19:17 , Bert Gunter wrote:
> Thanks for this Peter:
>
>>
>> Sarah (sic) is on the right track, just lose the commas so that you don't
>> drop to a vector:
>>
>>> x <- data.frame(A=1:3, B=1:3, C=1:3, D=1:3, E=1:3)
>>> newcol <- 4:6
>>> cbind(x[1], newcol, x[2:ncol(x)])
>> A
Jagz,
Assuming that your data frame is called df, try this ...
tapply(df$Value, list(df$ID1, df$ID2), mean)
Jean
`·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º>
Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409 USA
715-627-
On Aug 2, 2011, at 1:11 PM, r student wrote:
Like below?
plot(density(oh$FINCP,weights=oh$PWGTP/sum(oh$PWGTP)))
I don't understand why you are asking for approval. You are the one
with the data and know where they came from. We have none of that
background.
--
David.
On Tue, Aug 2, 20
Thanks for this Peter:
>
> Sarah (sic) is on the right track, just lose the commas so that you don't
> drop to a vector:
>
>> x <- data.frame(A=1:3, B=1:3, C=1:3, D=1:3, E=1:3)
>> newcol <- 4:6
>> cbind(x[1], newcol, x[2:ncol(x)])
> A newcol B C D E
> 1 1 4 1 1 1 1
> 2 2 5 2 2 2 2
> 3
Hi,
I've tried to look through all the previous related Threads/posts but can't
find a solution to what's probably a simple question.
I have a data frame comprised of three columns e.g.:
ID1 ID2 Value
a b 1
b d 1
c a 2
c e 1
d a 1
e d 2
I'd like to convert the data to a matrix i.e.:
a b c
Hi Peter,
Yes I have a large number of factors in the listBy table.
Do you mean that aggregate() creates a complete cartesian product of the
"by" columns ? (and creates combinations of values that do not exist in the
orignial "by" table, before removing them when returning the aggregated
table?)
On Aug 2, 2011, at 12:51 PM, r student wrote:
I'm trying to create a density plot using census data, where the
weights don't sum to 1.
plot(density(oh$FINCP,weights=oh$PWGTP))
Warning message:
In density.default(oh$FINCP, weights = oh$PWGTP) :
sum(weights) != 1 -- will not get true dens
Does
xyplot(y ~ seq_along(y), xlab = "Index")
do what you want?
Peter Ehlers
On 2011-08-02 09:07, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote:
Dear all,
How can I make an index plot with lattice, that is plotting a vector
simply against its particular index in the vector, i.e. someth
Thanks a lot, everyone!
Dimitri
On Tue, Aug 2, 2011 at 12:34 PM, Dennis Murphy wrote:
> Hi:
>
> You could try the lubridate package:
>
> library(lubridate)
> week(weekly$week)
> week(july4)
> [1] 27 27
>
>> week
> function (x)
> yday(x)%/%7 + 1
>
>
> which is essentially Gabor's code :)
>
> HTH,
I'm trying to create a density plot using census data, where the
weights don't sum to 1.
>plot(density(oh$FINCP,weights=oh$PWGTP))
Warning message:
In density.default(oh$FINCP, weights = oh$PWGTP) :
sum(weights) != 1 -- will not get true density
How would I go about doing this?
Thanks!
On Aug 1, 2011, at 20:50 , David L Carlson wrote:
> Actually Sara's method fails if the insertion is after the first or before
> the last column:
>
>> x <- data.frame(A=1:3, B=1:3, C=1:3, D=1:3, E=1:3)
>> newcol <- 4:6
>> cbind(x[,1], newcol, x[,2:ncol(x)])
>
Sarah (sic) is on the right track,
Hi:
You could try the lubridate package:
library(lubridate)
week(weekly$week)
week(july4)
[1] 27 27
> week
function (x)
yday(x)%/%7 + 1
which is essentially Gabor's code :)
HTH,
Dennis
On Tue, Aug 2, 2011 at 7:36 AM, Dimitri Liakhovitski
wrote:
> Hello!
>
> I have dates for the beginning of
Whoa!
1. First and most important, there is very likely no reason you need
to do this. R can handle multiple groupings automatically in fitting
and plotting without creating artificial labels of the sort you appear
to want to create. Please read an "Intro to R" and/or get help to see
how.
2. The
Dear all,
How can I make an index plot with lattice, that is plotting a vector
simply against its particular index in the vector, i.e. something
similar to
y <- rnorm(10)
plot(y)
I don't want to specify the x's manually, as this could become
cumbersome when having multiple panels.
I tried some
Hi:
Another way to do this is to use one of the summarization packages.
The following uses the plyr package.
The first step is to create a function that takes a data frame as
input and outputs either a data frame or a scalar. In this case, the
function returns a scalar, but if you want to carry a
On Aug 2, 2011, at 17:10 , Guillaume wrote:
> Hi Peter,
> Thanks for your answer.
> I made a mistake in the script I copied sorry !
>
> The description of the object : listX has 3 column, listBy has 4 column, and
So what is the contents of listBy? If they are all factors with 100 levels,
t
Does this help?
x <- c(3, 8, 5, 2, 9, 33, 21)
# the 43rd percentile
quantile(x, 0.43)
# the proportion of the distribution that is less than 7
mean(x<7)
Jean
`·.,, ><(((?> `·.,, ><(((?> `·.,, ><(((?>
Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East
Has anyone got SSOAP working on anything besides KEGG?
I just tried another 3 SOAP servers. Both the WSDL and constructing the .SOAP
call. Again the perl and ruby interface worked without any hitches.
Paul
> library(SSOAP)
> massBank<-processWSDL("http://www.massbank.jp/api/services/MassBankAPI
Would this work for you?
if you want to know where the i-th element falls percentage-wise in the
distribution of a vector:
sum(x <= x[i])/length(x)
This could be turned into a function:
pEmpirical <- function(i,x) {
if (length(i) > 1) return(apply(as.matrix(i), 1, pEmpirical,x))
r = sum
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of chakri
> Sent: Tuesday, August 02, 2011 6:31 AM
> To: r-help@r-project.org
> Subject: Re: [R] Standard Deviation of a matrix
>
> Thank you everyone for your kind input,
>
> I fo
On Aug 2, 2011, at 10:14 AM, ראובן אברמוביץ wrote:
I'm familiar with the quantile() command, but what if I have a
specific
number that I want to know its location in a vector? I know that
in known
distributions, (for example the normal distribution), there is
pnorm and
qnorm, bu
?expand.grid
---
Jeff Newmiller The . . Go Live...
DCN: Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rock
Dear R experts;
I am trying to extract the p values from a coxme object (package coxme). I
can see the value in the model output, but I wanted to have the result with
a higher number of decimal places.
I have searched the mailing list and followed equivalent suggestions for
nlme/lme objects, but I
Dear R users,
I have two n*1 integer vectors, y1 and y2, where n is very very large.
I'd like to compute
elbp = 4^(y1) * 5^(y2) * sum_{i=0}^{max(y1, y2)} [{ (y1-i)! * (i)! *
(y2-i)! }^(-1)];
that is, I need to compute "elbp" for each (y1, y2) pair.
So I made R code like below, but I don't t
Hi Peter,
Thanks for your answer.
I made a mistake in the script I copied sorry !
The description of the object : listX has 3 column, listBy has 4 column, and
they have 9000 rows :
print(paste("ncol x ", length((listX
print(paste("ncol By ", length((listBy
print(paste("nrow ", length(
I'm familiar with the quantile() command, but what if I have a specific
number that I want to know its location in a vector? I know that in known
distributions, (for example the normal distribution), there is pnorm and
qnorm, but how can I do it with unknown vector?
thanks in adva
Thank you everyone for your kind input,
I forgot to add that I have decimal points in my matrix !
Enclosed input file (reduced to 10 X 10 matrix), scripts and output for your
suggesions:
Code 1:
library(stats)
Matrix<-read.table("test_input", head=T, sep=" ", dec=".")
SD<-sd(as.numeric(Matrix))
On Tue, Aug 2, 2011 at 10:36 AM, Dimitri Liakhovitski
wrote:
> Hello!
>
> I have dates for the beginning of each week, e.g.:
> weekly<-data.frame(week=seq(as.Date("2010-04-01"),
> as.Date("2011-12-26"),by="week"))
> week # each week starts on a Monday
>
> I also have a vector of dates I am intere
R-help and Barry
Thank you for your suggestions. It works, and may I ask how I am able
to do the opposite (disable the call back, so that I could control
when to show and suppress the output). I would like to make a function
to enable/disable the callback similar to the one as follow:
enableOutpu
Hello,
I am using multinomial logit regression for the first time, and I am trying to
understand the warnings and errors I get.
My data consists of 200 to 600 samples with ~25 predictors (these are principal
components). The response has three categories.
I use the function "vglm" from the pa
How about this?
> indx <- unique(cbind(Dates, Groups))
> indx
DatesGroups
[1,] "12/10/2010" "A"
[2,] "12/10/2010" "B"
[3,] "13/10/2010" "A"
[4,] "13/10/2010" "B"
[5,] "13/10/2010" "C"
> indx <- data.frame(indx, id=1:nrow(indx))
> indx
Dates Groups id
1 12/10/2010
Michael,
The function aggregate() is not going to work for your situation. The
function is applied to the individual columns of the subsetted data, not
the subsetted data frame as a whole. The help file reads: "Then, each of
the variables (columns) in x is split into subsets of cases (rows) o
The findInterval function should surely be tried in some form or
another.
On Aug 2, 2011, at 10:36 AM, Dimitri Liakhovitski wrote:
Hello!
I have dates for the beginning of each week, e.g.:
weekly<-data.frame(week=seq(as.Date("2010-04-01"),
as.Date("2011-12-26"),by="week"))
week # each week
Yes, you can use:
eval(parse(text=c))
On the other hand I would not recommend to use c as a variable name as it is
the name of a very important function in the R language to aggregate data.
HTH,
Samuel
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-projec
>From multiple data.frames I created two lists, one with temperature, one with
gps data. With your help and lapply I managed to interpolate the timestamps
of gps and temperature data. Now I want to merge/join both lists via the
time-stamp, taking only times, where both lists have data.
For the sin
I realize that matrix indexing has been addressed in various flavors, but I'm
stumped and didn't find anything in the archives. It's not clear if it is an
igraph issue or a more general problem. Thanks in advance for your patience.
I am using igraph to read a gml file
(http://www-personal.umic
Hello!
I have dates for the beginning of each week, e.g.:
weekly<-data.frame(week=seq(as.Date("2010-04-01"),
as.Date("2011-12-26"),by="week"))
week # each week starts on a Monday
I also have a vector of dates I am interested in, e.g.:
july4<-as.Date(c("2010-07-04","2011-07-04"))
I would like to
Dear R-experts:
I am using a function called AUC whose arguments are data, time, id, and
dv.
data is the name of the dataframe,
time is the independent variable column name,
id is the subject id and
dv is the dependent variable.
The function computes area under the curve by trapezoidal
On Aug 2, 2011, at 11:45 , Guillaume wrote:
> Dear all,
> I am trying to aggregate a table (divided in two lists here), but get a
> memory error.
> Here is the code I'm running :
>
> sessionInfo()
>
> print(paste("memory.limit() ", memory.limit()))
> print(paste("memory.size() ",
Hi Kim,
You can use
eval(parse(text = c))
Best,
Ista
On Tue, Aug 2, 2011 at 8:22 AM, Kim Lillesøe wrote:
> Dear all
>
> I have a simple R question. How do I execute R-code stored in a variable?
>
> E.g if I have a variable which contains some R-code:
> c = "reg <- lm(sales$sales~sales$price)"
>
Hi:
Try this:
> z <- matrix(rnorm(100), nrow = 10)
> sum(sapply(seq_len(nrow(z)), function(k) det(z[-k, -k])))
[1] 1421.06
where
> sapply(seq_len(nrow(z)), function(k) det(z[-k, -k]))
[1] 432.11613 81.65449 516.95791 54.72775 804.32097 -643.35436
[7] -411.15932 394.18780 84.13173 10
Thanks a lot, Michael - that's exactly what I was looking for!
Dimitri
On Tue, Aug 2, 2011 at 9:48 AM, R. Michael Weylandt
wrote:
> Now that I'm back at my computer, I'll actually suggest you do something
> else entirely.
>
> If you look at the code of holidayNYSE() or by calling listHolidays()
Hi:
Could you please provide a reproducible example? In your code,
(i) n is undefined;
(ii) logbp is undefined.
A description of what you want to do and/or a reproducible example
with an expected outcome would be useful.
As the bottom of each e-mail to R-help says...
PLEASE do read the posti
Now that I'm back at my computer, I'll actually suggest you do something
else entirely.
If you look at the code of holidayNYSE() or by calling listHolidays() of the
timeDate package you'll see that there are many many functions that get
every conceivable holiday directly. I'll let you pick the hol
On 08/02/2011 01:07 PM, Dennis Murphy wrote:
> In addition to the other responses (all of which I liked), a couple of
> other alternatives to consider are 2D density plots (see ?kde2d in the
> MASS package, for example) or geom_tile() in the ggplot2 package,
> which you can think of as a 3D histog
In addition to the other responses (all of which I liked), a couple of
other alternatives to consider are 2D density plots (see ?kde2d in the
MASS package, for example) or geom_tile() in the ggplot2 package,
which you can think of as a 3D histogram projected to 2D with color
corresponding to (relat
Hi
>
> Hi,
>
> I have some simple statistics to calculate for a large
> number of variables.
> I created a simple function to apply to variables.
> I would like the variable name to be placed automatically.
> I tried the following function but is not working.
>
> desc = function(x){
>
Dear all
I have a simple R question. How do I execute R-code stored in a variable?
E.g if I have a variable which contains some R-code:
c = "reg <- lm(sales$sales~sales$price)"
Is it possible to execute c
E.g like Exec(c)
I hope someone can help.
Thank you
Kim Lillesøe
[[alternative H
Rattle won't install properly on my Windows 7 64 bit laptop.
Here is what I've tried:
I've followed the instructions here:
http://rattle.togaware.com/rattle-install-mswindows.html
I had R installed already.
I downloaded the GTK+ packages, unzipped the 32 bit one into c:\gtkwin32.
I put c:\gtkwin
Dear R-help list,
Pls I have this problem. Suppose I have a matrix of size nxn say, generated as
follows
z<-matrix(rnorm(n*n,0,1),nrow=n)
I want to write a function such that for i in 1:n, I will remove the rows and
columns
corresponding to i (so, will be left with n-1*n-1 submatrix in each
On Aug 2, 2011, at 8:48 AM, Petr PIKAL wrote:
Hi
Hi!
The sample below should give you what you want:
M = matrix(runif(100), 10, 10)
sd(as.numeric(M))
So the as.numeric command is the key. It transforms the matrix to a
1D
vector. Or alternatively without using as.numeric:
M = matrix(run
Hi
> Hi!
>
> The sample below should give you what you want:
>
> M = matrix(runif(100), 10, 10)
> sd(as.numeric(M))
>
> So the as.numeric command is the key. It transforms the matrix to a 1D
> vector. Or alternatively without using as.numeric:
>
> M = matrix(runif(100), 10, 10)
> M
> dim(M) =
On 08/01/2011 08:47 PM, Matt Curcio wrote:
> Greetings all,
> I am getting this error that is driving me nuts... (not a long trip, haha)
>
> I have a set of files and in these files I want to calculate ttests on
> rows 'compareA' and 'compareB' (these will change over time there I
> want a variabl
Hi!
The sample below should give you what you want:
M = matrix(runif(100), 10, 10)
sd(as.numeric(M))
So the as.numeric command is the key. It transforms the matrix to a 1D
vector. Or alternatively without using as.numeric:
M = matrix(runif(100), 10, 10)
M
dim(M) = 100
M
sd(M)
Here I use the d
Hi,
I have some simple statistics to calculate for a large
number of variables.
I created a simple function to apply to variables.
I would like the variable name to be placed automatically.
I tried the following function but is not working.
desc = function(x){
media = mean(x, n
Hello,
My R knowledge could not take me any further, so this request !
I have a matrix of dimensions (1185 X 1185). I want to calculate standard
deviation of entire matrix.
sd function of {stats} calculates standard deviation for each row/column,
giving 1 X 1185 matrix as result. I would like to
Dear R users,
Would you plz tell me how to avoid this "for" loop blow??
I think there might be a better way to reduce running time.
--
## y1 and y2 are n*1 vectors
for (k in 1:n){
Dear all,
I am trying to aggregate a table (divided in two lists here), but get a
memory error.
Here is the code I'm running :
sessionInfo()
print(paste("memory.limit() ", memory.limit()))
print(paste("memory.size() ", memory.size()))
print(paste("memory.size(TRUE) ", memory.size
Dear Dennis and Steve,
Am Sonntag, den 31.07.2011, 23:32 -0400 schrieb Steve Lianoglou:
[…]
> How about trying to write the of this `f4` function below using the
> rcpp/inline combo. The C/C++ you will need to write looks to be quite
> trivial, let's change f4 to accept an x argument as a vecto
Andrew McCulloch wrote:
> I use R to draw my graphs. I have 100 points on a simple xy-plot. The
> points are distinguished by a third variable which is categorical with 10
> levels. I have been plotting x against y and using gray scales to
> distinguish the level of the categorical variable for ea
1 - 100 of 119 matches
Mail list logo