Re: [R] Printout and saved results

2024-03-25 Thread Steven Yen
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 subroutin

[R] Printout and saved results

2024-03-25 Thread Steven Yen
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?

Re: [R] Initializing vector and matrices

2024-02-29 Thread Steven Yen
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/29/20

Re: [R] [EXT] Initializing vector and matrices

2024-02-29 Thread Steven Yen
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. What if I do not kno

Re: [R] Initializing vector and matrices

2024-02-28 Thread Steven Yen
t;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 lines

[R] Initializing vector and matrices

2024-02-28 Thread 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. What if I do not know initially the length/dimension of the vector/matrix? All I want is to add up (accumulate) 

[R] Including an external set of coded

2024-02-20 Thread Steven Yen
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

Re: [R] Looping

2024-02-20 Thread Steven Yen
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

[R] Looping

2024-02-18 Thread Steven Yen
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]]

[R] Concordance and Kendall's tau in copula

2023-11-06 Thread Steven Yen
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 commented

[R] Yext in parentheses.

2023-10-26 Thread Steven Yen
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

[R] Stacking matrix columns

2023-08-06 Thread Steven Yen
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 >

[R] Stacking matrix columns

2023-08-05 Thread Steven Yen
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 >

Re: [R] knitr and tinytex

2023-04-28 Thread Steven Yen
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

Re: [R] R does not run under latest RStudio

2023-04-06 Thread Steven Yen
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. > >

Re: [R] Removing variables from data frame with a wile card

2023-02-12 Thread Steven Yen
m the 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

Re: [R] Removing variables from data frame with a wile card

2023-02-12 Thread Steven Yen
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

Re: [R] Removing variables from data frame with a wile card

2023-01-14 Thread Steven Yen
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

Re: [R] cat in a subroutine

2022-10-13 Thread Steven Yen
ginal and Discrete Effects of Gen Ordered Logit / Probit >>> Probabilities","logisitic =",fortytwo,"\n") >>> j<-grep(".one\\b",c(".one\\a",".one\\b")) >>> >>> Marginal

Re: [R] cat in a subroutine

2022-10-13 Thread Steven Yen
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",

Re: [R] cat in a subroutine

2022-10-13 Thread Steven Yen
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,

Re: [R] Renaming multiple objects

2021-11-21 Thread Steven Yen
ist = 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 objects (each con

[R] Renaming multiple objects

2021-11-20 Thread Steven Yen
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

Re: [R] Wild cards for dataframes

2021-10-22 Thread Steven Yen
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,

[R] Wild cards for dataframes

2021-10-22 Thread Steven Yen
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.

Re: [R] [External] Subset command

2021-10-15 Thread Steven Yen
ion - -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 rejecte

Re: [R] Subset command

2021-10-15 Thread Steven Yen
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 PD

[R] Subset command

2021-10-15 Thread Steven Yen
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  & +   

Re: [R] Variable labels

2021-05-15 Thread Steven Yen
st 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>>

Re: [R] Variable labels

2021-05-14 Thread Steven Yen
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- From:

Re: [R] Variable labels

2021-05-14 Thread Steven Yen
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 scree

Re: [R] Variable labels

2021-05-13 Thread Steven Yen
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 can cl

[R] Variable labels

2021-05-12 Thread Steven Yen
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,    

Re: [R] grep

2021-05-08 Thread Steven Yen
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", "

[R] grep

2021-05-08 Thread Steven Yen
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?

Re: [R] Identifying column type

2021-04-11 Thread Steven Yen
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 >> nu

Re: [R] Identifying column type

2021-04-09 Thread Steven Yen
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

[R] Identifying column type

2021-04-09 Thread Steven Yen
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)

Re: [R] Column-by-column division

2021-03-03 Thread Steven Yen
n(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 column by s[2]. The

[R] Column-by-column division

2021-03-03 Thread Steven Yen
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 

[R] Calling procedures

2021-01-24 Thread Steven Yen
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)+

Re: [R] Defining partial list of variables

2021-01-05 Thread Steven Yen
   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

Re: [R] Defining partial list of variables

