Re: [R] Sweave

2022-06-26 Thread R. Mark Sharp via R-help
nt. Mark R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant 7526 Meadow Green St. San Antonio, TX 78251 mobile: 210-218-2868 rmsh...@me.com > On Jun 26, 2022, at 9:28 AM, Naresh Gurbuxani > wrote: > > I want to use Sweave, but incorporate some feat

Re: [R] wanting to count instances of values in each cell of a series of simulated symmetric matrices of the same size

2021-06-01 Thread R. Mark Sharp via R-help
attention. I will provide more definitive feedback later. Mark R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant 7526 Meadow Green St. San Antonio, TX 78251 mobile: 210-218-2868 rmsh...@me.com > On Jun 1, 2021, at 10:44 PM, Bert Gunter wrote: > > C

[R] wanting to count instances of values in each cell of a series of simulated symmetric matrices of the same size

2021-06-01 Thread R. Mark Sharp via R-help
shipValues, kValue) kinshipCounts[length(kinshipCounts) + 1] <- 1 } else { kinshipCounts[kinshipValue] <- kinshipCounts[kinshipValue] + 1 } list(kinshipValues = kinshipValues, kinshipCounts = kinshipCounts) } Mark R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consult

Re: [R] File names for mac newby

2020-01-21 Thread R. Mark Sharp via R-help
. Though this absolute path will work, relative paths are often preferred. Mark R. Mark Sharp, Ph.D. rmsh...@me.com > On Jan 21, 2020, at 2:02 PM, Kevin Thorpe wrote: > > You would also need to drop the c: as that is a DOS/Windows thing. > > -- > Kevin E. Thorpe >

Re: [R] Increasing number of observations worsen the regression model

2019-05-26 Thread R. Mark Sharp via R-help
8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.6.0 R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant 7526 Meadow G

[R] Writing .nc files

2018-08-28 Thread R. Mark Sharp via R-help
Marco, Always post to the r-help list to have a better chance of finding someone that can help. There is a very nice tutorial that you should have found. See http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html#create-and-write-a-netcdf-file Mark R. Mark Sharp, Ph.D. Data

Re: [R] help

2018-08-10 Thread R. Mark Sharp via R-help
Marco, The error message indicates that nlon*nlat is 420 and that 1378620/420 has a remainder. For the matrix to form, all rows have to be complete. I am guessing you have at least one value incorrect among nlon, nlat, t or the length of fulldatav. Mark R. Mark Sharp, Ph.D. Data Scientist

Re: [R] Making objects global in a package

2018-07-13 Thread R. Mark Sharp via R-help
I would usually use a function for this. It may not be more R like, but it is more readable to me. If you want, to keep the columns in a file, you could have the function initialize itself on the first call. Mark R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant 7526

Re: [R] require help

2017-12-27 Thread R. Mark Sharp
Yadav, We need some information that is missing in order to help you. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Mark R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant

Re: [R] Timezone problem with 3.4.2

2017-11-30 Thread R. Mark Sharp
rom the system setting when R is configured with --with-internal-tzcode (the default on macOS). R. Mark Sharp, Ph.D. Data Scientist and Biomedical Statistical Consultant 7526 Meadow Green St. San Antonio, TX 78251 mobile: 210-218-2868 rmsh...@me.com > On Nov 30, 2017, at 8

Re: [R] Timezone problem with 3.4.2

2017-11-30 Thread R. Mark Sharp
Dennis, Brian Ripley pointed out shortly after 3.4.2 was released that the timezone was not being set correctly because of last minute changes to MacOS. You will have to install 3.4.3. I am waiting for the native installer, which will likely be out within a few days. Mark R. Mark Sharp, Ph.D

Re: [R] Comparing 2 dale columns

2017-08-23 Thread Mark Sharp
ctor to POSIXct so you do not necessarily ## need the as.Date. However, they are not the same and you may need the Date ## class. data$COL2 <- as.Date(strptime(data$COL2, format = "%m/%d/%y")) data$COL1 <- as.Date(strptime(data$COL1, format = "%m/%d/%y")) data data$Date_F

