Thank you mate!
--
View this message in context:
http://r.789695.n4.nabble.com/Data-frame-to-Matrix-by-category-tp4669669p4669768.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/
gsub("_.*","",myInput)
#[1] "afg3" "alg12" "dbp3" "elp4" "fob1" "gpr1"
A.K.
- Original Message -
From: CompBiol ATL
To: r-help@r-project.org
Cc: Hong Qin
Sent: Monday, June 17, 2013 6:52 PM
Subject: [R] help with string split in R
#I want to remove '_alpha' in a vector of strings
?sub
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (
Thanks, that clears everything up completely. It might be worth adding
your comment to the available documentation.
On 6/17/13, William Dunlap wrote:
> All operators of the form %% have the same precedence,
> that of %*%.R does not look at the between the percent
> signs to determine the pre
For your problem, you might want to use saveRDS and readRDS instead of
save and load. I would also use dir to get a list of files rather
than paste.
Then your solution might look like:
run <- function(filename) {
df <- readRDS(filename);
coef( lm(df[,1] ~ df[,2]) )
}
results <- lapply
#I want to remove '_alpha' in a vector of strings
myInput = c( "afg3_alpha", "alg12_alpha", "dbp3_alpha", "elp4_alpha",
"fob1_alpha", "gpr1_alpha")
#my current solution
tmpsplit = strsplit(myInput, '_')
tmp = NA
for (item in tmpsplit){
tmp = c(tmp, item[1])
}
results1 = tmp[-1];
#this is wha
arch.test in vars package with multivariate.only = FALSE
The function
arch.test(x, lags.single = 16, lags.multi = 5, multivariate.only = FALSE)
produces the univariate and multivariate parts of the ARCH test
By_t = C+A_1 y_{t-1}+
.. A_n y_{t-n}+\epsilon (homoskedastic VAR)
And then
> very simple question. I probably forgot the answer (early stage onset),
> and I could not find it via google and r-help.
>
> I have a number of files, each containing one saved data frame. I want to
> do the equivalent of
>
>d <- .GlobalEnv[[ load(file="d.Rdata") ]
Did you try using
very simple question. I probably forgot the answer (early stage onset),
and I could not find it via google and r-help.
I have a number of files, each containing one saved data frame. I want to
do the equivalent of
d <- .GlobalEnv[[ load(file="d.Rdata") ]
but inside a function, and I don
many thanks for the enlightenment - I guess I completely misunderstood the
na.rm option here...
On 18 June 2013 00:50, Gabor Grothendieck wrote:
> On Mon, Jun 17, 2013 at 6:23 PM, Katharina May
> wrote:
> > Dear R Users,
> >
> > I've got a strange problem, which I do not really understand:
> >
On Mon, Jun 17, 2013 at 6:23 PM, Katharina May
wrote:
> Dear R Users,
>
> I've got a strange problem, which I do not really understand:
>
> when I use na.spline from the zoo package, the option na.rm is just being
> ignored, see this adjusted example from the na.spline help page:
> ###
On 13-06-17 5:02 PM, Davis, Brian wrote:
I have a collection of .RData files that have result objects that I would like
to combine. Specifically, skatCohort objects from the skatMeta package, but
I've run into a similar issue with simple data.frames also.
If I run something like
FILES <- lis
On Mon, Jun 17, 2013 at 6:11 PM, Gene Leynes wrote:
>
> I should have called this "failure to install several packages"
>
> Here is the list of libraries that I can't install in 3.0.1 that I could
> install to 3.0.0
>
> Have others had the same problem?
>
> [1] "BiocGenerics" "BiocInstaller" "gda
Dear R Users,
I've got a strange problem, which I do not really understand:
when I use na.spline from the zoo package, the option na.rm is just being
ignored, see this adjusted example from the na.spline help page:
d0 <- as.Date("2000-01-01")
z <- zoo(c(NA, 11, 13, NA, 15
I should have called this "failure to install several packages"
Here is the list of libraries that I can't install in 3.0.1 that I could
install to 3.0.0
Have others had the same problem?
[1] "BiocGenerics" "BiocInstaller" "gdata" "graph"
[5] "rCharts" "RCurl" "Rgraphviz"
Hi,
You didn't provide any information about the package. I guess it is from
"energy".
library(energy)
x <- iris[1:50, 1:4] #examples given in the package
y <- iris[51:100, 1:4]
z<- iris[101:150,1:4]
vec1<-c("x","y","z")
mat1<- combn(vec1,2)
sapply(split(mat1,col(mat1)),function(.dat) dc
Hello,
I just upgraded to 3.0.1 and a bunch of packages won't install, including
Rserve and RCurl
Any hints on why?
Thanks
> install.packages('Rserve')
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://cran.case.edu/bin/windows/contrib/3.0/Rserve_0.6-8.1.zip'
Conten
All operators of the form %% have the same precedence,
that of %*%.R does not look at the between the percent
signs to determine the precedence. Hence you must use parentheses
to get the order of operations that you want.
(I think that %% operators are overused - providing the same
functiona
Hi,
dat1$Ans<-tolower(dat1$Ans)
#But, if you do this:
vec1<- c("su","m","tu","w","th","f","sa")
vec2<-unlist(strsplit(dat1$Ans,","))
sapply(vec1,function(x) length(vec2[grep(x,vec2)]) )
#su m tu w th f sa # which is incorrect here "tu" got two matches in
sa"tu"rday
# 2 0 2 1 1 3 4
package expm: matrix powers within a product of matrices: operation
precedence
I want to double check that for M and N kxk mtrices and v a k-vector
M%^%2%*%N%*%v is not automatically read as (M%^%2)%*%N%*%v or
M%*%N%^%2%*%v is not automatically read as M%*%(N%^%2)%*%v or
both
I probably should have been more specific. The .RData objects which get loaded
have a list called 'res'. This isn't a reproducible example, as I haven't
included any of the RData files.
-Original Message-
From: Rui Barradas [mailto:ruipbarra...@sapo.pt]
Sent: Monday, June 17, 2013 4:2
Dear all,
thanks for giving me hope :) ;)
can amy one just tell me to plot the svm model i need to plot 2 vaiables as
y axis and x axisbut according to the nature of my dataset i have about
2000 variables?? does that mean i have to plot only two?? or is there a way
to plot all of the 2000 and
I have a collection of .RData files that have result objects that I would like
to combine. Specifically, skatCohort objects from the skatMeta package, but
I've run into a similar issue with simple data.frames also.
If I run something like
FILES <- list.files(path="/path/to/my/results", pattern
It cannot be done because there is not enough time to create the
plot. In about a billion years the sun will be 10% brighter than
today and the oceans will start to boil away. You will still be
plotting genes when that happens.
:-(
-
David
-Original Messag
Principal components analysis and factor analysis are two techniques
that have different histories, but overlap in the computational
procedures used. Strictly speaking, principal components is a
descriptive procedure used to project a multivariate data set into a
space with fewer dimensions. The fi
F Raziq,
Here's a little something to get you started. For ease of viewing, I set P
= 10 and n = 5 (instead of 100 and 50), but this can easily be changed.
You don't say what your original data looks like, so I assumed it was
zeroes and ones to start with. I show an example of a single bootstra
> And is there a way to simultaneously tell R that, for example, “Friday” is
> the same as “Fri” or “F”; “Saturday” is the same as “Sat” or “Sa”; etc.?
Look at pmatch (partial match):
> dayNames <- c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday")
> dayNames[pmat
Hi,
May be this helps:
dat1<-
data.frame(Ans=c("Friday","Wednesday","Friday,Saturday,Sunday","Saturday","Sat,Sun","Th,F,Sa"),stringsAsFactors=FALSE)
dat1
Ans
1 Friday
2 Wednesday
3 Friday,Saturday,Sunday
4 Saturday
5
Hi Pascal,
Indeed by following your advice I succeeded to install nloptr.
Thank you very much,
-Original Message-
From: "Pascal Oettli" [kri...@ymail.com]
Date: 06/17/2013 05:30 AM
To: "ce"
CC: ""
Subject: Re: [R] can't install rugarch and nloptr packages in R 3.01 opensuse
linux
He
I think proving whether P = NP would be easier than plotting an
infinite number of genes..
;-)
-- Bert
On Mon, Jun 17, 2013 at 11:49 AM, nofe ganmi wrote:
> dear all,
>
> I am a student in cs college. I would like to know how to plot infinte
> number of genes after using the svm.
>
> the data
Nofe
1. Read the posting guide.
You have to give us a repreducible example
On 17 June 2013 20:49, nofe ganmi wrote:
> dear all,
>
> I am a student in cs college. I would like to know how to plot infinte
> number of genes after using the svm.
>
> the data set i have consists of
>
> x which is a
Or perhaps something based on findInterval, like
> d[findInterval(b, c(d,Inf))+1]
[1] 12 36 36
The details depend on if your inequality is strict or not.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bo
HI Andras,
Sorry, I misunderstood your question:
Try this:
sapply(sapply(b,function(x) d[x
To: arun
Cc:
Sent: Monday, June 17, 2013 2:48 PM
Subject: Re: [R] vector question
Arun,
thank you. Looking at it I am wondering if there is a way to get 36 in the
result instead of the 24. The 2nd valu
May be this helps:
d[cumsum(sapply(d,function(x) any(x>b)))>=1]
#[1] 12 24 36
A.K.
- Original Message -
From: Andras Farkas
To: r-help@r-project.org
Cc:
Sent: Monday, June 17, 2013 2:29 PM
Subject: [R] vector question
Dear All,
would you please help with the following:
let us say I h
dear all,
I am a student in cs college. I would like to know how to plot infinte
number of genes after using the svm.
the data set i have consists of
x which is a matrix of 39 cancer patients [rows] and 2000 gene names
[colmns]. each cell is the value of the gene for a particular patient.
there
Let’s say I have a data set that includes a column of answers to a question
“What days of the week are you most likely to eat steak?”.
The answers provided are [1] “Friday”, [2] “Wednesday”, [3] “Friday,
Saturday, Sunday", [4] "Saturday”, [5] “Sat, Sun”, [6] “Th, F, Sa”
How can I tell R to count “
Hello,
I want to write a function to do pairwise calculation, but I don' know how
to write it. Could anyone help?
i.e. I have A (2*3), B(3*3), C(4*3) three matrices. I want to calculate
distance correlation between each pair of matrices using code "dcor". How
do I write a function so that I can g
Hi Bert & David -
I'm putting aside the issues with the missing data for the moment - the NAs
are due to not enough sample volume for testing and there are only about 6
of them for 1 variable. I have multiple data sets to look and not all with
missing values. I do intend to find some local consult
R users,
Abstracts are now being accepted for the 2014 ASA Conference on Statistical
Practice, February 20-24, Tampa, Florida, USA. Each presentation will have
a 45-minute time slot.
Based on a survey of the 2013 attendees there was particular interest in
both R and data visualization. It would
Dear All,
would you please help with the following:
let us say I have:
a <-c(0,1,12,13,24,25,36,37)
b <-c(6,24.6,27)
#then I extract every 2nd element from "a"
d <-a[seq(1, length(a), 2)]
and what I need help with is to extract the 1st value from d that is greater
than the values in b, so as a
David et. al.:
I hate to be a pest but ...
On Mon, Jun 17, 2013 at 11:02 AM, David Carlson wrote:
> First, Bert is correct. I should have said to use prcomp(dat, center=TRUE,
> scale=TRUE). That will run the svd on the standardized variables which is
> equivalent to using princomp(dat, cor=TRU
First, Bert is correct. I should have said to use prcomp(dat, center=TRUE,
scale=TRUE). That will run the svd on the standardized variables which is
equivalent to using princomp(dat, cor=TRUE). You will have to remove the cases
with missing variables or impute the missing variables using one of
Please do not reply privately.
Reply to the list.
If you have 417GB and that is not enough there must be something wrong with
your approach.
As I said your code is too long. You should try to make a small, short example
illustrating what you are attempting to do.
Berend
On 17-06-2013, at 19:
Just wanted to note that one does **not** use
"prcomp() on the correlation matrix of the variables."
As ?prcomp says, it uses the svd of the data matrix, which is
generally preferable.
Cheers,
Bert
On Mon, Jun 17, 2013 at 10:02 AM, Elizabeth Beck
wrote:
> Hello David,
>
> Yes my variables are a
Hi,
Modification of my previous function seems to work for the given example:
dat1<-read.table(text="
Row_ID_CR, Data1, Data2, Data3
1, aa, bb, cc
2, dd, ee, ff
",sep=",",header=TRUE,stringsAsFactors=FALSE)
dat2<- read.ta
Hello David,
Yes my variables are all numericI have a few questions regarding your 2
options.
Would these still be the best options if missing data was not an issue? I
was told that I should be performing NMDS as it has few assumptions on the
data distribution but neither of your options use
Hello all,
I’ve been working with R for some years, but I am beginner to Rcpp (and have no
experience with C++).
I am trying to set zeros in a matrix to Inf. In R I would do this:
x=matrix(8:0,3)
x[which(x==0)]=Inf
My try with Rcpp and RcppArmadillo looked like this (as I do not know how
Hi Arun,
Sorry to bother you again with this. When I was trying it out over the
weekend with different data files I realized that its not exactly working
the way it should.
For this file B:
ROW_ID |SRC_ROW_ID |NOTE
1a |1 |Comment 1
2a
Is there a function in r that let's you efficiently invert a positive
definite symmetric Block Toeplitz matrix? My matrices are the covariance
matrices of observations of a multivariate time series and can be
1000*1000 or larger.
I know the package 'ltsa' which seems to use the Trench algorith
If your goal is to simulate data from the given distribution in R then
there are a couple of approaches. You have the distribution function
derived, so you can use any technique that just need the distribution
function. This could be rejection sampling or Metropolis-Hastings sampling
or others.
Can I have some help in vectorizing a series of matrix multiplications?
Toy Example
mat_size=2; num_matrices=3; num_users=2
ToyArray=array(1,dim=c(mat_size, mat_size, num_matrices, num_users))
/* So I open an 4-dim array to store 3 2 X 2 matrrices for 2 users. For each
user I want to multip
HI,
Try this:
X<-
c("0","659-1000","641-659","634-641","630-634","630-630","626-628","618-626","604-618","574-604","0-574")
Y<-
c(0,2.166477,6.347396,12.23869,20.18244,26.07374,36.64006,48.15659,61.61155,77.95515,100.152)
dat1<- data.frame(X,Y)
dat2<-dat1[order(dat1$Y,dat1$X),]
dat2$X<-facto
Hi,
May be this helps.
set.seed(29)
GLSS<- data.frame(hhid=sample(1:10,30,replace=TRUE),value=rnorm(30))
IDstoSelect<- c(1,5,7)
GLSS[!is.na(match(GLSS[,1],IDstoSelect)),]
# hhid value
#1 1 -0.34216061
#6 1 0.28240263
#14 7 0.04197496
#17 7 0.15005878
#21 7 -1.18640939
Hi all,
I tried SO for this, but got no response. Trying here in hope of better luck.
--
I am trying to build an R package that uses some C code. I have a C library
that is compiled into a
Hello,
You are reading 11 times the same file, 'toread'.
Assuming that 'toread' is a vector with 11 different filenames in it,
something like the following might do what you want.
for ( i in 1:11) myfiles[i] <- read.csv(toread[i], header = TRUE, sep=")
AS for the final "for loop", it does not
Hi Alice
An offset is just a fixed vector added to the linear predictor of a
model, so if you want to add two fixed vectors, you might as well add
them together first. i.e. I think you want something like
off <- log(grid.cell.area) + log(detection)
gam(porpoises ~ s(covariates) + offset(off),
Dear Guylaine,
this has nothing to do with either 'plm' or logs. The error message says it
all: "fin d'entrée inattendu(e)". Somehow, you're inputting '+' twice in the R
console, so the formula is syntactically invalid. Moreover, you assign the
forula through '<' instead of '<-' so that this b
Dear R-help users,
I am quite new in R. I have multiple csv.files with different size. I would
like to read them by using a for- loop and parallel by reading I need to add
a new column which can be specified by myself.
But my for-loop does not work !
Could somebody give me any idea ?
Many thanks!
Hello,
I have been trying to find out whether it is possible to use more than one
offset in a gam (in mgcv).
The reason I would like to do this is to 1) account for area surveyed in a
Poisson model of sightings of porpoises within defined grid cells (each cell
has a slightly different area) and
Hello,
I was able to install the "nloptr" package by editing the src/Makevars file.
I added the line
mv .libs lib; \
between
make install; \
ls | grep -v ^include$$ | grep -v ^lib$$ | xargs rm -rf; \
for NLopt compilation.
You probably should contact the package maintain
On Mon, Jun 17, 2013 at 10:07 AM, peter dalgaard wrote:
>
> On Jun 17, 2013, at 10:36 , R. Michael Weylandt wrote:
>>
>> What do you mean 'results of individual cells'? As documented in
>> ?chisq.test, you might be looking for one or more of
>>
>> data.table$observed
>> data.table$expected
>> data
On Jun 17, 2013, at 10:36 , R. Michael Weylandt wrote:
> On Mon, Jun 17, 2013 at 9:14 AM, Dave Clark wrote:
>> I`m doing the chi square test in R, see below code:
>>
>>> row1 <- c(27,17,13,21,80,24,35,41,18,51) #Category A (1-10) counts
>>> row2 <- c(27,11,26,13,30,28,17,30,10,21) #Category B (
Hello,
Maybe something like the following.
dat <- read.table(text = "
isin dt
1 FR0109970386 2010-01-12
2 FR0109970386 2011-01-12
3 FR0109970386 2012-01-12
4 FR0116114978 2010-01-12
5 FR0116114978 2011-01-12
6 FR0116114978 2012-01-12
", header = TRUE, stringsAsFactors = FALSE)
On Mon, Jun 17, 2013 at 9:14 AM, Dave Clark wrote:
> I`m doing the chi square test in R, see below code:
>
>> row1 <- c(27,17,13,21,80,24,35,41,18,51) #Category A (1-10) counts
>> row2 <- c(27,11,26,13,30,28,17,30,10,21) #Category B (1-10) counts
>> data.table <- rbind(row1,row2)
>> data.table
>
>
I`m doing the chi square test in R, see below code:
> row1 <- c(27,17,13,21,80,24,35,41,18,51) #Category A (1-10) counts
> row2 <- c(27,11,26,13,30,28,17,30,10,21) #Category B (1-10) counts
> data.table <- rbind(row1,row2)
> data.table
then:
> chisq.test(data.table)
This gives me the chi
Dear Graham,
On 16 June 2013 02:08, Graham McDannel wrote:
> I am attempting to optimize a function I have developed using optim.
>
> I am getting the below error message:
>
> Error in n < 1: 'n' is missing
>
I suspect a function requires an argument named n, and you
didn't pass one. Either in
66 matches
Mail list logo