2021-01-05 Thread Steven Yen
v + nongov + married > eq2<-my.formula(y="cig",x=xx); eq2 cig ~ c("hhsize", "urban", "male", "age3045", "age4659", "age60",     "highsc", "tert", "gov", "nongov", "married"

Re: [R] Defining partial list of variables

2021-01-05 Thread Steven Yen
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.

Re: [R] Defining partial list of variables

2021-01-05 Thread Steven Yen
. 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

[R] Defining partial list of variables

2021-01-04 Thread Steven Yen
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

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
: By not 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 下午 07:00, Dun

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
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

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
.../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

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
ead of printing it. By appending ";v" tp that command line, you implicitly call "print". Jim On Mon, Nov 30, 2020 at 7:15 PM Steven Yen wrote: I hope I can get away without presenting a replicable set of codes because doing so would impose burdens. I call a function wh

[R] Printing upon calling a function

2020-11-30 Thread Steven Yen
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

Re: [R] Language environment

2020-11-17 Thread Steven Yen
Thanks. YES, include the line Sys.setenv(LANG="en"); in my Rprofile file and it worked. On 2020/11/18 上午 12:43, Jeff Newmiller wrote: put it in your .Rprofile file. Read the R Installation and Administration Manusl for more info. On November 17, 2020 5:00:06 AM PST, Steven Yen wr

[R] Language environment

2020-11-17 Thread Steven Yen
In R, I was able to set the language environment by fixing the line in file "C:\Program Files\R\R-4.0.3\etc\Rconsole", line 70 below, set language to EN: language = EN In RStudio, I am not able to do that, except to include the line Sys.setenv(LANG="en"); in every one of my program file.

Re: [R] [External] Re: unable to access index for repository...

2020-10-08 Thread Steven Yen
autocorrect is crazy > On Oct 9, 2020, at 4:28 AM, Arne Henningsen wrote: > > Hi Steven > > Which optimisation algorithms in maxLik work better under R-3.0.3 than > under the current version of R? > > /Arne > >> On Thu, 8 Oct 2020 at 21:05, Steven Yen wrote: >

Re: [R] [External] Re: unable to access index for repository...

2020-10-08 Thread Steven Yen
ssue is >> that important to you. Such is the nature of volunteer-developed open source >> software... so support your local experts. >> >>> On October 8, 2020 10:22:54 AM PDT, Steven Yen wrote: >>> Thanks for the help. I have a reason to continue with R-3.0.3.

Re: [R] unable to access index for repository...

2020-10-08 Thread Steven Yen
r .zip file from CRAC Archive, right. So, this will always work for me? Thank you all !! If there are more direct options that work, I would still be interested to know. Steven Yen On 2020/10/9 上午 12:49, Duncan Murdoch wrote: Don't choose a mirror.  That will override the repos choice. Do update

Re: [R] unable to access index for repository...

2020-10-08 Thread Steven Yen
But since you're using an obsolete version of R, it shouldn't surprise you that it has bugs that nobody else is seeing.) Duncan Murdoch On 08/10/2020 11:54 a.m., Steven Yen wrote: Thanks. You gentlemen please tell me what this means. In R (outside of RStudio) I ran: install.packages("aod")

Re: [R] unable to access index for repository...

2020-10-08 Thread Steven Yen
warning but it went on to try https://cran-archive.r-project.org/bin/windows/contrib/3.0/aod_1.3.zip and it worked. See log below. I expect to continue to use R-3.0.3 for a while and I very much like this to become a routine. Thank you all. Steven Yen > install.packages("aod") Warnin

Re: [R] unable to access index for repository...

2020-10-05 Thread Steven Yen
b.url argument. Best, Uwe Ligges On 05.10.2020 10:47, Steven Yen wrote: Thanks for the help. I do update to the latest R-4.0.2. As I said, for reasons that's hard to explain, some of my tasks are better handled with an older version of R, in this case R-3.0.3. Please just help me ins

Re: [R] unable to access index for repository...

2020-10-05 Thread Steven Yen
realy consider to update > to 4.0.2. > > Best, > Uwe Ligges > > > > > On 05.10.2020 09:56, Steven Yen wrote: >> I had to install/use an older version of (R-3.0.3) for a reason. While >> installing a package from CRAN (either in RStudio or R), I received the &

[R] unable to access index for repository...

2020-10-05 Thread Steven Yen
I had to install/use an older version of (R-3.0.3) for a reason. While installing a package from CRAN (either in RStudio or R), I received the following warning message saying unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.0. See message below. In this

Re: [R] Calling a procedure

2020-09-20 Thread Steven Yen
iables in with the same  order as the formal > arguments, then you > better  name them as you send them in. > > > > > > On Sun, Sep 20, 2020 at 7:23 AM Steven Yen <mailto:st...@ntu.edu.tw>> wrote: > > > Thanks. So, to be safe, alway

