Also reshape() will work:
adat<-data.frame(Year=rep(2004,3),Route=rep(123,3),
Point=c("123-1","123-2","123-10"),Sp1=c(0,0,1),
Sp2=c(1,1,1),Sp3=c(0,1,0))
reshape(adat, varying=4:6, v.name="Sp-value",
times=c("Sp1", "Sp2", "Sp3"), idvar="Point",
timevar="Sp-name", direction="long")
--
Start by using str() to get an idea of the structure of this dataset
> str(pls::yarn)
'data.frame': 28 obs. of 3 variables:
$ NIR: num [1:28, 1:268] 3.07 3.07 3.08 3.08 3.1 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : NULL
$ density: num 100 80.
Thanks, str() gave me all the info I am looking for.
I am too used to dim(), and forgot about list() and str().
Thanks again,
-M
On Sat, Oct 6, 2012 at 9:57 PM, Jeff Newmiller wrote:
> Perhaps what is wrong is that you need to learn when to use the str()
> function.
>
> str(yarn)
> -
Perhaps what is wrong is that you need to learn when to use the str() function.
str(yarn)
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
I just looked at it again, and I did:
> is.list(yarn)
[1] TRUE
So, I guess it's a list with data inside.
M
On Sat, Oct 6, 2012 at 9:44 PM, C W wrote:
> Hi list,
> I am looking at the data yarn in package, I don't understand what is
> dimension of this data set.
>
> I did the following:
> > lib
Hi list,
I am looking at the data yarn in package, I don't understand what is
dimension of this data set.
I did the following:
> library(pls)
> data(yarn)
> dim(yarn)
[1] 28 3
> head(yarn)
NIR.1 NIR.2 NIR.3 NIR.4 NIR.5 NIR.6 NIR.7 NIR.8 NIR.9
NIR.10 NIR.11
1 3.06630 3.0
Hi Anthony,
The ylim () has been added to the code (please see below), and I got 4 plots
that have the same y -dimension.
Each plot displays 2 distributions - one as histogram from the data and another
one as line (i.e., idealized theoretical normal distribution?).
My question is, "Is there
On 10/07/2012 01:03 AM, agoijman wrote:
I've been trying to reshape this database but haven't succeed at it. I tried
using loops but can't get it right. I just want to reshape my database from
this matrix, to the one below, with only one column of data.
YearRoute Point Sp1 Sp2 Sp
Hello,
This is Elaine.
I am trying a path analysis using lavaan Package.
There are three explanatory variables: X, Z, and M.
The response variable is Y.
A, b, and c have direct effects on Y.
On the other hand, X and Z also have direct effects on M.
In other words, X and Z have indirect effects
On Oct 6, 2012, at 4:54 PM, fxen3k wrote:
> I created a Microsoft Excel spreadsheet. As you said, I only have "as
> displayed" numbers. I just solved the problem by showing 25 decimal places
> in Excel and then exported the data into a CSV-file.
>
> Is there a better way to solve this?
>
Do
Dear all,
I would like to add mixed effects in a multinomial model and I am trying
to use MCMCglmm for that.
The main problem I face: my data set is a trapping data set, where the
observation at each trap (1 or 0 for several species) have been
aggregated per trapline (i.e. 25 traps). Therefore w
Good evening (in Italy),
Someone of you have ever read anything about quantile cointegration?
I want to use the test statistic explained in Chuang et al. (2009), that
fundamentally followed the suggestion of Koenker and Machado (1999). This is
a Wald test used for quantile cointegration proposed
This is being handled on R-SIG-Mac. Please disregard here.
Michael
On Oct 6, 2012, at 9:05 PM, Jhope wrote:
> Hi R-listers,
>
> I just tried updating my R and now I can't even open it and it is prompting
> me to relaunch then relaunch just reappears. And it will not open R. I am
> afraid I m
Dear all,
I would like to add mixed effects in a multinomial model and I am trying
to use MCMCglmm for that.
The main problem I face: my data set is a trapping data set, where the
observation at each trap (1 or 0 for several species) have been
aggregated per trapline (i.e. 25 traps). Therefore w
Dear all,
I would like to add mixed effects in a multinomial model and I am trying
to use MCMCglmm for that.
The main problem I face: my data set is a trapping data set, where the
observation at each trap (1 or 0 for several species) have been
aggregated per trapline (i.e. 25 traps). Therefore w
Works fantastic!!! thank you SO much
--
View this message in context:
http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645302.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project
Hi R-listers,
I just tried updating my R and now I can't even open it and it is prompting
me to relaunch then relaunch just reappears. And it will not open R. I am
afraid I may have lost my scripts.
What should I do? I am running a MacBook OS X Version 10.5.8
1) Restore the entire system to an
I created a Microsoft Excel spreadsheet. As you said, I only have "as
displayed" numbers. I just solved the problem by showing 25 decimal places
in Excel and then exported the data into a CSV-file.
Is there a better way to solve this?
Regards,
Felix
--
View this message in context:
http://r.
I had a brief look at PSTricks, and really quite like it.
There is however one catch, like Sweave etc. it is assumed to be processed
along with the LaTeX. I find these things rather annoying, as it is just a
major and unnecessary error source. I think it is much better to produce
single objects (e.
"Lorenzo Isella" writes:
> Dear All,
> I implemented an algorithm for (uniform) random rotations.
> In order to test it, I can apply it to a unit vector (0,0,1) in
> Cartesian coordinates.
> The result is supposed to be a set of random, uniformly distributed,
> points on a sphere (not the point o
Hello,
You are trying to index based on a logical ff vector instead of based on a
integer ff vector.
Indexing based logical ff vectors are only allowed since version 0.6 of the
package which is not on CRAN currently yet.
Jan
--
View this message in context:
http://r.789695.n4.nabble.com/ffbas
On Sat, Oct 6, 2012 at 3:23 PM, Bert Gunter wrote:
> But the OP should not be doing this **at all.** He apparently has not
> bothered to read the Intro to R tutorial as he appears not to know
> about vectorized calculations.
>
> -- Bert
>
I don't really think that's relevant or constructive here.
Please don't double post.
And see my response to you here:
https://stat.ethz.ch/pipermail/r-help/2012-October/325470.html
Michael
On Sat, Oct 6, 2012 at 6:51 PM, solafah bh wrote:
> Hello
> If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one
> value from x , and each va
Hello
If I have this vector x=c(5,1,2,9) and n=length(x) and I want to sample one
value from x , and each value of x has equal probability to appear (1/n).
Are the following codes equivalent??
sample(x,1,replace=TRUE) and sample(x,1,replace=TRUE,prob=rep(1/n , n))
Regards
[[alternativ
On 05.10.2012 21:59, megalops wrote:
Bert,
Can you help me understand your suggestion?
Megalops31,
which suggestion? You failed to quote former messages!
I don't understand how I can
include all 30 sites under the label called "site" in the xypot
What is an xypot example?
Please read th
Does something like this make any sense?
library(reshape2)
library(ggplot2)
yy <- structure(list(A = c(23, 21, 21, 20, 19, 19), B = c(20, 18, 20,
19, 20, 18), C = c(15, 15, 15, 12, 13, 13)), .Names = c("A",
"B", "C"), class = "data.frame", row.names = c(NA, -6L))
y1 <- melt(yy) # using res
For nine numbers, R-helpers should recommend that people
show their data with dput(obj) instead of str(obj).
dput() shows everything in the object to full precision. str() shows
a summary of the object and rounds numbers to 2 digits -- it
is good for an overview of the data, but when the question
Hi Frank,
I have not used tikz, so am not sure.
I have been hand coding the TeX markup in the .Rnw files to date, since each
study has been somewhat different in terms of various characteristics and the
sponsors, in some cases, have requested some customizations to the flow charts.
That has ty
Hi,
They get different results:
with the same set.seed()
x=c(3,2,6,1)
n=length(x)
set.seed(1)
sample(x,1,replace=TRUE)
#[1] 2
set.seed(1)
sample(x,1,replace=TRUE,prob=rep(1/n , n) )
#[1] 6
identical(sample(x,1,replace=TRUE),sample(x,1,replace=TRUE,prob=rep(1/n , n) ))
#[1] FALSE
A.K.
Yes and no. Same effect, but you won't get the same random numbers
because -- I believe -- a different algorithm is used. grep the source
for sample and sample2 if you're interested.
Cheers,
Michael
On Sat, Oct 6, 2012 at 5:02 PM, solafah bh wrote:
> Hello
> If I have x=c(3,2,6,1) and n=length(x
On Oct 6, 2012, at 1:11 AM, fxen3k wrote:
> Hi,
>
> the first command was bringing the numbers into R directly:
> *> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262,
> 0.0264198664609803, 0.0200581303857603, -0.2971754213679500,
> -0.2353086361784190, 0.066719553829653
Hello
If I have x=c(3,2,6,1) and n=length(x), are the following codes equivalent??
sample(x,1,replace=TRUE) and sample(x,1,replace=TRUE,prob=rep(1/n , n)
)
Regards
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing lis
On Oct 5, 2012, at 8:48 PM, Omar De la Cruz C. wrote:
> Hello,
>
> I am interested in producing the expected number of events, in a
> recurring events setting. I am using the Andersen-Gill model, as fit
> by the function "coxph" in the package "survival."
>
> I need to produce expected numbers
Hi Zhengyu,
You might want to have a look at
http://gallery.r-enthusiasts.com/graph/Scatterplots_with_smoothed_densities_color_representation,139
which seems to be showing a smoothScatter() that seems like what you want.
I've never used the function so I am probably not much help
Something e
On Sat, Oct 6, 2012 at 12:38 PM, agiani99 wrote:
> Hi Michael,
> I am not under firewall, but I noticed that when I setInternet2=FALSE the
> problem disappears.
> SetInternet2=TRUE is required to download Systematic Investor Toolbox (SIT).
> I don't know why or whether it makes sense, but yes it
Where is the csv data coming from? If it is an export from a spreadsheet,
Excel (and others?) has a nasty habit of exporting "as displayed" rather than
the actual number as it's default.
John Kane
Kingston ON Canada
> -Original Message-
> From: f.seha...@gmail.com
> Sent: Sat, 6 Oct
Hi John,
Thanks for your comments.
I have both packages. I am using R 2.15. May be reshape is out-of-date. I
don't load reshape2 (may be lazy to add 2 at the end) that much except when I
need dcast() I tried the code with only reshape2 loaded, and is getting
the same result.
A.K.
Hi Roslina,
Extending Rui's solution if you want only the last two digits for Year.
agg_dt1$Tahun<-as.numeric(gsub("\\d{2}(\\d+)","\\1",agg_dt1$Tahun))
head(agg_dt1)
# Tahun Bahun x
#1 98 1 607
#2 99 1 814
#3 0 1 580
#4 98 2 1006
#5 99 2 941
#6 0
Try the reshape2 package. You will probablly have to install the package.
install.packages("reshape2)
with your data as xx :
library(reshape2)
melt(xx, id =c("Year", "Route", "Point"))
seems to do what you want.
John Kane
Kingston ON Canada
> -Original Message-
> From: agoij...@cnia.
Hi,
Try this:
dat1<-read.table(text="
Year Route Point Sp1 Sp2 Sp3
2004 123 123-1 0 1 0
2004 123 123-2 0 1 1
2004 123 123-10 1 1 0
",header=TRUE,sep="",stringsAsFactors=FALSE)
library(reshape)
melt(dat1,id=c("Year","Route","Point"))
Yea
I've been trying to reshape this database but haven't succeed at it. I tried
using loops but can't get it right. I just want to reshape my database from
this matrix, to the one below, with only one column of data.
YearRoute Point Sp1 Sp2 Sp3
2004123 123-1 0 1
But the OP should not be doing this **at all.** He apparently has not
bothered to read the Intro to R tutorial as he appears not to know
about vectorized calculations.
-- Bert
On Sat, Oct 6, 2012 at 3:29 AM, R. Michael Weylandt
wrote:
> Forgot to cc the list.
>
> RMW
>
> On Sat, Oct 6, 2012 at 1
Hi Marc,
It would be interesting to compare with tikz for ease of use.
As an aside I've been wishing that someone would write an R function for
creating clinical trial disposition charts using tikz or pstricks ...
Best,
Frank
Marc Schwartz-3 wrote
> On Oct 5, 2012, at 3:32 PM, clangkamp <
> ch
Hi Michael,
I am not under firewall, but I noticed that when I setInternet2=FALSE
the problem disappears.
SetInternet2=TRUE is required to download Systematic Investor Toolbox (SIT).
I don't know why or whether it makes sense, but yes it seems a
connection problem and no
it seems to have somet
Sorry,
Phone, daughter, forgot to sign.
Rui Barradas
Em 06-10-2012 12:28, Rui Barradas escreveu:
Hello,
Yes, your Spanish is close enough to Portuguese for you to understand it.
I thought it was homework and didn't read untill the end. Apologies to
Diego, and thanks to John.
Rui Barradas
Em
Hello,
Yes, your Spanish is close enough to Portuguese for you to understand it.
I thought it was homework and didn't read untill the end. Apologies to
Diego, and thanks to John.
Rui Barradas
Em 05-10-2012 22:48, John Fox escreveu:
Dear Diego,
This is close enough to Spanish for me to unders
Hello,
Using Arun's data example, instead of creating a factor "convert" to 4
digits years.
set.seed(1)
dat1 <- data.frame(Tahun=rep(c(98:99,00),each=36),
Bahun=rep(rep(1:12,times=3),each=3),
x=sample(1:500,108,replace=TRUE))
dat2 <- dat1 # operate on a copy
dat2$Tahu
?ylim says "numeric vectors of length 2" - so just the beginning and end.
?svyhist doesn't specifically mention the ylim parameter, meaning you
should look for a "..." in the arguments list and click through to the page
for ?hist
?hist has an example that shows the ylim parameter only containing
On Sat, Oct 6, 2012 at 9:11 AM, fxen3k wrote:
> Hi,
>
> the first command was bringing the numbers into R directly:
> *> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262,
> 0.0264198664609803, 0.0200581303857603, -0.2971754213679500,
> -0.2353086361784190, 0.066719553829653
Hello,
This seems to be a case for FAQ 7.31 Why doesn't R think these numbers
are equal?
See this example:
3/5 - 1/5 - 2/5 # not zero
3/5 - (1/5 + 2/5) # not zero, different from above
In your case, try
for(idx in breaks){
print(idx / interval, digits = 16) # see problem indices
On Sat, Oct 6, 2012 at 9:12 AM, Jhope wrote:
> Hi R-listers,
>
> I am receiving an error - see below. Aeventexhumed is the event in which
> nesting occured, so it is defined by A, B, C. I thought as a factor was ok,
> tried to change it to as.character but it still gave me the same error. Is
> the
On Sat, Oct 6, 2012 at 8:19 AM, agiani99 wrote:
> Hi all,
> I am trying to use in RStudio the latest code given in
> https://github.com/systematicinvestor/SIT/blob/master/R/bt.test.r,
> which seems to work fine but with the following warning for download
> limits (one for each of the tickers).
>
Forgot to cc the list.
RMW
On Sat, Oct 6, 2012 at 11:29 AM, R. Michael Weylandt
wrote:
> A case study of a good question! Would that all posters did such a good job.
>
>
>
> On Sat, Oct 6, 2012 at 7:14 AM, 周果 wrote:
>> Hi there,
>> Here is a minimum working example:
>> -
On 06-10-2012, at 08:14, 周果 wrote:
> Hi there,
> Here is a minimum working example:
>
> lower = 0
> upper = 1
> n_bins = 50
> interval = (upper - lower) / n_bins
> bins = vector(mode="numeric", length=n_bins)
> breaks = seq(from=lo
Hello,
My example with 'x' was just that, an example. Inline.
Em 06-10-2012 00:03, Jhope escreveu:
Hi,
I have tried the script posted but received the following errors. I hope I
copied it correctly. I'm sorry but I don't know how to alter the script
myself.
Please advise, Jean
x <- 0:30 + r
Hi there,
Here is a minimum working example:
lower = 0
upper = 1
n_bins = 50
interval = (upper - lower) / n_bins
bins = vector(mode="numeric", length=n_bins)
breaks = seq(from=lower + interval, to=upper, by=interval)
for(idx in brea
Hi R-listers,
I am receiving an error - see below. Aeventexhumed is the event in which
nesting occured, so it is defined by A, B, C. I thought as a factor was ok,
tried to change it to as.character but it still gave me the same error. Is
there something I should do about this error or just ignore
Hi all,
I am trying to use in RStudio the latest code given in
https://github.com/systematicinvestor/SIT/blob/master/R/bt.test.r,
which seems to work fine but with the following warning for download
limits (one for each of the tickers).
I searched in options() something which could be related to
Hi,
the first command was bringing the numbers into R directly:
*> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262,
0.0264198664609803, 0.0200581303857603, -0.2971754213679500,
-0.2353086361784190, 0.0667195538296534, 0.1755852636926560)
> mean(testdata)
[1] 0.0161584*
59 matches
Mail list logo