Apply the function
result <- condense_sequence(nums)
print(result)
# Output: "1, 3-5, 7-8, 12-15, 20"
Which appears to work well, though you may have other thoughts in mind /
edge cases this code does not cover.
Best,
Steven
On Fri, Feb 21, 2025 at 7:47 PM Dennis Fisher wrote:
>
Hi Eliana,
What model Mac are you using? Are you the owner?
Thanks,
Steven
On Wed, Jan 15, 2025, 1:45 PM Eliana Madison wrote:
> Good morning, I am currently trying to download R and RStudio to my MacOS
> 13.3 as it is a requirement for a statistics class I am taking this
> semest
Hi Edward,
R can indeed initiate electronic communication, e.g. by downloading new
libraries (`install.packages()`). You may be best off using a container.
Steven
On Fri, Dec 13, 2024, 10:25 AM Edward Woo via R-help
wrote:
> Hi,
>
> I am trying to download R version 3.6.1 onto m
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]
[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
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.
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)
ou
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 <
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
>
&
} 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?
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
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
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
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?
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
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
>
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?
>
&
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
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
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,
.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
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:
>
>
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
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
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
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/
just looking for ways to do this in a do loop, which requires
initialization (to 0's) of x and y. My struggle is not knowning length
of x until x1 is produced in the first of the loop. Thanks.
Steven
On 2/28/2024 6:22 PM, Eik Vettorazzi wrote:
Hi Steven,
It's not entirely clear what yo
("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
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)
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 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
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 d
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
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
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
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:
&g
Dear tinytex users
I install knitr and tinytex with the following line commands in RStudio
and it seems to work:
install.packages("knitr")
install.packages('tinytex')
In the long past I was told to also run the following lines but now they
do not seem to be needed.
#update.packages(ask = FA
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
p.s. But now I click some (but not all) .R file and cannot see the
source code.
On 4/6/2023 5:28 PM, Steven T. Yen wrote:
I updated to latest RStudio (RStudio-2023.03.0-386.exe) but
R would not run. Error message:
Error Starting R
The R session failed to start.
RSTUDIO VERSION
RStudio
I updated to latest RStudio (RStudio-2023.03.0-386.exe) but
R would not run. Error message:
Error Starting R
The R session failed to start.
RSTUDIO VERSION
RStudio 2023.03.0+386 "Cherry Blossom " (3c53477a, 2023-03-09) for Windows
[No error available]
I also tried RStudio 2022.12.0+353 --- same
Great, Thanks. Now I have many options.
Steven from iPhone
> On Feb 13, 2023, at 10:52 AM, Andrew Simmons wrote:
>
> What I meant is that that
>
> mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
>
> and
>
> mydata[!grepl("^yr", co
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:
>
>>
>> You could alternatively use
>>
>> x["V2"]
>>
>> which should be identical to x[, "V2", drop = FALSE], but some people don't
>> like that because it doesn't look like matrix indexing anymore.
>>
>>
>
In the line suggested by Andrew Simmons,
mydata <- mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
what does drop=FALSE do? Thanks.
On 1/14/2023 8:48 PM, Steven Yen wrote:
> Thanks to all. Very helpful.
>
> Steven from iPhone
>
>> On Jan 14, 2023, at
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 globbi
I have a data frame containing variables "yr3",...,"yr28".
How do I remove them with a wild cardsomething similar to "del yr*"
in Windows/doc? Thank you.
> colnames(mydata)
[1] "year" "weight" "confeduc" "confothr" "college"
[6] ...
[41] "yr3" "yr4" "yr5"
Dear,
I am having a lucky day. I am programming in RStudio and when I type
"black" (quotation signs included, the word turn into a word with black
ground. Couldn't get rid of the backgroundcopying to Word, Excel,
text editor and paste back to Rstudio, the word is still in black
background
nodiscfem 0.51 0.50
discfem 0.49 0.50
notradgrol 0.70 0.46
tradgrol 0.30 0.46
nofemnopol 0.80 0.40
femnopol 0.20 0.40
nopreshurt 0.66 0.47
On 11/22/2022 3:08 PM, Ivan Krylov wrote:
On Tue, 22 Nov 2022 08:15:57 +0800
"Steven T. Yen" wrote:
Thanks to
00.32
[86,] 1.3000.74
R will still print 3 decimal places for the third column since it
wants them to be of the same format, but each number is 2 sigfigs.
On Mon, Nov 21, 2022 at 3:41 PM Steven T. Yen via R-help
wrote:
Hi, I have two variables with 86 observations each. Below I print
Hi, I have two variables with 86 observations each. Below I print with
the print command with digit=2. But, I am getting three decimal places
for my first variable and two for the second. Please help. Thanks.
> cbind(Mean,Std.dev)
Mean Std.dev
[1,] 0.3107966 0.462820
[2,] 0.1
ycontrol$gradtol)
#works
msg<-with(mycontrol,sprintf(fmt_string,tol,reltol,steptol,gradtol))
cat(msg)
tol = 0.0e+00
reltol = 0.0e+00
steptol = 1.0e-08
gradtol = 1.0e-10
Thids has worked great! Thanks again to all.
Steven Yen
On 10/25/2022 3:23 AM, Rui Barradas wrote:
Às 16:21 de 24/10
age.
msg <- sprintf("(tol,reltol,steptol,gradtol): %E %E %E %E",
mycontrol$tol,mycontrol$reltol,mycontrol$steptol,mycontrol$gradtol)
message(msg)
Hope this helps,
Rui Barradas
Às 14:25 de 24/10/2022, Steven T. Yen escreveu:
Thank, Boris and Ivan.
The simple command suggested b
))
(tol,reltol,steptol,gradtol): 0.00E+00 0.00E+00 1.00E-08
1.00E-12
This works great. Thanks.
Steven
On 10/24/2022 9:05 PM, Boris Steipe wrote:
??? t() is the transpose function. It just happens to return your list
unchanged. The return value is then printed to conso
I have a "list" containing four elements, as shown below:
> t(mycontrol)
tol reltol steptol gradtol
[1,] 0 0 1e-08 1e-12
Printing this in a main program causes no problem (as shown above).
But, using the command t(mycontrol) the line gets ignored. Any idea? Thank
rew for help!
On 10/13/2022 10:30 PM, Bill Dunlap wrote:
> Do you have another function called "cat" in scope? (with an argument
> called "j")? Before calling cat("...") call print(cat) and
> print(find("cat")).
>
> -Bill
>
>
> On
No. I just run the subroutine containing those line, with result going to
destination go probit1.r.me.it and printed it.
Steven from iPhone
> On Oct 13, 2022, at 5:09 PM, Jim Lemon wrote:
>
> Have you assigned the valuie of goprobit1.r.me.kr to "fortytwo", or
> ind
,ndraws=5);
goprobit1.r.me.kr
Error in cat("\nMarginal and Discrete Effects of Gen Ordered Logit /
Probit Probabilities", :
unused arguments (fortytwo, "\n")
On 10/13/2022 4:46 PM, Jim Lemon wrote:
Hi Steven & Erin,
This works:
fortytwo<-42
cat("\nMa
and Discrete Effects of Gen Ordered Logit / Probit
Probabilities",
"\n\nlogistic =",logistic)
j<-grep(".one\\b",rownames(out))
out<-out[-j,]
return(out)
}
Steven from iPhone
> On Oct 13, 2022, at 3:37 PM, Erin Hodgess wrote:
>
> t<-abs(me)/se; p<-2*(
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
te Effects of Gen Ordered Logit /
Probit Probabilities") :
argument "j" is missing, with no default
>
On 10/13/2022 3:37 PM, Erin Hodgess wrote:
> Hi Steven:
>
> Do you have a variable called logistic, please? I think that might be
> the culprit.
>
> Tha
I have had an issue with printing (with cat) in a subroutine for which I
do not have a applicable example, but I am still hoping to get some
help. In the following, the first block of code works fine.
...
t<-abs(me)/se; p<-2*(1-pt(t,nrow(x)))
sig<-my.sig.levels(p)
out<-data.frame(round(cbind(m
to start looking for a problem. Hand
calculation can use pencil and paper or Excel or other tools. It is a tedious
task but very effective.
Tim
-----Original Message-
From: R-help On Behalf Of Ivan Krylov
Sent: Friday, September 9, 2022 5:03 AM
To: Steven T. Yen
Cc: R-help Mailing List
(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
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
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 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
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
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
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.
On 2021/5/16 上午 11:52, Robert Knight wrote:
> Hi Steven,
>
> You make great sense wanting to have labels for your variables. When
> in RStudio, the little arrow beside "mydata" in the Environment tab
> can be clicked and you see all the variables there. An
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
about variable
definitions) or whether there are better ways. Thanks!
Steven
rm(list=ls())
n<-6
mydata<-data.frame(id=1:n,
age=floor(rnorm(n,25,10)),
yrmarry=floor(rnorm(n,5,2)))
var.labels<-c(id = "Individual ID",
; 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
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,
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",
"
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
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
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
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
`%!%` <- 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 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
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)+
res
> }
> E.g.,
> > data.frame(XXX=c(95,93,10,20), YYY=c(55,66,93,98)) %>% mutate( f1(YYY,
> 90, lup))
> XXX YYY YYY_mm
> 1 95 55 55
> 2 93 66 66
> 3 10 93 3
> 4 20 98 NA
>
> -Bill
>
> On Tue, Jan 19, 2021 at 10:24 AM Ste
rt Gunter
> >
> >"The trouble with having an open mind is that people keep coming along
> >and
> >sticking things into it."
> >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >
> >
> >On Tue, Jan 19, 2021
t for a more useful reply.
>
> Cheers,
> Bert
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On
I am having some problems with what seems like a pretty simple issue. I
have some data where I want to convert numbers. Specifically, this is
cancer data and the size of tumors is encoded using millimeter
measurements. However, if the actual measurement is not available the
coding may imply a less
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
v + nongov + married
> eq2<-my.formula(y="cig",x=xx); eq2
cig ~ c("hhsize", "urban", "male", "age3045", "age4659", "age60",
"highsc", "tert", "gov", "nongov", "married"
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.
.
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
I constantly define variable lists from a data frame (e.g., to define a
regression equation). Line 3 below does just that. Placing each variable
name in quotation marks is too much work especially for a long list so I
do that with line 4. Is there an easier way to accomplish thisto
define a
posting a reproducible example, you're wasting everyone's time.
Duncan Murdoch
On 30/11/2020 6:06 a.m., Steven Yen wrote:
No, sorry. Line 1 below did not print for me and I had to go around and
do line 2 to print:
me.probit(obj)
v<-me.probit(obj); v
A puzzle.
On 2020/11/30 下午
No, sorry. Line 1 below did not print for me and I had to go around and
do line 2 to print:
me.probit(obj)
v<-me.probit(obj); v
A puzzle.
On 2020/11/30 下午 07:00, Duncan Murdoch wrote:
On 30/11/2020 5:41 a.m., Stefan Evert wrote:
On 30 Nov 2020, at 10:41, Steven Yen wrote:
Thanks
.../R/oprobit.R")
it did print. I do not understand.
On 2020/11/30 下午 06:41, Stefan Evert wrote:
On 30 Nov 2020, at 10:41, Steven Yen wrote:
Thanks. I know, my point was on why I get something printed by simply doing
line 1 below and at other occasions had to do line 2.
me.probit(obj)
T
Thanks. I know, my point was on why I get something printed by simply
doing line 1 below and at other occasions had to do line 2.
me.probit(obj)
v<-me.probit(obj); v
On 2020/11/30 下午 05:33, Jim Lemon wrote:
Hi Steven,
You seem to be assigning the result of me.oprobit(obj) to v instead
I hope I can get away without presenting a replicable set of codes
because doing so would impose burdens.
I call a function which return a data frame, with the final line
return(out)
In one case the data frame gets printed (similar to a regression
printout), with simply a call
me.probit(obj
1 - 100 of 820 matches
Mail list logo