Re: [R] Calling a procedure

2020-09-20 Thread Steven Yen
> > f <- function(x, y = 0, z = FALSE){ >   a <- x >   b <- y >   d <- z >   list(a = a, b = b, d = d) > } > z <- 2 > f(1, z) > f(1, z = z) > > > Hope this helps, > > Rui Barradas > > Às 11:11 de 20/09/20, Steven Yen escreveu: >>

[R] Calling a procedure

2020-09-20 Thread Steven Yen
Can someone tell me a proper call to a procedure, in this case, pnorm. In what follows, I had expected a = b, but they are not equal. What are wrong with first call and second call? Thank you! try<-function(x,log.p=FALSE){ a<-pnorm(x,log.p)   # first call b<-pnorm(x,log.p=log.p) # second

Re: [R] Rtools required

2020-04-29 Thread Steven Yen
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

Re: [R] Rtools required

2020-04-29 Thread Steven Yen
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

Re: [R] Rtools required

2020-04-29 Thread Steven Yen
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

Re: [R] Rtools required

2020-04-29 Thread Steven Yen
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"

[R] Using older version of R

2019-12-20 Thread Steven Yen
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

Re: [R] Warning from installing packages in R3.6.1

2019-09-15 Thread Steven Yen
. 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

Re: [R] Warning from installing packages in R3.6.1

2019-09-15 Thread Steven Yen
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 the sam

[R] Warning from installing packages in R3.6.1

2019-09-14 Thread Steven Yen
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

[R] Plotting in R

2019-07-06 Thread Steven Yen
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

[R] Plotting in R

2019-07-06 Thread Steven Yen
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

Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
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 is kno

Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
>  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 was >&

Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
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

[R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
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.

Re: [R] Printing matrix/table in a procedure

2019-05-15 Thread Steven Yen
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 this h

[R] Printing matrix/table in a procedure

2019-05-15 Thread Steven Yen
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

[R] Printing vectrix

2019-03-24 Thread Steven Yen
I like to print a vector, wrapped by rows of 10. Below the first command below works for 20 numbers. The second command is ugly. How can I print the 25 numbers into 2 rows of ten plus a helf row of 5? Thanks. > x<-1:20; matrix(x,nrow=2,byrow=T) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]

[R] Installing package into...

2019-03-12 Thread Steven Yen
I install package using either the command line or Tools -> Install packages... (in RStudio) and get a non-fatal message saying... Installing package into ‘C:/Users/xuhaer/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) I know it is not a fatal message. But, is there a way to do a cleaner

Re: [R] Retrievable results in a procedure

2018-12-25 Thread Steven Yen
a base function try() so that's not a great > name for test functions. > > Sarah > > On Tue, Dec 25, 2018 at 8:47 AM Steven Yen <mailto:st...@ntu.edu.tw>> wrote: > > I would like to suppressed printing of retrievable results in a > procedure and to print only

[R] Retrievable results in a procedure

2018-12-25 Thread Steven Yen
I would like to suppressed printing of retrievable results in a procedure and to print only when retrieved. In line 10 below I call procedure "try" and get matrices A,B,C all printed upon a call to the procedure. I get around this unwanted printing by calling with v<-try(A,B) as in line 11.

[R] Random seed

2018-12-22 Thread Steven Yen
I have known from the old days to set a random seed of a LARGE ODD NUMBER. Now I read instructions of set.seed and it requires ANY INTEGER. Any idea? Or, does it matter. Thanks. -- st...@ntu.edu.tw (S.T. Yen) [[alternative HTML version deleted]]

Re: [R] Printing with cat in a procedure

2018-12-22 Thread Steven Yen
t;\nC = ") > print(C) > structure(list(A=A,B=B,C=C)) > } > > HTH, > Eric > > > On Sat, Dec 22, 2018 at 4:32 PM Steven Yen <mailto:st...@ntu.edu.tw>> wrote: > > How do I print a matrix running a procedure? In the code below, I > print &g

[R] Printing with cat in a procedure

2018-12-22 Thread Steven Yen
How do I print a matrix running a procedure? In the code below, I print with the cat command and get a vector (from A and C). A<-matrix(rpois(16,lambda=5),nrow=4,byrow=T) B<-diag(4) try5<-function(A,B){ C<-A+B cat("\nA =",A,"\nC = ",C) structure(list(A=A,B=B,C=C)) } v<-try5(A,B) v$C --