Re: [R] Package nleqslv ERROR

2017-08-09 Thread Mark Sharp
descriptive). Thus, when "x" inside your function gets the value of "startx" it becomes a numeric vector of length 2, which is then used to set the length of the numeric vector "f". As soon as the function tries to assign a value to f[3], R correctly throws an informativ

Re: [R] How to concatenate in R

2017-08-02 Thread Mark Sharp
://www.statmethods.net/management/merging.html Look at the readxl package. You may want to start with http://readxl.tidyverse.org. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Aug 2, 2017, at 6:06 AM, Swain, Subrat <subrat.sw...@aig.com> wrote: > > > Hi, > > I ha

Re: [R] Loading Rcmdr

2017-07-24 Thread Mark Sharp
stringi_1.1.5 grid_3.4.1 [45] tools_3.4.1 magrittr_1.5lazyeval_0.2.0 tibble_1.3.3 [49] Formula_1.2-2 cluster_2.0.6 MASS_7.3-47 Matrix_1.2-10 [53] data.table_1.10.4 minqa_1.2.4 rpart_4.1-11nnet_7.3-12 [57] nlme_3.1-131compiler_3.4.1 &g

Re: [R] Please help(urgent) - How to simulate transactional data for reliability/survival analysis

2017-07-05 Thread Mark Sharp
I am trying to figure out the algorithm you are using to calculate event_episodes, event_status, and start_minutes. Where does the 129600 come from? Why is the start(minutes) 0 for the last row instead of 40? Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jul 5, 2017, at 1:03

Re: [R] Please help(urgent) - How to simulate transactional data for reliability/survival analysis

2017-07-04 Thread Mark Sharp
to have with any guidance regarding how to use the other columns in you data set (e.g., the event(0/1)). Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jul 4, 2017, at 7:02 AM, Sunny Singha <sunnysingha.analyt...@gmail.com> > wrote: > > Thanks Boris and Bret,

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-27 Thread Mark Sharp
Make some small dataframes of just a few rows that illustrate the problem structure. Make a third that has the result you want. You will get an answer very quickly. Without a self-contained reproducible problem, results vary. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Mar 27, 2

Re: [R] Reversing table()

2017-03-17 Thread Mark Sharp
not return the vectors, those values that went into the function do not survive the trip. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Mar 17, 2017, at 7:23 AM, Kevin E. Thorpe <kevin.tho...@utoronto.ca> wrote: > > I am wondering if there is a way to undo the results of table().

Re: [R] Correlations Table of Items when compute Cronbach's Alpha

2017-02-21 Thread Mark Sharp
Have you looked at the help page? ?alpha::alpha See the section labeled Value. Look at output <- alpha(data, keys = c(1, 1, 1, -1)) output$r output$r.cor output$r.drop R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Feb 21, 2017, at 9:43 AM, Steven Stoline <sstol...@gmail.c

Re: [R] Failure to understand namespaces in XML::getNodeSet

2017-01-31 Thread Mark Sharp
harlesRiver) > ## I was surprised to find the incorrect namespace value did not matter > xml_find_all(no_ns, "//WorkSet//Description", ns = xml_ns(with_ns)) {xml_nodeset (1)} [1] MFIA 9-Plex (CharlesRiver) > ## This also seems to ignore the namespace argument value > xml_find_all(xml_ns_st

Re: [R] Failure to understand namespaces in XML::getNodeSet

2017-01-31 Thread Mark Sharp
all") : no applicable method for 'xml_find_all' applied to an object of class "character" R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jan 31, 2017, at 4:27 PM, Hadley Wickham <h.wick...@gmail.com> wrote: > > See the last example in ?xml2::xml_find_a

[R] Failure to understand namespaces in XML::getNodeSet

2017-01-31 Thread Mark Sharp
-xmlTreeParse(with_ns_xml, asText = TRUE, getDTD = FALSE, useInternalNodes = TRUE) ## The node is not found getNodeSet(l_with_ns_xml, "/WorkSet//Description") ## I attempt to provide the namespace, but fail. ns <- "http://labkey.org/etl/xml; names(n

