.
NSE has its strengths... but as a method of creating data objects it sucks.
Note that even the tidyverse (now) requires you to use quotes when you are not
directly referring to something that already exists. And if you were... you
might as well be creating a formula.
On January 4, 2021 11:1
t;married"
On 2021/1/5 下午 05:34, Eric Berger wrote:
> zx<-strsplit("age,exercise,income,white,black,hispanic,base,somcol,grad,employed,unable,homeowner,married,divorced,widowed",",")
>
>
>
> On Tue, Jan 5, 2021 at 11:01 AM Steven Yen <mailto:st...@ntu.
v + nongov + married
> eq2<-my.formula(y="cig",x=xx); eq2
cig ~ c("hhsize", "urban", "male", "age3045", "age4659", "age60",
"highsc", "tert", "gov", "nongov", "married"
Min. :0.1029 Min. :0.6405
1st Qu.:0.4090 1st Qu.:0.4533 1st Qu.:0.6557
Median :0.7883 Median :0.5726 Median :0.6928
Mean :0.6617 Mean :0.5527 Mean :0.7746
3rd Qu.:0.8830 3rd Qu.:0.6776 3rd Qu.:0.8895
Max. :0.9405 Max. :0.9568 Max. :0.9943
On 2021/1/5
something bad (which I should avoid)
in my calls to mycdf2 and mycdf to obtain p2 and p3, respectively. Thank
you.
Steven Yen
pbivlogis <- function(x,y,rho){
# *
# Bivariate logistic CDF
# *
p<-(1+exp(-x)+
I have a 10 x 2 matrix x. Like to divide the first column by s[1] and
second column by s[2]. The following lines work but are clumsy. Any
idea? Thanks.
> x
[,1] [,2]
[1,] 1 11
[2,] 2 12
[3,] 3 13
[4,] 4 14
[5,] 5 15
[6,] 6 16
[7,] 7 17
[8,] 8
`%!%` <- function(x, y) {
stopifnot(ncol(x) == length(y))
t(t(x)/y)
}
x <- matrix(1:20, ncol = 2)
s <- 1:2
x %!% s
x %!% 1:4
Hope this helps,
Rui Barradas
Às 11:00 de 03/03/21, Steven Yen escreveu:
I have a 10 x 2 matrix x. Like to divide the first column by s[1]
and second
I have data of mixed types in a data frame - date and numeric, as shown
in summary below. How do I identify the column(s) that is/are not
numeric, in this case, the first. All I want is to identify the
column(s) and so that I can remove it/them from the data frame Thanks.
> summary(mydata)
Dat
Thanks much! Yes it does. I will read.
On 2021/4/10 上午 11:33, Jeff Newmiller wrote:
Does
sapply( mydata, inherits, what = "POSIXt" )
give you any ideas?
On April 9, 2021 8:25:36 PM PDT, Steven Yen wrote:
I have data of mixed types in a data frame - date and numeric, as shown
eric columns only.
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 04:25 de 10/04/21, Steven Yen escreveu:
>> I have data of mixed types in a data frame - date and numeric, as shown
>> in summary below. How do I identify the column(s) that is/are not
>> numeric
Below, the first command simply creates a list of 16 names (labels)
which can be ignore.
In the 2nd and 3rd commands, I am able to identify names containing "black".
In line 4, I am trying to identify names containing "black" or "conserv"
but obviously it does not work. Can someone help? Thank
function names
like "names" as data names is bad practice.)
nms <- c( "x1.one", "x1.black", "x1.othrrace", "x1.moddkna",
"x1.conserv", "x1.nstrprty", "x1.strrep", "x1.sevngprt", "x2.one",
"
I insert variable with the expss function as shown below. No error
message. My question is, how to save the variable labels in the data
frame so that I can click to read the labels. Thank you.
mydata<-read_excel("data/Excel/hseinv.xlsx",na=".")
library(expss)
mydata=apply_labels(mydata,
; Is that what you wanted?
>
> Fredrik
>
>> On Thu, May 13, 2021 at 4:49 AM Steven Yen wrote:
>> I insert variable with the expss function as shown below. No error
>> message. My question is, how to save the variable labels in the data
>> frame so that I c
get? Use save/load.
You want to do something different? So please explain what exactly.
Cheers
Petr
-Original Message-
From: Steven Yen
Sent: Thursday, May 13, 2021 5:53 PM
To: PIKAL Petr
Subject: Re: [R] Variable labels
Petr
Those attachments (1.jpg, 2.jpg) I sent earlier were just
ttributes(mydata)
$names
[1] "id" "age" "yrmarry"
$class
[1] "data.frame"
$row.names
[1] 1 2 3 4 5 6
$var.labels
[1] "Individual ID" "Age in Years" "Years of marriage"
Cheers
Petr
-Original Message-
Fr
ry List maker for Android and iOS.
> https://play.google.com/store/apps/details?id=io.robertknight.MPGL
> <https://play.google.com/store/apps/details?id=io.robertknight.MPGL>
>
>
>
>
>
>
> On Wed, May 12, 2021 at 9:49 PM Steven Yen <mailto:st...@ntu.edu.tw>&
The following "subset command works. I was hoping the second would as
well but it does not.
My definition of exclude is rejected.
Help please? Thanks.
> mydata<-subset(mydata,
+ prim>-9 & highsch>-9 & tert>-9 &
+ govt>-9 & nongovt>-9 &
+ m
Thanks. YES the second call to subset is there, trying to use my failed
definition of "exclude". Read on..
On 2021/10/16 上午 09:35, Jeff Newmiller wrote:
I don't see a "second one". Looks like you forgot the subset function call?
On October 15, 2021 6:23:56 PM PDT
negation -
-c(TRUE,FALSE)
[1] -1 0
as.logical(-c(TRUE,FALSE))
[1] TRUE FALSE
!c(TRUE,FALSE)
[1] FALSE TRUE
On Oct 15, 2021, at 21:23, Steven Yen wrote:
The following "subset command works. I was hoping the second would as well but
it does not.
My definition of exclude is re
I like to be able to use a command with something similar to a "wild
card". Below, lines 4 works to delete all three dataframes, but line 5
does not work. Any elegant way to accomplish this? My list of dataframes
can be long and so this would be convenient.
data.1<-data.frame(x=1:3,y=4:6,z=7:9
ects names matching the pattern.
rm(list = ls(pattern = "data\\..*$"))
Hope this helps,
Rui Barradas
Às 10:20 de 22/10/21, Steven Yen escreveu:
I like to be able to use a command with something similar to a "wild
card". Below, lines 4 works to delete all three dataframes,
I have named NUMEROUS objects (each containing, e.g., 48 obs. of 5
variables), such as
mec1.p.emb
mec2.p.emb
meb1.p.emb
meb2.p.emb
mej12.p.emb
mej22.p.emb
How would I rename these objects removing the silly ".emb", into objects
mec1.p
mec2.p
meb1.p
meb2.p
mej12.p
mej22.p
(tmp_list)
rm(list = obj_names)
# check to see if it worked (it did)
ls()
#[1] "meb1.p" "meb2.p" "mec1.p" "mec2.p" "mej12.p" "mej22.p"
Hope this helps,
Rui Barradas
Às 10:27 de 20/11/21, Steven Yen escreveu:
I have named NUMEROUS ob
Yes, these lines are part of a subroutine calling yet more procedures. What
frustrated me was, I am not doing anything different from other routines. My
cat command in the recent code does not do anything other than printing a line
of plain text. I am clueless.
Steven from iPhone
> On Oct 13,
t<-abs(me)/se; p<-2*(1-pt(t,nrow(x)))
sig<-my.sig.levels(p)
out<-data.frame(round(cbind(me,se,t,p),digits)); out<-cbind(out,sig)
rownames(out)<-names(me)
colnames(out)<-c("est","se","t","p","sig")
cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit
Probabilities",
"\n\nlogistic
screte Effects of Gen Ordered Logit / Probit
>>> Probabilities","logisitic =",fortytwo,"\n")
>>> j<-grep(".one\\b",c(".one\\a",".one\\b"))
>>>
>>> Marginal
Thanks to all. Very helpful.
Steven from iPhone
> On Jan 14, 2023, at 3:08 PM, Andrew Simmons wrote:
>
> You'll want to use grep() or grepl(). By default, grep() uses extended
> regular expressions to find matches, but you can also use perl regular
> expressions and globbing (after converting
x[“V2”] would retain columns of x headed by V2. What I need is the opposite——I
need a data grime with those columns excluded.
Steven from iPhone
> On Feb 13, 2023, at 9:33 AM, Rolf Turner wrote:
>
>
>> On Sun, 12 Feb 2023 14:57:36 -0800
>> Jeff Newmiller wrote:
>>
>> x["V2"]
>>
>> is more
he first few lines of
> `[.data.frame` when the first index is missing and the second is
> provided, it does almost the same thing as if only the first index
> provided.
>
>> On Sun, Feb 12, 2023 at 9:38 PM Steven Yen wrote:
>>
>> x[“V2”] would retain columns of x he
The RStudio list generally does not respond to free version users. I was hoping
someone one this (R) list would be kind enough to help me.
Steven from iPhone
> On Apr 6, 2023, at 6:22 PM, Uwe Ligges
> wrote:
>
> No, but you need to ask on an RStudio mailing list.
> This one is about R.
>
>
Here’s what I found:
Running the line commands
install.packages("knitr")
install.packages('tinytex')
and interactively in RStudio:
Tools->Install Packages -> …
both work. Thank you!
Steven from iPhone
> On Apr 27, 2023, at 8:26 AM, Steven T. Yen wrote:
>
> Dear tinytex users
>
> I install
Dear All,
I would like to get a matrix (table) printed in a procedure, as
attempted below. Please help. Thanks.
test<-function(x){
table<-matrix(x,nrow=4)
cat("\nTable:\n",table)
invisible(list(table=table))
}
x<-1:20
test(x)
--
st...@ntu.edu.tw (S.T. Yen)
[[alternative HTML v
Great! Thanks.
On 5/15/2019 7:00 PM, Rui Barradas wrote:
> Hello,
>
> What's wrong with
>
> test <- function(x){
> table <- matrix(x, nrow = 4)
> cat("\nTable:\n")
> print(table)
> invisible(list(table = table))
> }
>
>
> Hope t
Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command with
a random seed of 123. I get different results. Advice appreciated.
Steven Yen
> # Run under R-3.
Thanks. Somewhat of a mystery. The older version I had was R-3.5.3patched.
I cannot get the RNGversion command to run. Can you help? Thanks.
On 6/22/2019 12:25 AM, Uwe Ligges wrote:
> See the NEWS, the RNG has been changed, use RNGversion
>
> On 21.06.2019 18:10, Steven Yen wrote:
&g
seed(12345671)
> j<-sample(1:length(x),size=60); y<-x[j]
> summary(j)
>
>
> Now I get the results you got udner the old R.
>
> Best,
> Uwe Ligges
>
>
>
> On 21.06.2019 18:39, Steven Yen wrote:
>> Thanks. Somewhat of a mystery. The older version I had
Unhappy but thanks.
Steven
On 6/22/2019 1:13 AM, Uwe Ligges wrote:
>
>
> On 21.06.2019 19:09, Steven Yen wrote:
>> Now I see that results were replicated but running RNGversion
>> I get a warning message. Isn't there a way to do this clean?
>
> Well, the old RNG i
I have a data frame containing two variables: year and rate (shown below).
Which function can I use to plot rate (y-axis) against year (x-axis)?
There will be more columns of rate later on.
Thank you.
year rate 1 1993 0.608 2 1994 0.622 3 1996 0.623 4 1998 0.647 5 2000
0.646 6 2002 0.625 7 2004 0
I have a data frame containing two variables: year and rate (shown below).
Which function can I use to plot rate (y-axis) against year (x-axis)?
There will be more columns of rate later on.
Thank you.
year rate 1 1993 0.608 2 1994 0.622 3 1996 0.623 4 1998 0.647 5 2000
0.646 6 2002 0.625 7 2004 0
Since updating to R3.6.1., I have received a WARNING message saying
Rtools is required.
I get the same message installing online from CRAN and from a .zip file.
It looked like installation still went through in both cases, BUT,
Another student installed a .zip file and received the following erro
Can someone help me understand why Rtools is needed when installing a
package from CRAN, and from a zipped file? What's the point?
On 9/14/2019 10:29 PM, Steven Yen wrote:
> Since updating to R3.6.1., I have received a WARNING message saying
> Rtools is required.
> I get th
.
Thank you.
Steven Yen
===
> install.packages("C:/Users/Bonnie/Desktop/yenlib1_1.1.0.zip", repos =
NULL, type = "win.binary")
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
be
I wish to stack columns of a matrix into one column. The following
matrix command does it. Any other ways? Thanks.
> x<-matrix(1:20,5,4)
> x
[,1] [,2] [,3] [,4]
[1,] 1 6 11 16
[2,] 2 7 12 17
[3,] 3 8 13 18
[4,] 4 9 14 19
[5,] 5 10 15 20
> ma
I wish to stack columns of a matrix into one column. The following
matrix command does it. Any other ways? Thanks.
> x<-matrix(1:20,5,4)
> x
[,1] [,2] [,3] [,4]
[1,] 1 6 11 16
[2,] 2 7 12 17
[3,] 3 8 13 18
[4,] 4 9 14 19
[5,] 5 10 15 20
> ma
Dear All
My program is long and sorry I do not have a replicable set of codes to
present. But I present a chunk of codes at the end below. Essentially,
1. I initialize cat.ref as NUL (see line 1)
2. Then, I repeatedly add elements to cat.ref, where each element
include parentheses in double qu
t
to read and what to use? Thank you.
Steven Yen
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide comm
I need to read csv files repeatedly, named data1.csv, data2.csv,… data24.csv,
24 altogether. That is,
data<-read.csv(“data1.csv”)
…
data<-read.csv(“data24.csv”)
…
Is there a way to do this in a loop? Thank you.
Steven from iPhone
[[alternative HTML version deleted]]
__
Steven from iPhone
> On Feb 19, 2024, at 4:56 PM, Steven Yen wrote:
>
> Thanks to all. Glad there are many options.
>
> Steven from iPhone
>
>>> On Feb 19, 2024, at 1:55 PM, Rui Barradas wrote:
>>>
>> Às 03:27 de 19/02/2024, Steven Yen escreve
How can I call and include an external set of R codes, not necessarily a
complete procedure (which can be include with a “source” command). Example:
#I like to include and run the following lines residing in a file outside the
main program:
mydata<-transform(mydata,
a<-b+c
d<-e+f
}
Steven fro
Is there as way to initialize a vector (matrix) with an unknown length
(dimension)? NULL does not seem to work. The lines below work with a
vector of length 4 and a matrix of 4 x 4. What if I do not know
initially the length/dimension of the vector/matrix?
All I want is to add up (accumulate)
("midata", ind, ".csv"))
...
k<-length(ame.00$bame)
bsum<-bsum[1:k]+ame.00$bame
vsum<-vsum[1:k,1:k]+ame.00$vame
}
On 2/28/2024 4:56 PM, Steven Yen wrote:
Is there as way to initialize a vector (matrix) with an unknown length
(dimension)? NULL does not seem to work. The
m
Xi
# sum over Xi
Reduce("+",Xi)
Hope that helps
Eik
Am 28.02.2024 um 09:56 schrieb Steven Yen:
Is there as way to initialize a vector (matrix) with an unknown
length (dimension)? NULL does not seem to work. The lines below work
with a vector of length 4 and a matrix of 4 x 4. W
Thanks to all. Great ideas. I found Eik Vettorazzi's suggesstion easy to
implrment:
ebarm<-vbarm<-NULL
...
if (is.null(ebarm)) ebarm<-ame.00$ei/k else ebarm<-ebarm+ame.00$ei/k
if (is.null(vbarm)) vbarm<-ame.00$vi/k else vbarm<-vbarm+ame.00$vi/k
...
Steven Yen
On 2/
How can I have both printout and saved results at the same time.
The subroutine first return "out" and the printout gets printed, but not
saved.
I then run the "invisible" line. Results got saved and accessible but no
printout.
How can I have both printout and also have the results saved? T
you want to
save the value,
you can wrap the assignment in parentheses, making it an expression:
(retained.interesting.result <- function.with.interesting.result(..))
On Tue, 26 Mar 2024 at 15:03, Steven Yen wrote:
How can I have both printout and saved results at the same time.
The subr
I would like a loop to
(1) read data files 2010midata1,2010midata2,2010midata3; and
(2) name OUTPUT bop1,bop2,bop3.
I succeeded in line 3 of the code below,
BUT not line 4. The error message says:
Error in paste0("bop", im) <- boprobit(eqs, mydata, wt = weight, method
= "NR", : target of ass
Thanks Eric. I am not following your suggested line. Would you just edit
my line 4? Thanks.
On 6/24/2024 7:51 PM, Eric Berger wrote:
> How about
>
> assign(paste0("bop",im), boprobit( etc ))
>
>
>
> On Mon, Jun 24, 2024 at 2:41 PM Steven Yen wrote:
>
>
.method="invH",joint12=TRUE,
printing=FALSE,testing=TRUE)
}
On 6/24/2024 7:57 PM, Eric Berger wrote:
> assign(paste0("bop",im),boprobit(eqs,mydata,wt=weight,method="BHHH",tol=0,reltol=0,gradtol=1e-5,Fisher=TRUE))
>
>
> On Mon, Jun 24, 2024 at 2
Jun 2024 20:16:46 +0800
Steven Yen пишет:
In the call to ame.bopa in a loop, I like inputs in the call to
ame.bopa to be bop1, bop2, bop3,... Thanks.
for (im in 1:m) {
ame<-ame.bopa(bop,y1.level=y1value,y2.level=y2value,jindex=jindex1,vb.method="invH",joint12=TRUE,
Below is part a regression printout. How can I use "grep" to identify
rows headed by variables (first column) with a certain label. In this
case, I like to find variables containing "somewhath",
"veryh", "somewhatm", "verym", "somewhatc", "veryc","somewhatl",
"veryl". The result should be an in
Thanks. In this case below, what is "x"? I tried rownames(out) which did
not work.
Sorry. Does this sound like homework to you?
On 7/12/2024 5:09 PM, Uwe Ligges wrote:
On 12.07.2024 10:54, Steven Yen wrote:
Below is part a regression printout. How can I use "grep" to
goprobit.p$est)) [1]
6 7 8 9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55 56 57
On 7/12/2024 5:26 PM, Steven Yen wrote:
> Thanks. In this case below, what is "x"? I tried rownames(out) which
> did not work.
>
> Sorry. Does this sound like homework to you?
>
&
Sorry. grepl worked:
which(grepl("very|somewhat",names(goprobit.p$est)))
On 7/12/2024 5:34 PM, Steven Yen wrote:
>
> Could not get "which" to work, but my grep worked. Thanks.
>
> > which(grep("very|somewhat",names(goprobit.p$est))) Error in
>
341 -0.1108 -0.0694 -0.2909 -0.4267 -0.6188
-0.7580 -0.3413 -0.3813 [10] -0.3101 -0.2977 -0.6310 -0.9132 0.1885
-0.0887 -0.0850 0.0847 -0.1588
On 7/12/2024 11:57 PM, Steven Yen wrote:
> Thanks. First and second of the following worked, but the third (with
> coef) did not. This may be bec
9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55
56 57
>
On 7/13/2024 12:31 AM, Rui Barradas wrote:
Hello,
So any of
names(goprobit.p$est) |> grep("somewhat|very", x = _)
goprobit.p$est |> names() |> grep("somewhat|very", x = _)
should work, right?
Good Morning. Below I like statement like
j<-grep(".r\\b",colnames(mydata),value=TRUE); j
with the \\b option which I read long time ago which Ive found useful.
Are there more or these options, other than ? grep? Thanks.
dstat is just my own descriptive routine.
> x
[1] "age" "sleep
Thanks!
On 8/2/2024 12:28 PM, Rui Barradas wrote:
Às 02:10 de 02/08/2024, Steven Yen escreveu:
Good Morning. Below I like statement like
j<-grep(".r\\b",colnames(mydata),value=TRUE); j
with the \\b option which I read long time ago which Ive found useful.
Are there more or
Can someone help me with the if loop below? In the subroutine, I
initialize all of (joint12,marg1,marg2,cond12,cond21) as FALSE, and call
with only one of them being TRUE:
,...,joint12=FALSE,marg1=FALSE,marg2=FALSE,cond12=FALSE,cond21=FALSE
joint12 seems to always kick in, even though I ca
} else if(marg1) {
labels<-c(labels,lab.p1)
} else if(marg2) {
labels<-c(labels,lab.p2)
} else if(cond12){
labels<-c(labels,lab.pc12)
} else {
labels<-c(labels,lab.pc21)
}
On 8/9/2024 11:44 AM, Steven Yen wrote:
Can someone help me with the if loop below?
x27;t see?
>
> joint12 <- marg1 <-F
>
> marg1 <-T
>
> if (joint12) {
> print ("joint 12")
> cat (joint12)
> }
>
> if (marg1) {
> print("marg 1")
> cat(marg1)
> }
>
> Would probably be my diagnostic approach
>
&
n() {
>> v <- v+1
>> return (v)
>> }
>>
>> v <- funB()
>> cat (v)
>> #2
>>
>> Or use <<- assignment I think. (I usually return, but return can only
>> return one object and I think you want two or more
>>
>> v <
Hi
In the following codes, I had to choose between printing (= TRUE) or
deliver something for grab (ei, vi). Is there a way to get both--that
is, to print and also have ei and vi for grab? Thanks.
Steven
...
out<-round(as.data.frame(cbind(ap,se,t,p)),digits)
out<-cbind(out,sig)
out<-out[!gr
invisible.
On 8/11/2024 10:09 PM, Rui Barradas wrote:
Às 09:51 de 11/08/2024, Steven Yen escreveu:
Hi
In the following codes, I had to choose between printing (= TRUE) or
deliver something for grab (ei, vi). Is there a way to get both--that
is, to print and also have ei and vi for grab? Thanks.
I had to use an older version of R (as old as R3.0.3) for a reason. I
myself have no problem installing a package built under a newer version,
but my student (who also installed R3.0.3) could not install the package
(newer version). Had an error message saying package x is not
available und
Thanks. I visited the Rtools web page and learned to run the following
lines. I am still getting the same warning message.
> writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con =
"~/.Renviron")
> Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
O
Thanks. Updating RStudio to 1.2.5042 did fix the problem. Thank you!
On 2020/4/28 下午 11:30, Duncan Murdoch wrote:
On 28/04/2020 11:16 a.m., Steven Yen wrote:
Thanks. Can you kindly tell me what to read to do it the "standard way"?
Start with ?INSTALL, and find more details in the
In RStudio, I enter File -> Open Project -> and browse to open a .Rproj
file. Then, I click Build -> Build Binary Package. Thanks.
On 2020/4/28 下午 10:55, Duncan Murdoch wrote:
On 28/04/2020 9:56 a.m., Steven Yen wrote:
Thanks. I visited the Rtools web page and learned to run the
Thanks. Can you kindly tell me what to read to do it the "standard way"?
Also, where can I find file .Renviron.
On 2020/4/28 下午 11:08, Duncan Murdoch wrote:
On 28/04/2020 11:02 a.m., Steven Yen wrote:
In RStudio, I enter File -> Open Project -> and browse to open a .Rproj
fil
I am new to R. Have a naive question about the boa package.
I loaded the package as instructed, and after entering
R > boa.menu()
I could never got the ready prompt (R hung).
Can someone help? Thanks.
__
R-help@r-project.org mailing list
https://stat.
data)
I get summary statistics for a dozen variables from a file that
appeared to reside in z:/R.
Am I not supposed to set the working directory by the line above
(which brings me to my preferred working directory each time I run R)?
At 06:05 PM 11/15/2011, Steven Yen wrote:
>Can someone help me
Can someone help me with this variable/data reading issue?
I read a csv file and transform/create an additional variable (called y).
The first set of commands below produced different sample statistics
for hw11$y and y
In the second set of command I renameuse the variable name yy, and
sample st
s.
At 09:26 PM 11/15/2011, Sarah Goslee wrote:
>Hi,
>
>The obvious answer is don't use attach() and you'll never have
>that problem. And see further comments inline.
>
>On Tue, Nov 15, 2011 at 6:05 PM, Steven Yen wrote:
> > Can someone help me with this variable/dat
is there a way to do element-by-element multiplication as in Gauss
and MATLAB, as shown below? Thanks.
---
a
1.000
2.000
3.000
x
1.0002.0003.000
2.0004.0006.000
3.0006
uch more
>difficult to see R's internal logic, which, while quirky, is useful
>at the end of the day.
>
>Michael
>
>PS - It's good form to cc the list at each step so others can follow
>along and contribute when I say something wrong. It also helps you
>get quicke
[1]) cov(x[3],x[2])
var(x[3]) And I like to do it with "apply". Thanks.
On 10/4/2024 6:35 PM, Rui Barradas wrote:
> Hello,
>
> If you have a numeric matrix or data.frame, try something like
>
> cov(mtcars)
>
> Hope this helps,
>
> Rui Barradas
>
>
> Às
On 10/4/2024 5:13 PM, Steven Yen wrote:
> Pardon me!!!
>
> What makes you think this is a homework question? You are not
> obligated to respond if the question is not intelligent enough for you.
>
> I did the following: two ways to calculate a covariance matrix but
&g
The following line calculates standard deviations of a column vector:
se<-apply(dd,1,sd)
How can I calculate the covariance matrix using apply? Thanks.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/l
gges wrote:
> Homework questions are not answered on this list.
>
> Best,
> Uwe Ligges
>
>
>
> On 04.10.2024 10:32, Steven Yen wrote:
>> The following line calculates standard deviations of a column vector:
>>
>> se&l
ctor element is zero,
it's only one value therefore it does not vary. A similar reasonong
can be applied to cov(x[1], x[2]), etc.
Hope this helps,
Rui Barradas
Às 12:14 de 04/10/2024, Steven Yen escreveu:
Hello
I have a vector:
set.seed(123) > n<-3 > x<-rnorm(n); x [1]
101 - 190 of 190 matches
Mail list logo