On Apr 18, 2013, at 21:24 , Nilesh Gupta wrote:
> Hello all
>
> Is there a method/package in R in which I can do regressions for more than
> 50 independent variables ?
What's wrong with lm() et al.?
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads
Hi,
?cor.test
Regards,
Pascal
2013/4/19 Gundala Viswanath
> Is there a native way to produce SE of correlation in R's cor() functions
> and p-value from T-test?
>
> As explained in this web
> http://www.sjsu.edu/faculty/gerstman/StatPrimer/correlation.pdf
> (page 14.6)
>
> The standard erro
Hello all,
I would like to read the specific line number row of a direct access file
(which is stored as a n_row*n_col matrix of elements kind=p) without reading
all the preceding lines (i.e 1,2,..,row-1).
Is there a function in R that can perform this task?
To solve my issue, I tried without
Is there a native way to produce SE of correlation in R's cor() functions
and p-value from T-test?
As explained in this web
http://www.sjsu.edu/faculty/gerstman/StatPrimer/correlation.pdf
(page 14.6)
The standard error is sqrt((1-r^2)/(n-2)), where n- is the number of sample.
- G.V.
[[
Have you read the Intro to R tutorial or checked the relevant parts of
the R Language Definition.? Had you done so, I think you would have
found in one or the other or both that a matrix is just a vector with
a "dim" attribute. mapply() just sees that single argument -- a vector
of length 50. The c
I agree! I would have thought of using as.data.frame() no matter how
hard I had to think. ;)
Thanks,
Mike
On Thu, Apr 18, 2013 at 10:18 PM, arun wrote:
> Hi,
> You can try:
> par(mfrow=c(3, 2))
> mapply(hist,split(a,col(a)),main=colnames(a),xlab="x")
>
>
> If you look at the output,
> mapply(
If the format is not a problem, you could also use:
dat1<-read.table(text="
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
",sep="",header=TRUE)
res<-summary(dat1)
res
# Gender Age Rate
#Female:2 0-1
Hi,
You can try:
par(mfrow=c(3, 2))
mapply(hist,split(a,col(a)),main=colnames(a),xlab="x")
If you look at the output,
mapply(hist,a,main=colnames(a),xlab="x")
[,1] [,2] [,3]
breaks Numeric,2 Numeric,2 Numeric,2
c
On Apr 18, 2013, at 2:39 PM, cmk087 wrote:
> I am trying to write a 1x8 matrix into a text file so I can read it into
> SAS.
> When I tried using write.table I could not get just 8 columns and 1 rows
> it would just write all the data in a line until it hit the end and went to
> the next
On 04/19/2013 08:46 AM, Ye Lin wrote:
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female0-10 Good
Male0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male>20
On Apr 18, 2013, at 3:46 PM, Ye Lin wrote:
> Hey,
>
> Is it possible that R can calculate each options under each column and
> return a summary table?
>
> Suppose I have a table like this:
>
> Gender Age Rate
> Female0-10 Good
> Male0-10 Good
> Female 11-20 Bad
> Male
> mapply(hist,as.data.frame(a),main=colnames(a),xlab="x")
Why it does't work when I use "a" instead of "as.data.frame(a)"?
?mapply says "arguments to vectorize over (vectors or lists of
strictly positive length, or all of zero length)."
Thanks,
Mike
On Thu, Apr 18, 2013 at 6:49 PM, arun wrote:
Hi,
On Thursday, April 18, 2013, cmk087 wrote:
> I am trying to write a 1x8 matrix into a text file so I can read it
> into
> SAS.
> When I tried using write.table I could not get just 8 columns and 1
> rows
> it would just write all the data in a line until it hit the end and went to
> t
I am trying to write a 1x8 matrix into a text file so I can read it into
SAS.
When I tried using write.table I could not get just 8 columns and 1 rows
it would just write all the data in a line until it hit the end and went to
the next line.
I tried instead using write.foreign and I got an
Hello all
Is there a method/package in R in which I can do regressions for more than
50 independent variables ?
Regards
The woods are lovely, dark and deep
But I have promises to keep
And miles before I go to sleep
And miles before I go to sleep
-
[[alternative HTML version deleted]]
Hi,
Try this:
Assuming that "table" is "data.frame"
dat1<-read.table(text="
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
",sep="",header=TRUE,stringsAsFactors=FALSE,na.strings="N/A")
lapply(seq_len(ncol(dat1)),fun
Thanks, Bert and Arun!
Arun, I've always struggled with the difference between
sapply/mapply/tapply, thanks for the two very elegant examples. Very
helpful! :)
Mike
On Thu, Apr 18, 2013 at 6:52 PM, arun wrote:
> #or
> par(mfrow=c(3,2))
>
> sapply(seq_len(ncol(a)),function(i) hist(a[,i],main=col
#or
par(mfrow=c(3,2))
sapply(seq_len(ncol(a)),function(i) hist(a[,i],main=colnames(a)[i],xlab="x"))
A.K.
- Original Message -
From: arun
To: C W
Cc: R help
Sent: Thursday, April 18, 2013 6:49 PM
Subject: Re: [R] How to keep plot title same as column name using apply/sapply?
Hi,
T
Hi,
Try:
par(mfrow=c(3, 2))
mapply(hist,as.data.frame(a),main=colnames(a),xlab="x")
A.K.
- Original Message -
From: C W
To: r-help
Cc:
Sent: Thursday, April 18, 2013 6:30 PM
Subject: [R] How to keep plot title same as column name using apply/sapply?
Dear list,
I am trying to plot h
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female0-10 Good
Male0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
I want to have a summary
Note that in:
apply(a,2,function(x){colnames(x)})
x is a vector, and therefore has no column names.
-- Bert
On Thu, Apr 18, 2013 at 3:30 PM, C W wrote:
> Dear list,
> I am trying to plot histogram of a 10 by 5 matrix by columns.
>
> What is a good way to paste the column names?
>
> dput(a)
> s
I'm pretty sure the intended design is to always use the current
working directory as the output directory, cf. 'Value' section in
help("texi2dvi", package="tools"):
"Used for the side effect of creating a dvi or PDF file in the current
working directory (and maybe other files, especially if clean
Dear list,
I am trying to plot histogram of a 10 by 5 matrix by columns.
What is a good way to paste the column names?
dput(a)
structure(c(0.891856482875103, 0.249593821948295, 0.0385066520473322,
0.109098868876336, 0.238035894186719, 0.971470380855763, 0.168018536530906,
0.941457062296419, -0.28
Dear All
I am trying to specify the output directory and the directory for the
log files (the same) for texi2dvi.
The default for my windows computer is C:\Users\...\Documents which I
do not want.
The help guide:
texinputs NULL or a character vector of paths to add to the LaTeX
and bibtex
vec1<- c(0,1,1,1,2,2,2,3,3)
length(unique(vec1[vec1!=0]))
#[1] 3
vec2<- c(0,2,2,3)
length(unique(vec2[vec2!=0]))
#[1] 2
A.K.
>Hi. I have a new question.
>I need count the different numbers in a vector,but different of zero.
>I mean,if I have c(0,2,2,3) the result is 2. If the
>vector is c(
Dear all,
Is there a package in R that has implemented the MANN (Multiresponse
Artificial Neural Network) presented in (Olden, 2006 - Ecological
Applications)?
Best Wishes,
--
Prof. Gilson Correia de Carvalho, M.Sc.
Pesquisador Associado
Labo
Hi,
Try:
vec1<-
"mue#d/sjbijk@ruepvnvbnceiicrpgxkgcyl@keduhqvqi/ubudvxopddpfddgitrynzshzdcwgneyffrkpbxwilwqngrsals#geqmtkcpkp/qecgdfa#uag"
library(seqinr)
res<-lapply(0:4,function(i) lapply(2:5,function(j)
splitseq(s2c(gsub("[#@/]","",vec1)),word=j,frame=i)))
#or
library(stringr)
res1<-lapply
On Thursday 18. April 2013 12.18.03 Milan Bouchet-Valat wrote:
> First, completely stop looking at virtual memory: it does not mean much, if
> anything. What you care about is resident memory. See e.g.:
> http://serverfault.com/questions/138427/top-what-does-virtual-memory-size-m
> ean-linux-ubuntu
Hi,
May be this helps (Assuming that there are only '0's and '1's in the dataset)
dat1<-read.table(text="
ID X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
1 5184 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0
2 6884 0 0 1 0
I know this is a late response, but what about
startt <- as.POSIXct( paste(data2$V4, data2$V5) )
endt <- startt + data2$V6
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 4/12/13 12:09 AM, "Cat Cowie" wrote:
>Hi G
Hi Saalem,
Check the following:
http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_(ggplot2)/
Regards,
Andrés AM
El 18/04/2013, a las 09:47, Saalem Adera escribió:
> Hi all,
>
> I want to arrange two ggplot2 plots on the same page with their x-axes
> lined up - even though one i
Rune,
Thank you very much for your response.
I don't actually have the models that failed to converge from the first
(glmulti) part as they were not saved with the confidence set. glmulti
generates thousands of models so it seems reasonable that a few of these
may not converge.
The clmm() m
Fabio Berzaghi dmu.dk> writes:
>
> hello all,
>
> I have a simple linear model with 4/5 variables that I am trying to fit.
> I would like to find the lowest AIC value with any combination of all
> the variables. I would like to implement this with a while/for loop.
> Possibly I would like to
Hi all,
I want to arrange two ggplot2 plots on the same page with their x-axes
lined up - even though one is a boxplot and the other is a line plot. Is
there a simple way to do this? I know I could do this using facetting if
they were both the same type of plot (for example, if they were both
b
OFFTOPIC
These links were sent to me by a friend and are kind of a followup to
Sarah Goslee's recent off topic post on the Rogoff Excel spreadsheet
goof, which I appreciated, that I hope will be of interest to this
list's readers. I apologize if I have taken too much license. I will
als
Jan,
Thanks for the data (off list). The p-value computations are based on
the approximation that things are approximately normal on the linear
predictor scale, but actually they are no where close to normal in this
case, which is why the p-values look inconsistent. The reason that the
approx
I said I would post if I figured this out - here is what I found. When my
working directory is located anywhere within my user folder (e.g.
"C/Users/Stauffer") on my Windows 7 computer, then the "Browse for folder"
dialog box displays the behavior I described (directory tree always defaults
to "My
Also, out of interest, does anyone know of a test (or objective method) for
spatial autocorrelation for "gls" objects?
Thanks,
Ben Gillespie, Research Postgraduate
o---o
School of Geography, University of Leeds, Leeds, LS2 9JT
o
Do you know that there are NaN's in the output of bs(raw_data[,i],df=15)?
any(is.nan(bs(raw_data[,i],df=15))) would tell you. Do you know that there
are fewer than c. 18 distinct values in raw_data[,i]?
length(unique(raw_data[,i]))
would tell you. If there are not very many distinct values then
Hi there,
Does anyone know of a statistical test for heteroscedasticity for an object of
class "gls"? (or alternative objective methods).
Thanks in advance,
Ben Gillespie, Research Postgraduate
o---o
School of Geography, University
Hi,
Isn't that answered already?
vec2<-c(2,2,2,2,2,2,2)
if(length(unique(vec2))==1) "x" else "yyy"
#[1] "x"
vec2<-c(22,22,22,22,23,22,22)
if(length(unique(vec2))==1) "x" else "yyy"
#[1] "yyy"
vec2<-c(22,22,22,22,22,22,22)
if(length(uniqu
Hi,
You didnt provide an example dataset:
set.seed(25)
mycd<-
data.frame(a_vol3=sample(1:20,20,replace=TRUE),a_vol4=sample(5:45,20,replace=TRUE),week=rep(1:4,each=5))
aggregate(a_vol3 ~ week , data = mycd, mean)
aggregate(a_vol4 ~ week , data = mycd, mean)
#The above two could be combined to:
Hi,
Try:
vec1<-c(1,1,1,1,1,1,1,1,1)
if(all(vec1==1)) "x" else "yyy"
#[1] "x"
vec2<-c(rep(1,4),2)
if(all(vec2==1)) "x" else "yyy"
#[1] "yyy"
#or
if(length(unique(vec1))==1) "x" else "yyy"
#[1] "x"
if(length(unique(vec2)
Hi Janesh,
This is a bit shorter:
library(seqinr)
sapply(split(as.numeric(s2c(x)),((seq(nchar(x))-1)%/%5)+1),prod)
A.K.
- Original Message -
From: arun
To: Janesh Devkota
Cc: R help
Sent: Thursday, April 18, 2013 8:55 AM
Subject: Re: [R] Subsetting a large number into smaller numbe
On 04/18/2013 03:18 AM, Milan Bouchet-Valat wrote:
Le mercredi 17 avril 2013 à 23:17 -0400, Christian Brechbühler a écrit :
In help(gc) I read, "...the primary purpose of calling 'gc' is for the
report on memory usage".
What memory usage does gc() report? And more importantly, which memory
uses
On 18/04/2013 14:22, Kaiyin Zhong (Victor Chung) wrote:
Thanks.
So is there a way to get the number of cpu cores in R?
Yes, for various definitions of 'core'. Try ??cores which gets you to
parallel::detectCores Detect the Number of CPU Cores
And BTW 'snow' is not part of R.
Best rega
ok, got it:
library(multicore)
ncore = multicore:::detectCores()
Best regards,
Kaiyin ZHONG
--
FMB, Erasmus MC
k.zh...@erasmusmc.nl
kindlych...@gmail.com
On Thu, Apr 18, 2013 at 3:13 PM, Jon Olav Skoien <
jon.sko...@jrc.ec.europa.eu> wrote:
> I dont think this has
Jan,
Thanks for this. Is there any chance that you could send me the data off
list and I'll try to figure out what is happening? (Under the
understanding that I'll only use the data for investigating this issue,
of course).
best,
Simon
on 18/04/13 11:11, Jan Holstein wrote:
Simon,
thanks
Thanks.
So is there a way to get the number of cpu cores in R?
Best regards,
Kaiyin ZHONG
--
FMB, Erasmus MC
k.zh...@erasmusmc.nl
kindlych...@gmail.com
On Thu, Apr 18, 2013 at 3:18 PM, Jon Olav Skoien <
jon.sko...@jrc.ec.europa.eu> wrote:
> I also wanted to add the
I also wanted to add the result from my Windows machine (R 3.0.0) to the
answer below:
> ncore = system('nproc')
> ncore
[1] 127
# My machine was not happy about starting a cluster with 127 nodes though.
Best wishes,
Jon
On 18-Apr-13 15:13, Jon Olav Skoien wrote:
I dont think this has anything
I dont think this has anything to do with the snow package, you should
rather start by checking what is the output of system('nproc') is on
your computer, and also whether it is possible to assign this to a
variable. I tried on a redhat linux (R 2.15.0) server:
> ncore = system('nproc')
16
> n
Hi,
You could also use:
x <-
"73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557"
sapply(strsplit(substring(x,seq(1,nchar(x)-4,5),seq(5,nchar(x),5
hello all,
I have a simple linear model with 4/5 variables that I am trying to fit.
I would like to find the lowest AIC value with any combination of all
the variables. I would like to implement this with a while/for loop.
Possibly I would like to generalize this so then I can use it when I
h
Tobias,
I'm not sure if this is what you're after, but perhaps it will help.
# create a list of 5 vectors
n <- 5
subsets <- lapply(1:n, function(x) rnorm(5, mean=80, sd=1))
# create another list that takes 2 bootstrap samples from each of the 5
vectors and puts them in a matrix
nbootstrap <- 2
t
Hi.
I completely forgot split function so loop:
l <- vector("list", n_levels)
for(i in 1:n_levels)
{
l[[i]] <- a[blocks==levels(blocks)[i]]
}
l
could be substitute with:
split(a, blocks),
but anyway Rui's solution is better.
Andrija
On Thu, Apr 18, 2013 at 1:18 PM, andrija djurovic wrote:
>
Hello,
Sorry, forgot the instruction to read in the data.
Now the complete code.
x <- scan(text = "
90.1194354
87.94788274
80.34744843
64.06080347
30.40173724
0
0
0
0
0
16.28664495
23.88707926
29.31596091
48.85993485
13.02931596
0
0
0
7.600434311
20.62975027
29.31596091
32.5732899
")
x
grp <-
Hello,
Something like this?
grp <- cumsum(abs(c(0, diff(x == 0
tmp <- lapply(split(x, grp), function(x) if(all(x == 0)) NULL else x)
tmp[sapply(tmp, function(x) !is.null(x))]
Hope this helps,
Rui Barradas
Em 18-04-2013 10:33, Igor Mintz escreveu:
hello
i have a very long column of numb
Hi Igor.
Here is one way:
DF <- read.table(textConnection("90.1194354
87.94788274
80.34744843
64.06080347
30.40173724
0
0
0
0
0
16.28664495
23.88707926
29.31596091
48.85993485
13.02931596
0
0
0
7.600434311
20.62975027
29.31596091
32.5732899"), header=FALSE)
a <- DF$V1[which(DF$V1!=0)]
indx <- wh
Le mercredi 17 avril 2013 à 23:17 -0400, Christian Brechbühler a écrit :
> In help(gc) I read, "...the primary purpose of calling 'gc' is for the
> report on memory usage".
> What memory usage does gc() report? And more importantly, which memory
> uses does it NOT report? Because I see one answer
Simon,
thanks for the reply, I guess I'm pretty much up to date using
mgcv 1.7-22.
Upgrading to R 3.0.0 also didn't do any change.
Unfortunately using method="REML" does not make any difference:
### first with "select=FALSE"
> fit<-gam(target
> ~s(mgs)+s(gsd)+s(mud)+s(ssCmax),family=quasi(
hello
i have a very long column of numbers. i want R to make a new column every
time the value changes from zero.
example for the column:
90.1194354
87.94788274
80.34744843
64.06080347
30.40173724
0
0
0
0
0
16.28664495
23.88707926
29.31596091
48.85993485
13.02931596
0
0
0
7.600434311
20.62975027
29
Hi.
Here is one approach:
options(scipen=300)
numb <-
73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557
strsplit(as.character(numb), "")
blocks <-
On Apr 18, 2013, at 05:35 , Thomas Lumley wrote:
> I just looked more carefully at your code.
>
> You are computing the unequal-variance (Welch) version of the t-test, so
> that's why there isn't a problem. Compare it with the equal-variance
> t-test, using the pooled variance estimate, which d
Dear Janesh,
Here is one way:
# note "x" is a character
x <-
"73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557"
k <- nchar(x) # digits in x
b <
Here is the code, assuming 8 cores in the cpu.
library('modeest')
library('snow')
cl = makeCluster(rep('localhost', 8), 'SOCK')
x = vector(length=50)
x = sapply(x, function(i) i=sample(c(1,0), 1))
pastK = function(n, x, k) {
if (n>k) { return(x[(n-k):(n-1)]) }
else {return(NA)}
}
predR
On 18-Apr-2013 08:47:18 Janesh Devkota wrote:
> Hello,
>
> I have a big number lets say of around hundred digits. I want to subset
> that big number into consecutive number of 5 digits and find the product of
> those 5 digits. For example my first 5 digit number would be 73167. I need
> to check
Dear all,
I found a strange thing with the snow package.
This will work:
y = matrix(1:4, 2)
cl = makeCluster(rep('localhost', 8), type='SOCK')
parMM(cl, y, y)
This will not:
y = matrix(1:4, 2)
ncore = system('nproc')
parMM(cl, y, y)
Error in cut.default(i, breaks) : invalid number of intervals
Hello,
I have a big number lets say of around hundred digits. I want to subset
that big number into consecutive number of 5 digits and find the product of
those 5 digits. For example my first 5 digit number would be 73167. I need
to check the product of the individual numbers in 73167 and so on.
Hi,
You didn't read the help file carefully enough.
?read.csv
"skip" argument.
Regards,
Pascal
On 04/18/2013 04:46 PM, jpm miao wrote:
I have many xls grade report sheets with the same format
XXX High School Grade Report
Confidential Yes
Math English Science
John 90 85 90
Mary
Hi.
You can try with argument skip in read.csv function(check ?read.csv).
Also, if you want directly to import an Excel file you can use
readWorksheet function from XLConnect package and use argument startRow to
set up the first row to read from.
Hope this helps.
Andrija
On Thu, Apr 18, 2013
I have many xls grade report sheets with the same format
XXX High School Grade Report
Confidential Yes
Math English Science
John 90 85 90
Mary 75 88 93
Since the reports are prepared on a regular basis, I have many reports with
identical format. Without the title XXX High School
On Apr 17, 2013, at 10:20 PM, Sachinthaka Abeywardana wrote:
> Hi All,
>
> I have the following problem (read the commented bit below):
>
> a<-matrix(1:9,nrow=3)
>
>
> a
>
> [,1] [,2] [,3]
> [1,]147
> [2,]258
> [3,]369
>
>
> div<-1:3
>
> apply(a,2,f
On 18-04-2013, at 07:20, Sachinthaka Abeywardana
wrote:
> Hi All,
>
> I have the following problem (read the commented bit below):
>
> a<-matrix(1:9,nrow=3)
>
>
> a
>
> [,1] [,2] [,3]
> [1,]147
> [2,]258
> [3,]369
>
>
> div<-1:3
>
> apply(a,2,func
Hi.
It would be easier to help you if you show us the result you are trying to
obtain.
Here are my attempts:
> sweep(a,2,div, FUN="/")
[,1] [,2] [,3]
[1,]1 2.0 2.33
[2,]2 2.5 2.67
[3,]3 3.0 3.00
or
> a/matrix(rep(div,3),ncol=3, byrow=TRUE)
[,1] [,2]
74 matches
Mail list logo