[R] Using apply

2018-10-30 Thread Steven Yen
I need help with "apply". Below, I have no problem getting the column sums. 1. How do I get the sum of squares? 2. In general, where do I look up these functions? Thanks. x<-matrix(1:10,nrow=5); x sum <- apply(x,2,sum); sum [[alternative HTML version deleted]]

Re: [R] Polygon

2018-10-21 Thread Steven Yen
David, Rui, and All: Greetings. 1. I need a helping hand with the polygon statement below so that I can have the area under the curve highlighted, between (z1,z2). 2. Is it possible to label the X-axis with in two scale, in the current z-scale and another, say x = (z+5)*2? Thank you. z1<- -1

[R] Graphing output

2018-10-09 Thread Steven Yen
Is it possible to release the file destination after sending it to a pdf file? Below, line 3 send the graph to a pdf file. I like to release the devise so that I can see result produced by line for on the console (screen). Thanks. x<-1:10 pdf("test1.pdf") # pdf {grDevices} boxplot(x) # This

Re: [R] Polygon

2018-10-02 Thread Steven Yen
Thanks!!! It did wonders. Steven On 10/3/2018 9:39 AM, David Winsemius wrote: >> On Oct 2, 2018, at 5:50 PM, Steven Yen wrote: >> >> Great. Thanks! It did wonders. >> 1. Is there a way to suppress the obvious tick stops (-3,-2,-1,0,1,2,3) >> and mark only the tick

Re: [R] Polygon

2018-10-02 Thread Steven Yen
Continue with > > > polygon(-rev(cord.x), rev(cord.y), col = 'skyblue') > > > Hope this helps, > > Rui Barradas > > Às 17:25 de 02/10/2018, Steven Yen escreveu: >> Can someone help me with polygon. The following codes are self-runnable >> and mark a shaded area un

[R] Polygon

2018-10-02 Thread Steven Yen
Can someone help me with polygon. The following codes are self-runnable and mark a shaded area under the standard normal curve in the x-range (-3,-1). Is there a way to also mark the area in (1,3), at the same time. That is, I want shaded areas in both tails. Thank you... === # Create data for

[R] Problem with Rtools version 3.5.0.4

2018-08-01 Thread Steven Yen
I am trying to build an R package with Rtools version 3.5.0.4 along with R-3.5.1 using the following  sequence of commands: File -> Open Project -> Build -> Build Binary Package I received the following error message: zip I/O error: No such file or directory zip error: Temporary file failure

[R] Package installation

2018-07-09 Thread Steven Yen
I have had trouble installing packages (e.g., car, aod) in some computers (such as computers in the student lab) but no problem in my own laptop. Installation typically goes through, but after I got out and back in R (and RStudios), the error message says "packages xxx not available". That is,

[R] Problem building binary data into library file

2018-04-26 Thread Steven Yen
I build binary data files into a library by placing the .rda files at the proper \data sub-folder before building the library with the following procedure: 1. File -> Open project 2. Build -> Build binary packages. This has worked up to 3 .rda files. Now, I add another .rda file to the folder.

[R] Documenting R package with Rd file

2018-03-14 Thread Steven Yen
I have trouble documenting an R package. In my .Rd file (sixth line below), I have uhat<-m%*%y but when the package is built (successfully), the matrix multiplication part does not show up in the documentation. The line become (missing %*% y) uhat<-m === \examples{ x<-c(1,2,3,4,5)

[R] Problem saving .RData file with save.image

2018-01-26 Thread Steven Yen
I am running R-3.0.3 on RStudio 1.1.183. I have recently gotten the following error message while saving an .RData file with the save.image command. I have not had this problem until recently. Help appreciated. === Error in save.image("bope1a.RData") : image could not be renamed and is left

Re: [R] Merging RData files

2018-01-16 Thread Steven Yen
Understood. In my case, a.RData and b.RData contain identical variables/data, plus simulation outputs from separate runs. The codes deliver what I need. Good to know the three lines work. Thank you. On 1/16/2018 8:06 PM, Duncan Murdoch wrote: > On 16/01/2018 6:33 AM, Steven Yen wrote: >&g

Re: [R] Merging RData files

2018-01-16 Thread Steven Yen
t not html, otherwise they can > be mangled. > > Cheers > Petr > >> -Original Message- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Yen >> Sent: Tuesday, January 16, 2018 9:44 AM >> To: r-help@r-project.org >> Su

  1   2   >