Re: [R] Save a generated .txt (or .csv) file on the desktop

2017-01-30 Thread Mark Sharp
You can define the "file" argument in your call to write.csv() ## This will write out a file named "test_file.csv" to your working directory write.csv(tableau,file = "test_file.csv", row.names=FALSE) R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jan

Re: [R] Coverting HTML data into CSV

2017-01-20 Thread Mark Sharp
() with its argument being the object containing the HTML data. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jan 19, 2017, at 4:11 PM, El Polidan <polida...@hotmail.com> wrote: > > Good evening, > > > I need to convert and HTML data file into a CSV file. > > >

Re: [R] Urgent help

2016-12-27 Thread Mark Sharp
Please note that your message should be plain text and any attachments must be text and have a .txt extension. Your attached code was apparently removed because it did not have an extension of .txt. It is best to include your code within the body of the message. Mark R. Mark Sharp, Ph.D

Re: [R] Merging two columns of unequal length

2016-12-12 Thread Mark Sharp
I did not look at the code, but note the following. By definition, 1. You cannot highlight code in plan text, which is the format accepted by r-help. 2. You cannot have columns of different lengths in a dataframe. R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Dec 12, 2016, at 5:41

Re: [R] Alternative to "apply" in R 3.2.2

2016-11-11 Thread Mark Sharp
prod(c(7, 2, NA), na.rm = FALSE) [1] NA Mark R. Mark Sharp, Ph.D. Director of Data Science Core Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Nov 11, 2

Re: [R] lsa-cosine subscript out of bounds error

2016-10-28 Thread Mark Sharp
Anusha, You have written to r-help multiple times and are still using HTML and failing to provide a reproducible example of your problem. Please read and comply with the posting guide. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Oct 28, 2016, at 7:07 AM, Indhira, Anu

Re: [R] About converting files in R

2016-10-25 Thread Mark Sharp
Lily, Bob's suggestion is the best. You can also look at readBin(). Enter ?readBin at the R prompt. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Oct 25, 2016, at 4:40 PM, Bob Rudis <b...@rud.is> wrote: > > I'm afraid we'll need more information that that since the ans

Re: [R] using nested ifelse when i want to process values from more than 3 columns of data frame

2016-10-24 Thread Mark Sharp
t;all_false" kdata$target[kdata$H1 == 1 & kdata$H2 == 1 & kdata$H3 == 1 & kdata$H8 == 1] <- "all_true" Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Resea

Re: [R] function which returns number of occurrences of a pattern in string

2016-10-20 Thread Mark Sharp
Jan, Within the stringr package you can find the function str_count(). Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh

Re: [R] need help in customising function in stat_summary function ggplot2

2016-10-20 Thread Mark Sharp
tion of the object st_chg_51. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Oct 20, 2016, at 3:2

Re: [R] Subset and sumerize

2016-10-14 Thread Mark Sharp
Ashta, ## I may have misunderstood your question and if so I apologize. ## I had to remove the extra line after "45" before ## the ",sep=" to use your code. ## You could have used dput(dat) to send a more reliable (robust) version. dat <- structure(list(ID = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L,

Re: [R] Closed list?

2016-09-29 Thread Mark Sharp
Its not closed. Have you read the posting guide? Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org<mailto:msh...@txbiomed.org> On Sep 29, 2016, at 1:38 PM, Joysn71 <joys...@gmail.com<mailto:joys...@gmail.com>> wrote: Hello, a few weeks ago i subscribed to this list and

Re: [R] Drill down reports in R

2016-09-13 Thread Mark Sharp
Manu, With pure R, you can simply write a link in the parent document to a child document you have created. Alternative, and likely better, solutions could be based on AJAX, but I do not think you are going to do that all within R. Mark > On Sep 13, 2016, at 11:11 AM, Manohar Reddy

Re: [R] Help with a code in R

