[R] RQuantLib installation problem
In my mac, using brew, I installed boost and quantlib packages. But installation of RQuantLib errored out because R could not find libgfortran.5.dylib My mac does have this file, but in a different location. Is there a simple fix to install RQuantLib? Thanks, Naresh ~ $ ls /usr/local/gfortran/lib/libgfortran.5.dylib /usr/local/gfortran/lib/libgfortran.5.dylib > install.packages("RQuantLib", repos = "https://cran.r-project.org;) Installing package into ‘/usr/local/lib/R/4.1/site-library’ (as ‘lib’ is unspecified) trying URL 'https://cran.r-project.org/src/contrib/RQuantLib_0.4.17.tar.gz' Content type 'application/x-gzip' length 193331 bytes (188 KB) == downloaded 188 KB dyld[29996]: Library not loaded: /usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib Referenced from: <383F3774-06DE-3792-AA2C-C9D6B37A2D89> /usr/local/Cellar/r/4.1.2/lib/R/lib/libR.dylib Reason: tried: '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/Cellar/r/4.1.2/lib/R/lib/libgfortran.5.dylib' (no such file), '/usr/local/Cellar/openjdk/17.0.2/libexec/openjdk.jdk/Contents/Home/lib/server/libgfortran.5.dylib' (no such file) /usr/local/Cellar/r/4.1.2/lib/R/bin/INSTALL: line 34: 29995 Done echo 'tools:::.install_packages()' 29996 Abort trap: 6 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args} The downloaded source packages are in ‘/private/var/folders/97/5377j5_d207fshvjz_pz7szwgn/T/Rtmp9gBaE0/downloaded_packages’ Warning message: In install.packages("RQuantLib", repos = "https://cran.r-project.org;) : installation of package ‘RQuantLib’ had non-zero exit status __ 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, minimal, self-contained, reproducible code.
Re: [R] predict function type class vs. prob
On Fri, 22 Sep 2023 10:12:51 + "Milbert, Sabine (LGL)" wrote: > Dear R Help Team, In addition to other misapprehensions that others have pointed out, you seem to have a fundamental misunderstanding of R-help (and perhaps of R). There is no such thing as the "R Help Team". This is a *mailing list*, to which some R users subscribe, and from time to time contribute. All advice given is the personal opinion of the contributor. It has no official status, and may or may not be sound advice, depending on the contributor. (Those contributors who have responded to your enquiry so far may be relied upon to give sound advice.) cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 __ 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, minimal, self-contained, reproducible code.
Re: [R] How to import an excel data file
On 23/09/2023 3:35 p.m., Ivan Krylov wrote: В Fri, 22 Sep 2023 23:10:58 + "Parkhurst, David" пишет: Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv How exactly---What _, etc.---do I type with its name in the read_excel() function? In RGui on Windows, file.choose() opens a dialog window letting the user choose a file interactively. Do you get a similar prompt if you run file.choose() in R.app? Choose the file, and it will return a string that would be most certainly suitable for read.csv(), read_excel(), and other functions that accept file paths. file.choose() exists on all platforms. choose.files() only exists on Windows. Duncan Murdoch __ 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, minimal, self-contained, reproducible code.
Re: [R] How to import an excel data file
В Fri, 22 Sep 2023 23:10:58 + "Parkhurst, David" пишет: > Its location in my Mac files is > DFPfiles/ae/FriendsMonroe/KurtzData.csv How exactly---What _, > etc.---do I type with its name in the read_excel() function? In RGui on Windows, file.choose() opens a dialog window letting the user choose a file interactively. Do you get a similar prompt if you run file.choose() in R.app? Choose the file, and it will return a string that would be most certainly suitable for read.csv(), read_excel(), and other functions that accept file paths. -- Best regards, Ivan __ 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, minimal, self-contained, reproducible code.
Re: [R] predict function type class vs. prob
That's embarrassing. Apologies for the garbles HTML posting. I'll see if this is more readable: On 9/23/23 05:30, Rui Barradas wrote: Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: Dear R Help Team, My research group and I use R scripts for our multivariate data screening routines. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. On 9/23/23 05:30, Rui Barradas wrote: > Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: >> Dear R Help Team, >> >> My research group and I use R scripts for our multivariate data screening routines. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. In addition to Rui's correction to this misstatement, the caret package is really a meta package that attempts to implement an umbrella framework for a vast array of tools from a wide variety of sources. It is an immense effort but not really a part of the core R project. The correct place to file issues is found in the DESCRIPTION file: URL: https://github.com/topepo/caret/ BugReports: https://github.com/topepo/caret/issues If you use `str` on an object constructed with caret, you discover that the `predict` function is actually not in the main workspace but rather embedded in the fit-object itself. I think this is a rather general statement regarding the caret universe, and so I expect that your fit -objects can be examined for the code that predict.train will use with this approach. Your description of your analysis methods was rather incompletely specified, and I will put an appendix of "svm" methods that might be specified after my demonstration using code. (Note that I do not see a caret "weights" hyper-parameter for the "svmLinear" method which is actually using code from pkg:kernlab.) library(caret) svmFit <- train(Species ~ ., data = iris, method = "svmLinear", trControl = trainControl(method = "cv")) class(svmFit) #[1] "train" "train.formula" str(predict(svmFit)) Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... str(svmFit) #---screen output- List of 24 $ method : chr "svmLinear" $ modelInfo :List of 13 ..$ label : chr "Support Vector Machines with Linear Kernel" ..$ library : chr "kernlab" ..$ type : chr [1:2] "Regression" "Classification" ..$ parameters:'data.frame': 1 obs. of 3 variables: .. ..$ parameter: chr "C" .. ..$ class : chr "numeric" .. ..$ label : chr "Cost" ..$ grid :function (x, y, len = NULL, search = "grid") ..$ loop : NULL ..$ fit :function (x, y, wts, param, lev, last, classProbs, ...) ..$ predict :function (modelFit, newdata, submodels = NULL) ..$ prob :function (modelFit, newdata, submodels = NULL) ..$ predictors:function (x, ...) ..$ tags : chr [1:5] "Kernel Method" "Support Vector Machines" "Linear Regression" "Linear Classifier" ... ..$ levels :function (x) ..$ sort :function (x) $ modelType : chr "Classification" # large amount of screen output omitted-- # note that the class of svmFit$modelInfo$predict is 'function' # and its code at least to this particular svm method of which there are about 10! svmFit$modelInfo$predict # screen output -- function (modelFit, newdata, submodels = NULL) { svmPred <- function(obj, x) { hasPM <- !is.null(unlist(obj@prob.model)) if (hasPM) { pred <- kernlab::lev(obj)[apply(kernlab::predict(obj, x, type = "probabilities"), 1, which.max)] } else pred <- kernlab::predict(obj, x) pred } out <- try(svmPred(modelFit, newdata), silent = TRUE) if (is.character(kernlab::lev(modelFit))) { if (class(out)[1] == "try-error") { warning("kernlab class prediction calculations failed; returning NAs") out <- rep("", nrow(newdata)) out[seq(along = out)] <- NA } } else { if (class(out)[1] == "try-error") { warning("kernlab prediction calculations failed; returning NAs") out <- rep(NA, nrow(newdata)) } } if (is.matrix(out)) out <- out[, 1] out } -- David >> Through internal research, we were unable to find the reason for this and have decided to contact your help team with the following issue: >> >> The predict() function is used once to predict the class membership of a new sample (type = "class") on a trained linear SVM model for distinguishing two classes (using the caret package). It is then used to also examine the probability of class membership (type = "prob"). Both are then presented in an R shiny output. Within the routine, we noticed two samples (out of 100+) where the class prediction and probability prediction did not match. The prediction probabilities of one class (52%) did not match the class membership
Re: [R] predict function type class vs. prob
В Fri, 22 Sep 2023 10:12:51 + "Milbert, Sabine (LGL)" пишет: > PS: If this is an issue based on the model training function of the > caret package and therefore not your responsibility, please let us > know. Indeed, as Rui Barradas said, predict() is a generic function. Calling it with your model as an argument resolves to a function in the caret package. It's hard to say without looking at your code and data (the R-help posting guide has some hints on how to prepare a reproducible example), but I think that the caret package fits your linear SVM models using kernlab::ksvm, and then predict() resolves to a combination of kernlab::predict (potentially with the argument type = "probabilities") and kernlab::lev. Try replicating your results using just the kernlab package. -- Best regards, Ivan __ 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, minimal, self-contained, reproducible code.
Re: [R] predict function type class vs. prob
On 9/23/23 05:30, Rui Barradas wrote: > Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: >> Dear R Help Team, >> >> My research group and I use R scripts for our multivariate data >> screening routines. During routine use, we encountered some >> inconsistencies within the predict() function of the R Stats Package. In addition to Rui's correction to this misstatement, the caret package is really a meta package that attempts to implement an umbrella framework for a vast array of tools from a wide variety of sources. It is an immense effort but not really a part of the core R project. The correct place to file issues is found in the DESCRIPTION file: URL: https://github.com/topepo/caret/ BugReports: https://github.com/topepo/caret/issues If you use `str` on an object constructed with caret, you discover that the `predict` function is actually not in the main workspace but rather embedded in the fit-object itself. I think this is a rather general statement regarding the caret universe, and so I expect that your fit -objects can be examined for the code that predict.train will use with this approach. Your description of your analysis methods was rather incompletely specified, and I will put an appendix of "svm" methods that might be specified after my demonstration using code. (Note that I do not see a caret "weights" hyper-parameter for the "svmLinear" method which is actually using code from pkg:kernlab.) library(caret) svmFit <- train(Species ~ ., data = iris, method = "svmLinear", trControl = trainControl(method = "cv")) class(svmFit) #[1] "train" "train.formula" str(predict(svmFit)) Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... str(svmFit) #---screen output- List of 24 $ method : chr "svmLinear" $ modelInfo :List of 13 ..$ label : chr "Support Vector Machines with Linear Kernel" ..$ library : chr "kernlab" ..$ type : chr [1:2] "Regression" "Classification" ..$ parameters:'data.frame': 1 obs. of 3 variables: .. ..$ parameter: chr "C" .. ..$ class : chr "numeric" .. ..$ label : chr "Cost" ..$ grid :function (x, y, len = NULL, search = "grid") ..$ loop : NULL ..$ fit :function (x, y, wts, param, lev, last, classProbs, ...) ..$ predict :function (modelFit, newdata, submodels = NULL) ..$ prob :function (modelFit, newdata, submodels = NULL) ..$ predictors:function (x, ...) ..$ tags : chr [1:5] "Kernel Method" "Support Vector Machines" "Linear Regression" "Linear Classifier" ... ..$ levels :function (x) ..$ sort :function (x) $ modelType : chr "Classification" # large amount of screen output omitted-- # note that the class of svmFit$modelInfo$predict is 'function' # and its code at least to this particular svm method of which there are about 10! svmFit$modelInfo$predict # screen output -- function (modelFit, newdata, submodels = NULL) { svmPred <- function(obj, x) { hasPM <- !is.null(unlist(obj@prob.model)) if (hasPM) { pred <- kernlab::lev(obj)[apply(kernlab::predict(obj, x, type = "probabilities"), 1, which.max)] } else pred <- kernlab::predict(obj, x) pred } out <- try(svmPred(modelFit, newdata), silent = TRUE) if (is.character(kernlab::lev(modelFit))) { if (class(out)[1] == "try-error") { warning("kernlab class prediction calculations failed; returning NAs") out <- rep("", nrow(newdata)) out[seq(along = out)] <- NA } } else { if (class(out)[1] == "try-error") { warning("kernlab prediction calculations failed; returning NAs") out <- rep(NA, nrow(newdata)) } } if (is.matrix(out)) out <- out[, 1] out } -- David >> Through internal research, we were unable to find the reason for this >> and have decided to contact your help team with the following issue: >> >> The predict() function is used once to predict the class membership >> of a new sample (type = "class") on a trained linear SVM model for >> distinguishing two classes (using the caret package). It is then used >> to also examine the probability of class membership (type = "prob"). >> Both are then presented in an R shiny output. Within the routine, we >> noticed two samples (out of 100+) where the class prediction and >> probability prediction did not match. The prediction probabilities of >> one class (52%) did not match the class membership within the predict >> function. We use the same seed and the discrepancy is reproducible in >> this sample. The same problem did not occur in other trained models >> (lda, random forest, radial SVM...). *Support Vector Machines with Boundrange String Kernel*(|method = 'svmBoundrangeString'|) For classification and regression using packagekernlabwith tuning parameters: * length (|length|, numeric) * Cost (|C|, numeric) *Support Vector Machines with Class Weights*(|method = 'svmRadialWeights'|) For classification using packagekernlabwith tuning parameters: * Sigma (|sigma|, numeric) * Cost (|C|, numeric) * Weight (|Weight|, numeric) *Support
Re: [R] Mantel Haenszel test
?cor cor( M, t( M ) ) On September 23, 2023 7:56:29 AM PDT, tgs77m--- via R-help wrote: >Colleagues, > >I am trying to write a script for the Mantel Haenszel test. > >For the MH test, the test statistic is chi-square (MH) = (W-1) * r^2 >Where W = sum of the case weights. This is straight forward. > >I'm having difficulty with r^2. The r^2 is the squared Pearson correlation >between row and column variables. > >Can anyone give me an example of the code which calculates the squared >Pearson correlation >between row and column variables? > >I am at a loss on how to do this. > >All the best, > >Thomas Subia > >__ >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, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. __ 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, minimal, self-contained, reproducible code.
Re: [ESS] How to Duplicate Previous Functionality/Workflow
On Fri, Sep 22, 2023, at 2:04 AM, Stephen J. Eglen wrote: >> (You probably didn't do this, because Docview isn't great for >> pdfs. The now abandoned package pdf-tools was a great option for >> reading pdfs inside Emacs). > > just to add a couple of comments: > > 1. pdf-tools was forked about 1-2 years ago, and now active at: > > https://github.com/vedang/pdf-tools > > It can be a bit fussy to install compared to most Emacs packages, > because of dependencies and the binaries it creates. However, I like it > and use it regularly. > Thanks, that's great news! pdf-tools was my preferred pdf viewer when it was active. I'll definitely check out the new fork ty __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] How to Duplicate Previous Functionality/Workflow
On 22 September 2023 at 07:04, Stephen J. Eglen via ESS-help wrote: | 2. A non-answer to the original question, but I prefer writing Makefiles | to build my documents, rather than using Emacs functionality. Emacs has | a good interface to running make (e.g. through M-x compile). Use | whatever is best for you, but just thought I'd mention it. Even simpler: I just rely on M-x compile-command (and its shortcut). On the first invocation I edit the out the existing stanza 'make -k' that would get invoked, and make it 'render.r filename.Rmd' to process the file I currently edit. Evince refreshed automagically. This is arguably a little pedestrian, but it takes me away from a land with a language I do not speak (elisp) to one I am rather comfortable in (scripts, shell scripts, littler aka 'r' scripts, Rscript, ...) that do the task. polymode has sometimes been finicky to install / updated, esp a few years ago, and is also (if I read the tea leaves correctly) one of the reasons we have not had an ESS release in five (5) years (which really is rather sad, at least to this long time user) but it has been working fine the last couple of years. I now settled on a mix of elpa-* packages I get from Ubuntu and a number of 'directly from elpa/melpa' packages. By and large it is still a great editing experience. I would guestimate that for the last decade I wrote most output appearing as html (ie course website) and more frequently pdf (slides for talks or lectures, short papers) in it. Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[R] Mantel Haenszel test
Colleagues, I am trying to write a script for the Mantel Haenszel test. For the MH test, the test statistic is chi-square (MH) = (W-1) * r^2 Where W = sum of the case weights. This is straight forward. I'm having difficulty with r^2. The r^2 is the squared Pearson correlation between row and column variables. Can anyone give me an example of the code which calculates the squared Pearson correlation between row and column variables? I am at a loss on how to do this. All the best, Thomas Subia __ 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, minimal, self-contained, reproducible code.
Re: [R] predict function type class vs. prob
Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: Dear R Help Team, My research group and I use R scripts for our multivariate data screening routines. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. Through internal research, we were unable to find the reason for this and have decided to contact your help team with the following issue: The predict() function is used once to predict the class membership of a new sample (type = "class") on a trained linear SVM model for distinguishing two classes (using the caret package). It is then used to also examine the probability of class membership (type = "prob"). Both are then presented in an R shiny output. Within the routine, we noticed two samples (out of 100+) where the class prediction and probability prediction did not match. The prediction probabilities of one class (52%) did not match the class membership within the predict function. We use the same seed and the discrepancy is reproducible in this sample. The same problem did not occur in other trained models (lda, random forest, radial SVM...). Is there a weighing of classes within the prediction function or is the classification limit not at 50%/a majority vote? Or do you have another explanation for this discrepancy, please let us know. PS: If this is an issue based on the model training function of the caret package and therefore not your responsibility, please let us know. Thank you in advance for your support! Yours sincerely, Sabine Milbert [[alternative HTML version deleted]] __ 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, minimal, self-contained, reproducible code. Hello, I cannot tell what is going on but I would like to make a correction to your post. predict() is a generic function with methods for objects of several classes in many packages. In base package stats you will find methods for objects (fits) of class lm, glm and others, see ?predict. The method you are asking about is predict.train, defined in package caret, not in package stats. to see what predict method is being called, check class(your_fit) Hope this helps, Rui Barradas __ 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, minimal, self-contained, reproducible code.
Re: [R] How to import an excel data file
Hi David, If you're using RStudio, I'd encourage the use of R Projects, with a new project for each analysis, even if you only do one every few years. That would also correspond to a new directory for each analysis, which many also find helpful. The package 'here' [install.packages("here")] then uses the .Rproj file to set file paths within each project. You can place your data somewhere within the parent directory of the project and use here::here("relative/path/to/my_file.csv") to tell R where the file is. It sounds like a trivial step, but it really can make referring to files on disk like this much easier. I'm not sure what the best parent folder would be for your analysis, but assuming it's FriendsMonroe, you would start a new R Project in that directory, keep all of your scripts in that directory, and refer to the file using here::here("KurtzData.csv") I do hope that helps, Stevie On Sat, 23 Sept 2023 at 17:53, Parkhurst, David wrote: > I know I should save it as a .csv file, which I have done. > I’m told I should use the read_excel() function from the readxl package. > My question is, how do I express the location of the file. The file is > named KurtzData.csv. > Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv > How exactly---What “, etc.---do I type with its name in the read_excel() > function? > It’s been a long time since I’ve used R. > Thanks for any help. > > > > > > > [[alternative HTML version deleted]] > > __ > 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, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ 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, minimal, self-contained, reproducible code.
Re: [R] How to import an excel data file
Are you sure that read.csv() can't read your data? [If you depend on extra packages you might want to consider using the 'groundhog' package so that you can be more confident of reproducing your work in a year or two.] You said that your question is how you should write the name of the file in your call to read.. > ?read.csv ... file the name of the file which the data are to be read from. ... If it does not contain an _absolute_ path, the file name is _relative_ to the current working directory, 'getwd()'. Tilde-expansion is performed where supported. "Tilde-expansion" refers to a common UNIX convention of replacing ~/ at the beginning of a file name by $HOME/ where $HOME is your home directory, and ~bongiwe/ by $HERS/ where $HERS holds the absolute name of user bongiwe's home directory. This is actually a shell convention, not an operating system kernel convention, but R is telling us "I can do that too". So for example to refer to one of my data files I might do jan17 <- read.csv("~/Data/Weather/2017-Jan.dat") "DFPfiles/ae/FriendsMonroe/KurtzData.csv" is NOT the location of the file on your system. It is PART of the location. We can be sure of that because it does not begin with a slash. So it is not an absolute file name. There is some value $DIR such that $DIR is an absolute file name and it names a directory and "$DIR/DFPfiles/ae/FriendsMonroe/KurtzData.csv" really IS the location of the file on your system. If the current working directory is (1) $DIR/DFPfiles/ae/FriendsMonroe/ use "KurtzData.csv" (2) $DIR/DFPfiles/ae/ use "FriendsMonroe/KurtzData.csv" (3) $DIR/DFPfilesuse "ae/FriendsMonroe/KurtzData.csv" (4) $DIR use "DFPfiles/ae/FriendsMonroe/KurtzData.csv" (5) $DIR/DFPfiles/ae/FriendsMonroe/SubDir use "../KurtzData.csv" I suspect that $DIR may be your home directory, in which case you can substitute ~ for $DIR. Of course the file argument can be anything that *evaluates* to a character string containing a file name (or it can be a URL or it can be a 'text connection'). Following the advice in read.csv, you might want to read the 'R Data Import/Export' manual. On Sat, 23 Sept 2023 at 20:23, Parkhurst, David wrote: > I know I should save it as a .csv file, which I have done. > I’m told I should use the read_excel() function from the readxl package. > My question is, how do I express the location of the file. The file is > named KurtzData.csv. > Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv > How exactly---What “, etc.---do I type with its name in the read_excel() > function? > It’s been a long time since I’ve used R. > Thanks for any help. > > > > > > > [[alternative HTML version deleted]] > > __ > 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, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ 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, minimal, self-contained, reproducible code.
Re: [R] How to import an excel data file
Dear David, I also use excel files for R. This is what I do install.packages("readxl") library(readxl) mydata=read_excel('mydata.xlsx') Hope this helps. Best, Maria Στις Σάββατο 23 Σεπτεμβρίου 2023 στις 09:23:43 π.μ. GMT+1, ο χρήστης Parkhurst, David έγραψε: I know I should save it as a .csv file, which I have done. I�m told I should use the read_excel() function from the readxl package. My question is, how do I express the location of the file. The file is named KurtzData.csv. Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv How exactly---What �, etc.---do I type with its name in the read_excel() function? It�s been a long time since I�ve used R. Thanks for any help. [[alternative HTML version deleted]] __ 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, minimal, self-contained, reproducible code. __ 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, minimal, self-contained, reproducible code.
[R] How to import an excel data file
I know I should save it as a .csv file, which I have done. I�m told I should use the read_excel() function from the readxl package. My question is, how do I express the location of the file. The file is named KurtzData.csv. Its location in my Mac files is DFPfiles/ae/FriendsMonroe/KurtzData.csv How exactly---What �, etc.---do I type with its name in the read_excel() function? It�s been a long time since I�ve used R. Thanks for any help. [[alternative HTML version deleted]] __ 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, minimal, self-contained, reproducible code.