Hi all,
I’ve noticed that a script with unmatched brackets of any sort will fail
silently in Rscript—neither logging nor any output in the shell indicates
that anything went wrong. Example file to run in Rscript:
sink('/tmp/exampleoutfile')
a - 0
{
print(a)
Replacing the ‘{‘ with any other
Hi,
The following works.
f2
function(z)
{
f1 - function(t)
{
z*t + z*t^2
}
return(f1)
}
sapply(1:5,function(x)integrate(f2(x),0,1)$value)
[1] 0.83 1.67 2.50 3.33 4.17
--
View this message in context:
Dear fellow R users,
I am trying to calculate the difference of the least square means from a
lmer model which has a pretty much standard form of Y ~ A*B + (1|C/D)
I am using the difflsmeans command from the lmerTest package but it
returns the following error line:
Error in
Hello,
I am going to estimate the parameter of the count model: pr(N=n)=
integration{B(x, alpha)-C(x,alpha)} by maximum likelihood estimation.
n-c(0,1,2,3) and F- (0,3,4,5) are the vectors of values and observed
frequency respectively. The function C(x,alpha) is not defined for n=0, but
On Feb 26, 2015, at 2:02 PM, Scott Colwell scolw...@uoguelph.ca wrote:
I think I have one solution. Not very pretty though. Relies on the text not
changing at all.
as.numeric(gsub(Mean relative difference: , ,
all.equal(cov2cor(ITEMCOV),cor(item.data))[2]))
Is there a better way?
I have a problem with statistics, I think this forum is not the right
option, but I'm running out resolution to my problem, so I thought I expose
you here so someone could help me.
Realized a certain amount of tests in different groups, this assessment had
different weights, and the groups were
On Feb 26, 2015, at 1:49 PM, marKo mton...@ffri.hr wrote:
v1-c(1:5)
v2-c(1:5)
f1-function (x) {v1*x+v2*x^2}
The problem is that integrate(f1, 0, 1) does not work.
I does not, even if a pas the arguments (v1, v2)
f1-function (x, v1, v2) {v1*x+v2*x^2}
or if i try to vectorize the
Kate — here is a transparent solution (tested but without NA treatment).
Doubtless there are cleverer faster ones, which later posters will present.
HTH
# example with four columns and 20 rows
nrows - 20
A - sample(c(1:100), nrows, replace=T)
B - sample(c(1:100), nrows, replace=T)
C -
Dan,
FWIW, I have basically the system you describe, except a larger HD — I'm
quite happy, but I'm a biased Mac user, although I love my Ubuntu Linux
machine as well… One can bring any machine to its knees, so there is the
element of expectations. A MacBook Pro stacks up as well or better
Even though I was looking in several r-books
I could not find a suitable function to this problem
Which R books did you look through?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Feb 26, 2015 at 4:02 AM, David Studer stude...@gmail.com wrote:
Hello everybody!
I have a (probabely
Dear all,
what code should I write in order to extract the file name from a give
path? Let's say that I want to get the file my file.xls which is in
the directory/folder My documents; since I work both with Windows
and Linux, the paths I am looking at are in the format:
Hi.
First of all, thx. But when using in arima(...xreg=fact,...) then fact
should be a vector and not a factor variable? Maybe I should have been more
clear in my first mail, sorry. Or else I have to dig deeper into factors.
/Mikael
On Thu, Feb 26, 2015 at 5:17 PM, Bert Gunter
Inline.
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 Thu, Feb 26, 2015 at 8:02 AM, Mikael Olai Milhøj
mikaelmil...@gmail.com wrote:
Hi all
I have
Hi all
I have been searching on the web in vain. I want to include a dummy
variable in my ARIMA model. Let's say that I want to make an AR(1) model
for X including a dummy variable which should be 1 for observation 4,5,6
and zero otherwise (let's say that there is 50 observations in total). How
For the record, the ave function in R can apply any function you specify, not
just mean. The primary feature of ave is that it does not collapse the rows
like aggregate does. Choose among them according to how you want the output to
be organized.
You store it as a list of lists and can then use the lapply function
to navigate for values.
result - lapply(1:1, function(x){
mix(param[x]) # whatever your call to 'mix' is with some data
})
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me
The following data.frame x as one column named Percent.
x
Percent
1 10%
2 20%
3 30%
as.numeric(substr(x$Percent,1,nchar(x$Percent)-1))
[1] 10 20 30
--
View this message in context:
I think you are getting ahead of yourself.
You use the term dataset, which is colloquial and not precise. The read.csv
function returns a data.frame, in which each column can have its own storage
mode (type). Most data.frames do not have all columns of the same type... if
they were you might
Of course you could have created them as character vectors in the first
place:
dfx - data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c(M, F), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54),
stringsAsFactors=FALSE
)
But if that is not
Dear Xavier
See below for comments
On 26/02/2015 11:20, CHIRIBOGA Xavier wrote:
Dear colleagues,
For Tukey, I tried to load the function with
library(multcomp) but again a message says:
Error in library(multcomp) : any package called ‘multcomp’ has been found
I suspect you
Here is another way. Have not tested for large scale efficiency, but if you
convert dta to a data.table that might improve things.
library(dplyr)
dta - read.csv( text=
key_column,begin_date,end_date
123456,2013-01-01,2014-01-01
123456,2013-07-01,2014-07-01
789102,2012-03-01,2014-03-01
It's possible to retrieve protein for swissport by protein name??
I try using seqinr and query but i didnt find a way to get all protein
that named Delta 9 acyl CoA desaturase.
If some one have an idea i be glad :P
thank you all
ᐧ
[[alternative HTML version deleted]]
On 26/02/2015 9:27 AM, Alaios via R-help wrote:
Dear all,in my code I am using the mix() function that returns results in a
list. The result looks like
List of 10
$ parameters :'data.frame': 2 obs. of 3 variables:
..$ pi : num [1:2] 0.77 0.23
..$ mu : num [1:2] -7034 162783
Try as.character like the following shows.
dfx - data.frame(
+ group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
+ sex = sample(c(M, F), size = 29, replace = TRUE),
+ age = runif(n = 29, min = 18, max = 54))
dfx
group sex age
1 A M 41.35554346
2 A F
Hola David,
Puedes hacer como ya comentaron en las otras respuestas. Pero por
si sirve de utilidad, pego al final parte de un código que empleo para
ilustrar la repetición de contrastes en simulación.
Está con un bucle y guardando en vectores, si se quisiera modificar
para obtener
Andrew's suggestion for Year is a help, but package nlmrt shows the
problem you are trying to solve is truly one where there is a Jacobian
singularity. (nlmrt produces the Jacobian singular values -- but read
the output carefully because these are placed for compact output as if
they correspond to
Hi,
Some modification to work for both positive and negative number:
nchar(format(*abs*(a),scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1)
-1.
--
View this message in context:
It would help a lot if you posted a subset of your data using 'dput'
so that we know what it actually looks like. You have character data
mixed with numerics, so you will be NAs in some cases.
Conversion of percent to numeric is accomplished with something like this:
x - c('12%', '6%',
Hello,
i need help, I'm trying to get oauth authorization to get rcredentials
.RData
the code that i use is:
library(twitteR)
library(tm)
library(wordcloud)
library(RColorBrewer)
library(RCurl)
library(ROAuth)
options(RCurlOptions = list(cainfo = system.file(CurlSSL, cacert.pem,
package =
Dear all,in my code I am using the mix() function that returns results in a
list. The result looks like
List of 10
$ parameters :'data.frame': 2 obs. of 3 variables:
..$ pi : num [1:2] 0.77 0.23
..$ mu : num [1:2] -7034 162783
..$ sigma: num [1:2] 20235 95261
$ se
On 26 Feb 2015, at 17:29 , Mikael Olai Milhøj mikaelmil...@gmail.com wrote:
Hi.
First of all, thx. But when using in arima(...xreg=fact,...) then fact
should be a vector and not a factor variable? Maybe I should have been more
clear in my first mail, sorry. Or else I have to dig deeper
Look at dirname() and basename(). The first would be what you call
the path. The second is the file.name without the path.
On Thu, Feb 26, 2015 at 10:58 AM, Luigi Marongiu
marongiu.lu...@gmail.com wrote:
Dear all,
what code should I write in order to extract the file name from a give
path?
Dig deeper.
-- 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 Thu, Feb 26, 2015 at 8:29 AM, Mikael Olai Milhøj
mikaelmil...@gmail.com wrote:
Hi.
First of
here is yet another way:
dta - read.csv( text=
+ key_column,begin_date,end_date
+ 123456,2013-01-01,2014-01-01
+ 123456,2013-07-01,2014-07-01
+ 789102,2012-03-01,2014-03-01
+ 789102,2015-02-01,2016-02-01
+ 789102,2015-02-06,2016-02-06
+ 789102,2015-02-28,2015-03-31
+
I think I have one solution. Not very pretty though. Relies on the text not
changing at all.
as.numeric(gsub(Mean relative difference: , ,
all.equal(cov2cor(ITEMCOV),cor(item.data))[2]))
Is there a better way?
--
View this message in context:
Everything Duncan said, plus:
A construction like this might do the job
run.at - as.POSIXct('2015-02-26 13:05')
while(TRUE) {
if ( trunc(Sys.time(),'min') == run.at) source('whatever-it-is.r')
Sys.sleep(60)
}
but I wouldn't count on it to be as reliable as cron (or Windows
equivalent).
--
Hello,
Does anyone know how to save the numeric value of the mean relative
difference when using the all.equal() command?
For example this:
all.equal(cov2cor(ITEMCOV),cor(item.data))
Gives:
[1] Attributes: Length mismatch: comparison on first 1 components
[2] Mean relative difference:
Thanks everyone
--
View this message in context:
http://r.789695.n4.nabble.com/Extracting-Factor-Pattern-Matrix-Similar-to-Proc-Factor-tp4703704p4703904.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
On 26/02/2015 2:08 PM, Doran, Harold wrote:
Is there functionality within R proper, without having to revert to the OS,
allowing a function or a portion of an R script to be run at a defined time? My
google searches haven't provided much other than one at the link below which
relies on an OS.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm a bit stuck.
I have to integrate a series of polynomial functions with vector
arguments.
v1-c(1:5)
v2-c(1:5)
f1-function (x) {v1*x+v2*x^2}
The problem is that integrate(f1, 0, 1) does not work.
I does not, even if a pas the arguments (v1, v2)
Is there functionality within R proper, without having to revert to the OS,
allowing a function or a portion of an R script to be run at a defined time? My
google searches haven't provided much other than one at the link below which
relies on an OS.
Thanks,
Harold
Funciono perfecto !! tan facil que era, jajaja ... el que sabe sabe,
como dicen.
Muchas gracias Jorge,
Eric.
On 26/02/15 03:02, Jorge I Velez wrote:
Eric,
Creo que necesitas Hmisc:::xYplot(..., label.curves = FALSE)
Saludos,
Jorge.-
2015-02-26 11:15 GMT+11:00 eric
Hi,
Supposed I had a data frame like so:
A B C D
0 1 0 7
0 2 0 7
0 3 0 7
0 4 0 7
0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 5
0 5 1 5
0 4 1 5
0 8 4 7
0 0 3 0
0 0 3 4
0 0 3 4
0 0 0 5
0 2 0 6
0 0 4 0
0 0 4 0
0 0 4 0
For each row, I want to count how many max column values appear to
adventurely get the
Dear Annelies
On 26 February 2015 at 09:12, hnlki annelies.hoebe...@ugent.be wrote:
I estimated a tobit model
tobit.fit-tobit(y~x,left=0, right=Inf) (library AER)
or
tobit2.fit-censReg(y~x, left=0, right=Inf) (librarycensReg)
I' have estimated the partial effect at the average as:
On 26 Feb 2015, at 20:20 , Duncan Murdoch murdoch.dun...@gmail.com wrote:
On 26/02/2015 2:08 PM, Doran, Harold wrote:
Is there functionality within R proper, without having to revert to the OS,
allowing a function or a portion of an R script to be run at a defined time?
My google
I guess the answer to your question is yes.
dta - read.table( text=
A B C D
0 1 0 7
0 2 0 7
0 3 0 7
0 4 0 7
0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 5
0 5 1 5
0 4 1 5
0 8 4 7
0 0 3 0
0 0 3 4
0 0 3 4
0 0 0 5
0 2 0 6
0 0 4 0
0 0 4 0
0 0 4 0
, header=TRUE )
dtacmax - sapply( dta, max )
followed by
Hi,
I assume you want to know the digit count to the left of decimal point.
If this is the case, then you may use trunc(log10(max(1,trunc(abs(a)+1
for a numerical variable a. Count 0.12 as having one digit to the left of
decimal point.
trunc(log10(max(1,trunc(abs(-10.99)+1
[1]
Hi,
Here is an implemenation:
date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
5 789102 2015-02-06 2016-02-06
y -
Hi list
Closing this one off myself, this is what I did:
The error seems to concern the update of tm to version 0.6: the
conversion to lower case text should now be:
docs - tm_map(docs, content_transformer(tolower))
Everything else seems to work fine thereafter.
The issue in the tutorial
Hi ,
I am little confused about how to covert entire dataset to numeric .
As I read data like..
Xelements =read.csv(file. Choose(),header = T, stringsAsFactors=FALSE)
str(xelements )
str(xelements)
'data.frame': 731 obs. of 4 variables:
$ Engine.Speed : chr rpm ES rpm 1049 ...
$
Dear R-List,
#I have a df with the first two cols formatted as factor.
dfx - data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c(M, F), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54))
# now I want to format both factor VARs as character
# I
Hi list
Can someone help me debug the following please:
Having downloaded and installed the bioconductor packages and Rgraphviz,
I am attempting to plot a network graph showing the relation among
chosen words in the corpus of text data.
I first did this:
plot(dtm, terms=findFreqTerms(dtm,
Dear all ,
I am trying to do a Tukey comparison, but a message appears:
tuk-glht(mod0,linfct=mcp(Soil=Tukey));summary(tuk)
Error: could not find function glht
Anyone knows how to fix it?
Thanks a lot!
Xavier
__
R-help@r-project.org
??glht would tell you that glht is a function from the multcomp package.
You need to load a package before you can use its functions.
library(multcomp)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie Kwaliteitszorg / team
hola!soy nueva aqui, estoy haciendo un trabajo sobre R y toda la
informacion que encuentro esta en ingles. me gustaria saber algun libro
sobre R o donde podria conseguir buena informacion sobre el programa en
español, ya sea de su funcionamiento, finalidad del programa,
caracteristicas etc. Nunca
Dear colleagues,
For Tukey, I tried to load the function with
library(multcomp) but again a message says:
Error in library(multcomp) : any package called ‘multcomp’ has been found
Thanks for ur help,
Xavier
__
R-help@r-project.org
yes this is exactly what I want and it works. thanks.
-Original Message-
From: JS Huang [js.hu...@protective.com]
Date: 02/26/2015 03:22 AM
To: r-help@r-project.org
Subject: Re: [R] How many digits are there in left of dot of 0.0001 ?
Hi,
To get the number of digits to the right of
On 2015-02-26 00:33, JS Huang wrote:
Hi,
Here is an implementation. More data are added. An extra column hasRain
is added instead of replacing column Amount.
rain
Year Month Day Amount
1 1950 1 10.0
2 1950 1 2 35.5
3 1950 1 3 17.8
4 1950 1 4
Hi,
It's not as easy as I originally thought. Here is a revision with the
function beginEnd to get it done.
date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
Hi,
I estimated a tobit model
tobit.fit-tobit(y~x,left=0, right=Inf) (library AER)
or
tobit2.fit-censReg(y~x, left=0, right=Inf) (librarycensReg)
I' have estimated the partial effect at the average as:
pea-(pnorm((colMeans(x)%*%tobit.fit$coef[-1])/tobit.fit$scale))%*%tobit.fitt$coef[-1]
and the
Hi,
To get the number of digits to the right of decimal point:
nchar(format(a,scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1) -1.
The part (trunc(log10(max(1,trunc(abs(a)+1) is the number of digits to
the left of decimal. At the end, subtract 1 for the decimal point.
On 26 Feb 2015, at 06:26 , Dan Murphy chiefmur...@gmail.com wrote:
Quick responses as usual. Can always count on R-Help! Bert's point
that it depends is key, of course. Mark and Karim reminded me that R
does not use all cores natively. Putting those together, an expensive
quad core machine
Hola, Gloria. Bienvenida!
Hay algunos manuales en la parte inferior de
http://cran.r-project.org/other-docs.html
Saludos cordiales,
Jorge.-
2015-02-26 22:36 GMT+11:00 Gloria Perez Fuentes fuper...@gmail.com:
hola!soy nueva aqui, estoy haciendo un trabajo sobre R y toda la
informacion que
Hello everybody!
I have a (probabely very easy) problem. Even though I was looking in
several r-books
I could not find a suitable function to this problem, that's why I hope
that someone here
could help me:
# Sample data:
group-c(A,A,A,B,B,C,C,C)
var1-c(1,0,0,1,1,0,NA,1)
var2-c(0,1,NA,0,1,1,0,0)
Hi David,
You have your answer in the question:
aggregate()
aggregate(cbind(var1,var2)~group, data=testdata, FUN=sum)
Although I am not sure what you intended to do with testdata$x- as
the result cannot have the same number of rows than testdata
HTH,
Ivan
--
Ivan Calandra, ATER
University
On 25/02/2015 8:55 PM, ce wrote:
Dear all,
I would like to count how many digits are there on the left of a the dot of a
numeric variable
a=0.0001
This will depend on the formatting used. If default formatting used by
as.character() is fine, then
nchar(sub(^[[:digit:]]*[.], , a))
Dear David,
your email is quite confusing. Do you want to get the sum for each group
(A,B,C) or each variable as would be indicated by your result?
sum by group:
aggregate(data=testdata,var1~group,sum)
count by group:
aggregate(data=testdata,var1~group,length)
sum by variable:
Dear Mr Henningsen,
I have read the posting guide but apparently not well enough. I didn't find
how to include R code in my post. I'll read it again and I'll try to give a
clearer example.
Sorry for the inconvenience.
Kind regards,
Annelies
Op 26-feb.-2015 om 21:59 heeft Arne Henningsen-3
Hello!
get_map help says:
location: an address, longitude/latitude pair (in that order), or
left/bottom/right/top bounding box
My code:
library(ggmap)
library(mapproj)
lat_bottom = 52.33 # bottom latitude of Berlin
lat_top= 52.5 # top latitude of Berlin
lon_left = 13.0 # left
marKo mtoncic at ffri.hr writes:
I'm a bit stuck.
I have to integrate a series of polynomial functions with vector
arguments.
v1-c(1:5)
v2-c(1:5)
f1-function (x) {v1*x+v2*x^2}
The problem is that integrate(f1, 0, 1) does not work.
The point is not that there are vector arguments, but
70 matches
Mail list logo