2016-09-07 Thread Mark Sharp
C.csv") b <- data.frame(datos) dput(b[1:10, ]) calendar <- read.csv("C:/Users/ErikaRocío/Documents/Curso R/cat_sem.csv") forecast_date <- calendar[, c(8, 9, 14, 10)] dput(forecast_date[1:10, ]) espejo <- read.csv("C:/Users/ErikaRocío/Documents/Curso R/cat_prod.cs

Re: [R] Help with a code in R

2016-09-05 Thread Mark Sharp
http://www.R-project.org/posting-guide.html Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org

Re: [R] 0 rows> (or 0-length row.names)

2016-08-31 Thread Mark Sharp
Shivi, Looking at the help from ?WOE, ?WOETable, and ?IV, your Y vector in all cases is to be categorical and it is numeric. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San

Re: [R] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
heck significant variables that is where i get this error. Thanks for your assistance Mark really appreciate i will look into some other measure on this. On Wed, Aug 31, 2016 at 12:35 AM, Mark Sharp <msh...@txbiomed.org<mailto:msh...@txbiomed.org>> wrote: Shivi, It is likely that Willi

Re: [R] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
the error. I successfully assigned the structure you sent to the name SFDC and nothing seems amiss. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210

Re: [R] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
Shivi, Can you show the code that throws the error? <0 rows> (or 0-length row.names) Of course as always a reproducible sample would be great. Perhaps you can make a small subset of the data and use dput() to provide a defined object. R. Mark Sharp, Ph.D. Director of Primate Records Da

Re: [R] 0 rows> (or 0-length row.names)

2016-08-30 Thread Mark Sharp
What do you get from str(SFDC$case_age) Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Aug

Re: [R] How to connect Microsoft Sql server from R studio using freeTDS instead of RODBC package

2016-08-30 Thread Mark Sharp
Manu, As far as I can tell you have not taken the advice from Wim Jansen, who gave you guidance on how to specify the freetds driver in your connection function. I do not think you need the unixodbc. In my experience having too much is as bad as not having enough. R. Mark Sharp, Ph.D

Re: [R] How to connect Microsoft Sql server from R studio using freeTDS instead of RODBC package

2016-08-29 Thread Mark Sharp
o convenient to use an ODBC manager, which is typically a graphical > application used to create and manage the configuration files used by the > ODBC driver. > > Mark > > R. Mark Sharp, Ph.D. > Director of Primate Records Database > Southwest National Primate Research Center > Texa

Re: [R] How to connect Microsoft Sql server from R studio using freeTDS instead of RODBC package

2016-08-29 Thread Mark Sharp
oduct from Actual Technologies. The driver you use is computer OS specific while RODBC is not. It is also convenient to use an ODBC manager, which is typically a graphical application used to create and manage the configuration files used by the ODBC driver. Mark R. Mark Sharp, Ph.D. Director

Re: [R] Splitting strings in data files R

2016-01-20 Thread Mark Sharp
Looks like homework. R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Jan 20, 2016, at 2:53 PM

Re: [R] Dput Help in R

