Dear R experts,
I am making a selectivity analysis using the package. Nevertheless, I am
having some troubles, and I would like to know if somebody know how to help
me:
1) When changing the x-axis labels. The programm uses the name habitat
instead of the names specified in the file.
2) Is it po
I've got dataFrame() in R.utils for this purpose, e.g.
> df <- dataFrame(colClasses=c(a="integer", b="double", c="character"),
> nrow=10L)
> str(df)
'data.frame': 10 obs. of 3 variables:
$ a: int 0 0 0 0 0 0 0 0 0 0
$ b: num 0 0 0 0 0 0 0 0 0 0
$ c: chr "" "" "" "" ...
Related: You can
On Tue, Mar 31, 2015 at 6:35 PM, Richard M. Heiberger wrote:
> I got rid of the extra column.
>
> data.frame(r=seq(8), foo=NA, bar=NA, row.names="r")
Brilliant!
After much fussing, including a disturbing detour into nested lapply
statements from which I barely emerged with my sanity (arguable, I
The Posting Guide recommends searching the archives before posting. Consider
[1] and learn.
[1] https://stat.ethz.ch/pipermail/r-help/2007-March/127981.html
---
Jeff NewmillerThe . .
Dear All, I want to use princomp() function in R in order to calculate
Principle Component Analysis.In different papers, I have seen "PCA 1", "PCA 2",
"PCA 11" , etc. Would you please tell me how can i calculate different PCAs in
R?At the moment i just use this line "eigenVectors <- pca$loadings
Hi everybody,
I have a matlab code which I would like to use for my empirical analysis.
Unfortunately, I am not familiar with matlab and it would be great if there was
a tool to "translate" the matlab code into R so that I can work with the code
in R.
Is there such a tool or package in R?
Kind
I have a similar issue with tcl.
I am using R on a Linux server. Rcmdr installed OK, but it won't run:
> R.Version()
$platform
[1] "x86_64-unknown-linux-gnu"
$arch
[1] "x86_64"
$os
[1] "linux-gnu"
$system
[1] "x86_64, linux-gnu"
$status
[1] ""
$major
[1] "3"
$minor
[1] "1.0"
$year
[1] "20
I got rid of the extra column.
data.frame(r=seq(8), foo=NA, bar=NA, row.names="r")
Rich
On Tue, Mar 31, 2015 at 6:18 PM, Sven E. Templer wrote:
> If you don't mind an extra column, you could use something similar to:
>
> data.frame(r=seq(8),foo=NA,bar=NA)
>
> If you do, here is another approach
If you don't mind an extra column, you could use something similar to:
data.frame(r=seq(8),foo=NA,bar=NA)
If you do, here is another approach (see function body):
empty.frame <- function (r = 1, n = 1, fill = NA_real_) {
data.frame(setNames(lapply(rep(fill, length(n)), rep, times=r), n))
}
emp
table(unique(df)$PROJECT)
On Tue, 2015-03-31 at 14:51 -0500, Walter Anderson wrote:
> I have a data frame that shows all of the parks (including duplicates)
> that are impacted by a projects 'footprint':
>
> PROJECT PARKNAME
> A PRK A
> A PRK B
> A PRK A
> B PRK C
> B
Hello,
Try the following.
table(unique(df)$PROJECT)
And please note that 'df' is the name of an R function, use something else.
Hope this helps,
Rui Barradas
Em 31-03-2015 20:51, Walter Anderson escreveu:
I have a data frame that shows all of the parks (including duplicates)
that are impac
Sure: tell R you want unique rows.
> mydf <- data.frame(PROJECT=c("A","A","A","B","B","C","C"), PARKNAME=c("PRK
> A", "PRK B", "PRK A", "PRK C", "PRK A", "PRK B", "PRK D"),
> stringsAsFactors=FALSE)
> mydf
PROJECT PARKNAME
1 APRK A
2 APRK B
3 APRK A
4 BP
I have a data frame that shows all of the parks (including duplicates)
that are impacted by a projects 'footprint':
PROJECT PARKNAME
A PRK A
A PRK B
A PRK A
B PRK C
B PRK A
C PRK B
C PRK D
...
What I need is a cross tabulation that shows me the number of
Dear All,
I want to run neural network on my data.
i run these codes:
#load mydata
dim(mydata)
# 20 3111
library(neuralnet)
fm <- as.formula(paste("resp ~", paste(colnames(mydata)[1:3110],
collapse="+")))
out <- neuralnet(fm,data=mydata, hidden = 4, lifesign = "minimal",
linear.output = FALSE, t
You can use structure() to attach the names to a list that is input to
data.frame.
E.g.,
dfNames <- c("First", "Second Name")
data.frame(lapply(structure(dfNames, names=dfNames),
function(name)rep(NA_real_, 5)))
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 31, 2015 at 11:37 AM, Sara
You can make it as elegant as you want, e.g.,
make.empty.df <- function(nrow,ncol, names) {
if(length(names) %% ncol != 0) stop("Lenght of names is not a
multiple of the number of colums")
data.frame(matrix(NA, nrow, ncol, dimnames = list(NULL, names)))
}
Best,
Ista
On Tue, Mar 31, 2015
Good evening, this is a part of my Routine which calculates the copula
parameter and loglikelihood for each pair of rows of a data matrix, choosing,
for each pair, the copula which gives the maximum likelihood. If I do my
computation with this routine with only:
f <- frankCopula(2,2)
g <- g
Hi,
Duncan Murdoch suggested:
> The matrix() function has a dimnames argument, so you could do this:
>
> names <- c("strat", "id", "pid")
> data.frame(matrix(NA, nrow=10, ncol=3, dimnames=list(NULL, names)))
That's a definite improvement, thanks. But no way to skip matrix()? It
just seems unRlik
Not entirely sure I understand your problem here (your first email was a
lot of reading).
Would it make sense to add an extra column device_name
Thus ending up with something like:
Host Device Type
host_Aada0ssd
host_Aada1ssd
host_Aada2hdd
...
host_Nda3 ssd
Nice clean-up!!!
On Tue, 2015-03-31 at 14:19 -0400, Ista Zahn wrote:
> library(tidyr)
> library(dplyr)
> bw <- gather(bw, key = "tmp", value = "value",
> matches("^d[a-z]+[0-9]+"))
> bw <- separate(bw, tmp, c("disc", "var"), "_", extra = "merge")
> bw <- spread(bw, var, value)
___
Hi David,
I suggest reading http://www.jstatsoft.org/v59/i10, then:
library(tidyr)
library(dplyr)
bw <- gather(bw, key = "tmp", value = "value", matches("^d[a-z]+[0-9]+"))
bw <- separate(bw, tmp, c("disc", "var"), "_", extra = "merge")
bw <- spread(bw, var, value)
Best,
Ista
On Tue, Mar 31, 201
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin
> E. Thorpe
> Sent: Tuesday, March 31, 2015 10:53 AM
> To: Duncan Murdoch
> Cc: R Help Mailing List
> Subject: Re: [R] Randomly interleaving data frames while preserving
> order
>
> On 03/31/2015 0
On 31/03/2015 1:52 PM, Sarah Goslee wrote:
I just snagged this from Duncan Murdoch's reply to the same question:
# Create an empty dataframe to hold the results
df <- data.frame(strat=NA, id=NA, pid=NA)[rep(1, length(sel)),]
This skips matrix(), but how to set the column names programmatically
samples<-sample(c(rep(1,10),rep(2,10),rep(3,10)),30)
samples[samples==1]<-1001:1010
samples[samples==2]<-2001:2010
samples[samples==3]<-3001:3010
fullDf<-rbind(df1,df2,df3)
fullDf[sort(order(samples),index.return=TRUE)$ix,]
On Tue, 2015-03-31 at 13:05 -0400, Kevin E. Thorpe wrote:
> Hello.
>
>
On 03/31/2015 01:44 PM, Duncan Murdoch wrote:
On 31/03/2015 1:05 PM, Kevin E. Thorpe wrote:
Hello.
I am trying to simulate recruitment in a randomized trial. Suppose I
have three streams (strata) of patients represented by these data frames.
df1 <- data.frame(strat=rep(1,10),id=1:10,pid=1001:1
I just snagged this from Duncan Murdoch's reply to the same question:
# Create an empty dataframe to hold the results
df <- data.frame(strat=NA, id=NA, pid=NA)[rep(1, length(sel)),]
This skips matrix(), but how to set the column names programmatically
within a function?
Sarah, still sure I'm mis
Hi folks,
I KNOW there has to be a way to do this more elegantly, but I
consistently fail to come up with it, as I was just reminded while
writing an example for a query on this list.
What's a nifty way to construct a data frame of a given size? The only
way I know of it to use matrix(), eg
data
On 31/03/2015 1:05 PM, Kevin E. Thorpe wrote:
> Hello.
>
> I am trying to simulate recruitment in a randomized trial. Suppose I
> have three streams (strata) of patients represented by these data frames.
>
> df1 <- data.frame(strat=rep(1,10),id=1:10,pid=1001:1010)
> df2 <- data.frame(strat=rep(2
That's a fun one. Here's one possible approach. (Note that it can be
done without using a loop, but I find that a loop here increases
readability.)
I wrote it to work on a list of data frames. If the selection is
random, I'd set it up so that size is passed to the function, but
selection is genera
On Tue, Mar 31, 2015 at 07:11:28AM -0800, John Kane wrote:
> I think we need some data and code
> Reproducibility
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>
I apologize for failing to
Hello.
I am trying to simulate recruitment in a randomized trial. Suppose I
have three streams (strata) of patients represented by these data frames.
df1 <- data.frame(strat=rep(1,10),id=1:10,pid=1001:1010)
df2 <- data.frame(strat=rep(2,10),id=1:10,pid=2001:2010)
df3 <- data.frame(strat=rep(3,
Can you give a concrete simple example of inputs with expected results? Is
phi a function? Of omega 1 and 2? Is the summation over everything
through V_d-k?
On Mon, Mar 30, 2015 at 2:58 PM, T.Riedle wrote:
> Hi everybody,
> Does anybody have an idea how I can generate tau according to the att
> Date: Mon, 30 Mar 2015 09:54:39 -0400
> From: Vikram Chhatre
> To: r-help@r-project.org
> Subject: [R] changing column labels for data frames inside a list
> Message-ID:
> Content-Type: text/plain; charset="UTF-8"
>
> > summary(mygenfreqt)
> Length Class Mode
> dat1.s
OK.
But always reply to the list (which I am ccing here) so that everyone
knows -- and re-submit your OP in **PLAIN TEXT**, not html, as this is
a plain text list and html typically garbles everything.
Also, reading and following the posting guide (see end of this email)
generally improves your
If you really want your coefficient estimates to be scale-equivariant you
should test those methods for such a thing. E.g., here are functions that
let you check how scaling one predictor affects the estimated coefficients
- they should give the same results for any scale factor.
f <-
function (s
This sounds like homework. Homework is discouraged on this list (but
you might get lucky).
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
On Tue, Mar 31
I am analyzing trend using Mann-kendall test for 31 independent sample, each
sample have 34 years dataset. I supposed to find Kendall “tau” for each
sample. The data is arranged in column wise (I attached the data).To find
Kendall tau, I wrote R script as:
desta<-read.csv("rainfall.csv
Duncan,
Thanks for the help.
Since I am the only person using this machine and I couldn’t figure out where
to put the option statement aside from:
C:\Program Files\R\R-3.1.2\etc
In the file Rprofile.site
The option that I wanted was:
options(debug.font = "Consolas 12”)
Which allowed me to h
I think we need some data and code
Reproducibility
https://github.com/hadley/devtools/wiki/Reproducibility
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
John Kane
Kingston ON Canada
> -Original Message-
> From: r...@catwhisker.org
> Sent: Mon,
Hi Frederic,
Thanks for sending the data in dput() format. All it does in convert a data set
into a standardized format (perfect copy) that anyone with R can read. People
have different setups and defaults for reading data and so on and what you may
read in to R as a character variable may be a
The error message is very informative. You named a column in the melted
data "Start", and told ggplot to use "start". "start" is a function. R is
case sensitive.
On Tue, Mar 31, 2015 at 8:46 AM, Frederic Ntirenganya
wrote:
> Hi All,
>
> Thanks for the help. I want to plot some of the columns on
Hi John,
Sorry for the mistake I made for providing useless data.
Here I am interest only on Tmin and Tmax columns. I want to use the same
approach with the previous data. I want to plot on the same graph not
separate graph. Thanks
> dput(head(BUTemp))structure(list(Year = c(1971L, 1971L, 1971L,
Reproducibility
https://github.com/hadley/devtools/wiki/Reproducibility
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
John Kane
Kingston ON Canada
> -Original Message-
> From: amc5...@gmail.com
> Sent: Mon, 30 Mar 2015 16:07:05 -0700
> To: r-hel
Hi All,
Thanks for the help. I want to plot some of the columns on the same graph
not all of them. Sorry, I failed to follow the instructions. Here is the
output of *dput()* but I don't know how it works.
> dput(head(data))structure(list(Date = structure(c(-6575, -6209, -5844, -5479,
-5114, -4748
The data you supplied is still in a useless format.
Please send it to us in dput format (and don't post in html)
Here is a complete example of creating a data.frame and converting it to a
useable data set that readers on R-help can use
##=Start Example===##
# Simple exam
Your data and post is still not provided in one of the formats provided
here:
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example.
I am unsure of what you want to do, but I have made a reproducible example
that might help.
zz <- "Date Number.of.Rain.Days Total.rai
By failing to take the advice given to you, you make it harder to help you.
Learn to control your email program to send plain text, and learn to use the
dput function.
With regard to this function call:
> ggplot(df2, aes(Date,value)) +
I highly recommend using named parameters in the aes call.
I found a fix to my problem using the fastLm() from package RcppEigen, using
the Jacobi singular value decomposition (SVD) (method 4) or a method based
on the eigenvalue-eigenvector decomposition of X'X - method 5 of the fastLm
function
install.packages("RcppEigen")
library(RcppEigen)
n_obs <-
Hi everyone,
I am using the MCmcmc function of the MethComp package and receive the
following error:
Error: 'coda.samples' is not an exported object from 'namespace:coda'
I emailed the package author last week but haven't had a reply. I have
installed JAGS 3.4.0 as required by MethComp. I am u
Hi All,
Sorry for the shape of data which was not good enough.This is how my
data look like.
I want to plot multiple using ggplot function from a data frame of
many columns. I want to plot only Start.of.Rain..i.,
Start.of.Rain..ii. and Start.of.Rain..iii. and I failed to make it.
What I want is
Many thanks,
Stéphane
Le 30 mars 2015 à 10:42, peter dalgaard a écrit :
>
>> On 30 Mar 2015, at 09:59 , Stéphane Adamowicz
>> wrote:
>>
>>
>> However, in order to help me understand, would you be so kind as to give me
>> a matrix or data.frame example where « complete.cases(X)== T » or «
51 matches
Mail list logo