2015-12-31 Thread Mark Sharp
Shivi, It looks like you have copied and pasted with errors. When you use dput() on a dataframe, it will output a list (see example that follows). I think you have cut off the beginning of the output and have manually added the assignment “ab<-“. Also it is clear that the read.csv is

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Mark Sharp
sapply(indx_list, function(x) {x[[2]]}) filenames_df <- data.frame(file_name = filenames, indx = indx, stringsAsFactors = FALSE) filenames_ordered <- filenames_df[order(as.numeric(filenames_df$indx)), "file_name&q

Re: [R] Works on Mac, but not Windows: Using tempdir() to determine image location works with .tex file

2015-11-01 Thread Mark Sharp
Did you look at file.path()? R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Oct 31, 2015, at 3

Re: [R] Error in eval(expr, envir, enclos) : could not find function

2015-09-22 Thread Mark Sharp
Please provide a context for your question. See the posting guide referenced below for instructions on providing commented, minimal, self-contained, reproducible code. If you can show how to produce the error, someone can almost certainly show you how to avoid it. Mark R. Mark Sharp, Ph.D. msh

Re: [R] Extract from data.frame

2015-09-21 Thread Mark Sharp
Nico, I expect there are many better ways to do this, but this does work: max_row <- (1:nrow(df))[which.max(df$Amount)] mean(df$Amount[max_row + c(-1, 0, 1)]) > max_row <- (1:nrow(df))[which.max(df$Amount)] > mean(df$Amount[max_row + c(-1, 0, 1)]) [1] 151.6667 R. Mark Sharp, Ph

Re: [R] SSD vs RAM upgrade

2015-09-14 Thread Mark Sharp
John, Unless you are doing something very unusual (such as using a database to keep intermediate results) SSD hardware will have no affect on R being memory bound. According to the behavior you described, you need RAM. R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest

Re: [R] Plotting Numeric Values with Non-Numeric Values

2015-09-14 Thread Mark Sharp
Try ?boxplot Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org > On Sep 14, 2015, at 1:49 PM, mtill

Re: [R] Rodbc retrieve data

2015-08-19 Thread Mark Sharp
this. title (main = paste0(Mapa de los dblinks del entorno: , dbName),sub=Luis Diaz - Emergencies improvments) Mark P.S. Spelling correction - improvements R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box

Re: [R] Reading Json data

2015-08-10 Thread Mark Sharp
- ../data/json_file.txt json_txt - stri_trim_both(stri_c(readLines(json_file), collapse = )) json_list - get_json_list(json_txt) length(json_list) R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San

Re: [R] R command to open a file browser on Windows and Mac?

2015-08-03 Thread Mark Sharp
Set your path with setwd(“my_path”) and then use file.choose(). You could have gotten this information sooner with a simple online search. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread Mark Sharp
I do not get an error with R-3.2.1 on Mac OS. You may have done something prior to this code so that perhaps F is not FALSE or T is not TRUE. R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jul 27, 2015, at 3:32 PM, Waichler, Scott R scott.waich...@pnnl.gov wrote: Hi, For years I've

Re: [R] Reading Json data

2015-07-27 Thread Mark Sharp
Mayukh, I think you are missing an argument to paste() and a right parenthesis character. Try json_data - fromJSON(paste(readLines(json_file), collapse = )) Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jul 27, 2015, at 3:41 PM, Mayukh Dass mayukh.d...@gmail.com wrote: Hello

Re: [R] question

2015-07-06 Thread Mark Sharp
character vector. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org On Jul 6, 2015, at 9:05 AM, Lida Zeighami

Re: [R] question

2015-07-03 Thread Mark Sharp
R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org On Jul 2, 2015, at 11:48 AM, Lida Zeighami lid.z...@gmail.com

Re: [R] create a dummy variables for companies with complete history.

2015-06-24 Thread Mark Sharp
. Always write out TRUE and FALSE R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jun 24, 2015, at 1:26 PM, giacomo begnis gmbeg...@yahoo.it wrote: Hi, I have a dataset (728 obs) containing three variables code of a company, year and revenue. Some companies have a complete history of 5 years

Re: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline

2015-06-08 Thread Mark Sharp
1 a 2 2 b 3 3 c library(stringi) names(example) - stri_replace_all_fixed(names(example), ., _) example Col_1_A Col_1_B 1 1 a 2 2 b 3 3 c R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate

Re: [R] source code for dbeta

2015-06-07 Thread Mark Sharp
/19226816/how-can-i-view-the-source-code-for-a-function Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jun 7, 2015, at 4:31 AM, Varun Sinha sinha.varun...@gmail.com wrote: Hi, I am trying to find the source code for dbeta function. I tried edit(dbeta) and this is what I got: edit(dbeta

Re: [R] source code for dbeta

2015-06-07 Thread Mark Sharp
compiled code. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org On Jun 7, 2015, at 5:11 PM, Mark Sharp msh...@txbiomed.org wrote: Varun, If you type dbeta at the command line you get the R source, which in this case tells you that the code is calling a compiled source. This is indicated

Re: [R] problems editing R console

2015-06-07 Thread Mark Sharp
Rosa, See save() and load() functions for background. However, I suspect you will want to do something as described in the article in this link http://www.fromthebottomoftheheap.net/2012/04/01/saving-and-loading-r-objects/ Mark R. Mark Sharp, Ph.D. Director of Primate Records Database

Re: [R] best way to handle database connections from within a package

2015-05-29 Thread Mark Sharp
I would simply separate the database connect and disconnect functions from the query functions. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org On May 28, 2015, at 12:18 PM, Luca Cerone luca.cer...@gmail.com wrote: Dear all, I am writing a package that is a collection of queries

Re: [R] Help with making Loop

2015-05-02 Thread Mark Sharp
Fazal, I am not sure what you want, but I have guessed. I have tried to provide a straight forward simplistic solution. If you examine the intermediate results, I think what is being done will be clear. Mark Michael Dewey’s suggestion to look at merge is excellent. You may also need to look

Re: [R] Extract year from date

2015-03-08 Thread Mark Sharp
= data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)) wells$year - year(as.Date(wells$Date, origin = '1900-1-1')) head(wells$year) Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas

Re: [R] Best Mac for R

2015-02-25 Thread Mark Sharp
For what I do, which does not require a lot of parallel work, the high end iMac was faster and much less expensive than the Mac Pro. Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org On Feb 25, 2015, at 1:50 PM, Dan Murphy chiefmur...@gmail.com wrote: I am possibly in the market for a new

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
('file/%s',years[i])) } # Data[1] will have the character vector made up of the lines in 'file/2000'. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
/%s',years[i])) } # Data[1] will have the character vector made up of the lines in 'file/2000'. Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210

Re: [R] New to R

2014-12-15 Thread Mark Sharp
by Norman Matloff. For a bit more depth I like Hadley Wickham's Advanced R book (http://adv-r.had.co.nz). Mark Sharp R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549

Re: [R] Presentation tables in R (knitr)

2014-11-25 Thread Mark Sharp
Tom, If you are wanting PDF as your output, are you wanting to use LaTeX or Markdown with knitr. LaTeX will give you more options. You have not shown an attempt to use either for your table construction. Can you define what you mean by pretty? Is it the underscores in the column names that are

Re: [R] C project within R function

2014-11-21 Thread Mark Sharp
-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. R. Mark Sharp, Ph.D. msh...@txbiomed.org NOTICE: This E-Mail (including attachments) is confidential and may be legally privileged

Re: [R] Error: (list) object cannot be coerced to type double; on running the following code in R ver 3.1.2

2014-11-11 Thread Mark Sharp
values. You probably want the following for your last line. (See ?sum). nummk - length(vbm[ !is.na(vbm[ , 2], 2]) ## or nummk - nrow(vbm[!is.na(vbm[ , 2], ]) ## The is.na(vbm[ ,2]) returns a logical vector (for example c(FALSE, TRUE, TRUE)) Mark R. Mark Sharp, Ph.D. Director Primate Records

Re: [R] Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)

2014-11-10 Thread Mark Sharp
-01 6 6 2007-09-04 2011-10-05 NA NA 2011-10-05 7 7 2005-10-25 NA NA 2011-11-04 2011-11-04 R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549

Re: [R] range () does not remove NA's with complete.cases() for dates (dplyr/mutate)

2014-11-10 Thread Mark Sharp
Pradip, For some reason mutate is not setting the is.NA value for the new column. Note the output below using your data structures. ## It looks at first as if the second element of both columns are NA. data2$mrjdate[2] [1] NA data2$oiddate[2] [1] NA ## for convenience mrj -

Re: [R] R-tool - OS compatibility help

2014-08-29 Thread Mark Sharp
See http://cran.r-project.org/ On Aug 28, 2014, at 11:41 PM, Ravi Kumar Rupakula wrote: Dear Support, Please let us know Windows 2008R2 OS compatibility for R tool is available or not? If available, please let us know the details.

Re: [R] ANY ONE HERE PLZ Urgent

2014-08-28 Thread Mark Sharp
If you use the lubridate package, this is very easy. See the help file for month() within lubridate for more examples. library(lubridate) x - now() month(x) month(x, label = TRUE) month(x, label = TRUE, abbr = FALSE) as.character(month(x, label = TRUE, abbr = FALSE)) When you run the above your

Re: [R] Replace two nested loop with an apply kind of function

2013-08-24 Thread Mark Sharp
On Aug 23, 2013, at 3:33 PM, gi...@metu.edu.trmailto:gi...@metu.edu.tr wrote: Dear R users, I am confused with the usage of apply kind of functions instead of nested loops. Let me illustrate my problem, I have an array,named C, with dimesions c(nr,nr,nt*n). I want to fill in a Tmat array

Re: [R] Replace two nested loop with an apply kind of function

2013-08-24 Thread Mark Sharp
The only reason to use one of the apply family of functions is because the idiom makes your code more clear. I do not see how that would be the case here. The apply functions are not typically any faster. If you really need speed the Rcpp package is very easy to use. Mark On Aug 23, 2013, at

Re: [R] (no subject)

2013-04-05 Thread Mark Sharp
probably have (weights = no weights here) in your function call and get the same result. Mark R. Mark Sharp msh...@txbiomed.orgmailto:msh...@txbiomed.org On Apr 3, 2013, at 3:48 AM, Ana Lucía Cárdenas Martínez wrote: Hello, I want to perform a latent class analysis using poLCA package. My

Re: [R] Pattern match

2013-03-20 Thread Mark Sharp
FALSE FALSE FALSE FALSE FALSE FALSE R. Mark Sharp msh...@txbiomed.org On Mar 20, 2013, at 11:28 AM, Christofer Bogaso wrote: Hello again, in the help page of grep() function, it is written that pattern: character string containing a regular expression (or character string for fixed = TRUE

Re: [R] Working with date

2012-12-29 Thread Mark Sharp
) { str_c(month(.date, label, abbr), sep, day(.date), sep, year(.date)) } make_date(test_date_1) make_date(my_dates) make_date(my_dates, sep = -, label = TRUE) make_date(my_dates, sep = , label = TRUE, abbr = FALSE) R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate

Re: [R] question about creating data frame

2012-06-14 Thread Mark Sharp
)) study_df - data.frame(course = my_courses, A = my_A) R. Mark Sharp msh...@txbiomed.orgmailto:msh...@txbiomed.org On May 15, 2012, at 2:09 PM, T Bal wrote: Hello, My data is study.txt: A Not A Mathematics 80 15 Physics 32 24 Biology 18 29 I want to transform this data into with column

Re: [R] save to Rdata file and to txt

2012-06-14 Thread Mark Sharp
, p.value))) R. Mark Sharp msh...@txbiomed.org On May 15, 2012, at 12:35 PM, David L Carlson wrote: capture.output(moransI, file=moransI.txt) -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352

Re: [R] Calendar in R-program

2011-01-04 Thread Mark Sharp
Look at the lubridate package from Hadley Wickham for great basic routines for handling date objects. Mark R. Mark Sharp, Ph.D. msh...@sfbr.orgmailto:msh...@sfbr.org On Jan 4, 2011, at 8:02 AM, LOON88 wrote: Hey. I have to do calendar in program R. I was looking for examples on this forum

[R] forming function arguments from strings

2011-01-01 Thread Mark Sharp
I am wanting to change arguments to a function dynamically. For example, in making a call to qplot, I want to dynamically define all of the arguments so that I can create the plot dependent on user input. I have played with eval() a bit, but have had no success. Mark Sharp

[R] Creating list or numeric vectors out of selected columns of row oriented data

2009-01-27 Thread R. Mark Sharp
,'a',93 1,'1/1/2005','1/2/2005',3.22,'o',85 1,'1/1/2005','1/3/2005',3.28,'o',91 ... 1,'1/1/2005','12/31/2008',4.38,'h',102 2,'2/13/2005','2/13/2005',3.02,'l',80 2,'2/13/2005','2/14/2005',3.08,'j',85 ... Any guidance is appreciated. R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest