[R] Labeling Stacked Bar Plots Representing Percentages with Count Data

2019-11-15 Thread Josh B
Hello, I am trying to include the count labels on stacked bar plots which represent percentages. I want to show x-amount of individuals make up the graphed percentages. However, when I include the count labels my y-axis gets blown out of proportion because it changes to match the count data, not

[R] ggmap Question

2019-09-08 Thread Josh B
Hello r-help, My question is regarding specific coding in ggmap. I am mapping radio telemetry detections of shorebirds using ggmap. I want the map to depict a specific point (lat/lon of a telemetry tower) where the bird was detected, as well as the following variables associated with that

[R] Graduated Symbol and Color Scale Coding Question

2019-08-26 Thread Josh B
I am mapping radio telemetry detections of shorebirds using ggmap. I want the map to depict a specific point (lat/lon) where the bird was detected. I want this depicted date of detection to be represented by a color scale. However, multiple birds are detected at the same telemetry tower (lat/lon)

[R] Data simulation for ANOVA decomposition into sums of squares

2011-09-30 Thread Josh B
Dear listserv, Please consider the following dataset: x - matrix(nrow = 8, ncol = 2) colnames(matrix) - c(classification, soluble_fiber) x[1:4,1] - bagel x[5:8,1] - donut How would I simulate a dataset for a one-way fixed-effect ANOVA (where classification is the treatment variable and

[R] Customizing a heatmap plot

2011-06-27 Thread Josh B
Dear R users, Please consider the following example: tmp - matrix(rnorm(100),10,10) tmp[upper.tri(tmp, diag = TRUE)] - NA heatmap(tmp, col = heat.colors(200), Rowv=NA, Colv=NA) I have three questions: (1) How would I change the axis labels from 1:10 to c(apples, pears, bananas, kiwis,

[R] Rotating the x-axis labels of a barplot

2011-04-16 Thread Josh B
Dear listserv, Here is my latest formatting problem. I would like to rotate the x-axis labels by 45 degrees on a _barplot_. Apparently this is slightly different from the example given in the R FAQ, which is for rotating the x-axis labels on a scatterplot

Re: [R] Partial italic in graph titles when looping

2011-04-11 Thread Josh B
much in advance! Sincerely, Josh Banta From: David Winsemius dwinsem...@comcast.net Sent: Sat, February 19, 2011 10:24:03 PM Subject: Re: [R] Partial italic in graph titles when looping On Feb 19, 2011, at 8:52 PM, Josh B wrote: Follow-up question: how would I

[R] Plotting a quadratic line on top of an xy scatterplot

2011-04-11 Thread Josh B
Dear Listserv, Here is my latest in a series of simple-seeming questions that dog me. Consider the following data: x - read.table(textConnection(temperature probability 0.11 9.4 0 2.3 0.38 8.7 0.43 9.2 0.6 15.6 0.47 8.7 0.09 12.8 0.11 9.4 0.01 7.7 0.83 8 0.65 9.3 0.05 7.4 0.34 10.1 0.02 4.8

[R] Partial italic in graph titles when looping

2011-02-19 Thread Josh B
Dear all, I have a rather complicated problem. I am trying to loop through making graphs, so that the graph-making process is fully automated. For each graph, I'd like to make sure the corresponding title is formatted properly. The titles will be a combination of a gene name and numerical

[R] Find and replace all the elements in a data frame

2011-02-17 Thread Josh B
Hi all, I'm having a problem once again, trying to do something very simple. Consider the following data frame: x - read.table(textConnection(locus1 locus2 locus3 A T C A T NA T C C A T G), header = TRUE) closeAllConnections() I am trying to make a new data frame, replacing A with A/A, T with

[R] Pointing to a specific place on the x-axis with an arrow

2010-10-06 Thread Josh B
Hi all, I am trying to do something simple, but which is deviling me. I want to add an up-arrow to the x-axis, pointing to a specific location on the axis. I want the arrow to be as large as possible. Here is where I'm at with my code: #this part if from the ?plot example: require(stats)

Re: [R] Pointing to a specific place on the x-axis with an arrow

2010-10-06 Thread Josh B
Dear Michael, Thanks very much. I have a follow-up question: how did you know that symbol 255 is the up-arrow? Josh From: Michael Bedward michael.bedw...@gmail.com Cc: R Help r-help@r-project.org Sent: Wed, October 6, 2010 5:09:48 AM Subject: Re: [R]

[R] Splitting a data frame into several completely separate data frames

2010-09-26 Thread Josh B
Hello again, How do I split a data frame into smaller, completely separate data frames (rather than separate data frames comprising a single list)? Consider the following data, and my coding attempt: x - read.table(textConnection(id type number indv.1 bagel 6 indv.2 bagel 1 indv.3 donuts 10

[R] Help with customizing a histogram figure

2010-09-16 Thread Josh B
Hi all, Please consider the following code: require(plotrix) l - list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3)) multhist(l) I have two things I need help with: (1) In the output, there are empty spaces on the x-axis. How would I eliminate these spaces? I want a nice, smooth,

Re: [R] Continuing on with a loop when there's a failure

2010-07-19 Thread Josh B
y3 [1,] 0.6976063 NA 0.6976063 From: David Winsemius dwinsem...@comcast.net Cc: R Help r-help@r-project.org Sent: Sun, July 18, 2010 9:12:44 PM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 18, 2010, at 12:28 PM, Josh B wrote

[R] concatenating column names in a loop

2010-07-19 Thread Josh B
Hi all, I am trying to concatenate words together to create new column names, using a loop. Please consider the following toy example: x - matrix(nrow = 1, ncol = 3) colnames(x) - c(a, b, c) x[1,1] - 1 x[1,2] - 2 x[1,3] - 3 I would like to create a new matrix with column names based on the

Re: [R] Continuing on with a loop when there's a failure

2010-07-18 Thread Josh B
Winsemius dwinsem...@comcast.net To: David Winsemius dwinsem...@comcast.net Sent: Tue, July 13, 2010 9:09:04 AM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 13, 2010, at 9:04 AM, David Winsemius wrote: On Jul 13, 2010, at 8:47 AM, Josh B wrote: Thanks again

Re: [R] Continuing on with a loop when there's a failure

2010-07-18 Thread Josh B
dwinsem...@comcast.net To: David Winsemius dwinsem...@comcast.net Sent: Tue, July 13, 2010 9:09:04 AM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 13, 2010, at 9:04 AM, David Winsemius wrote: On Jul 13, 2010, at 8:47 AM, Josh B wrote: Thanks again, David. [[elided

Re: [R] Continuing on with a loop when there's a failure

2010-07-18 Thread Josh B
...@comcast.net Cc: Peter Konings peter.l.e.koni...@gmail.com; R Help r-help@r-project.org Sent: Sun, July 18, 2010 3:33:07 PM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 18, 2010, at 4:25 AM, Josh B wrote: Hello Peter, I tried your suggestion, but I was still not able

Re: [R] Continuing on with a loop when there's a failure

2010-07-13 Thread Josh B
. From: David Winsemius dwinsem...@comcast.net Cc: R Help r-help@r-project.org Sent: Mon, July 12, 2010 8:09:03 PM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 12, 2010, at 6:18 PM, Josh B wrote: Hi R sages, Here is my latest problem

Re: [R] Continuing on with a loop when there's a failure

2010-07-13 Thread Josh B
:09:04 AM Subject: Re: [R] Continuing on with a loop when there's a failure On Jul 13, 2010, at 9:04 AM, David Winsemius wrote: On Jul 13, 2010, at 8:47 AM, Josh B wrote: Thanks again, David. [[elided Yahoo spam]] (BTW, it did work.) Here's what I'm trying now: for (i in 1:2

[R] Continuing on with a loop when there's a failure

2010-07-12 Thread Josh B
Hi R sages, Here is my latest problem. Consider the following toy example: x - read.table(textConnection(y1 y2 y3 x1 x2 indv.1 bagels donuts bagels 4 6 indv.2 donuts donuts donuts 5 1 indv.3 donuts donuts donuts 1 10 indv.4 donuts donuts donuts 10 9 indv.5 bagels donuts bagels 0 2 indv.6 bagels

Re: [R] Unable to fit error message from the lrm function in the rms library

2010-06-20 Thread Josh B
I just checked, and it doesn't seem to have failed: model.lrm24$fail [1] FALSE Any other possibilities? From: Christos Argyropoulos argch...@hotmail.com Sent: Sun, June 20, 2010 7:23:34 AM Subject: RE: [R] Unable to fit error message from the lrm function

[R] Extracting P-values from the lrm function in the rms library

2010-06-19 Thread Josh B
Hello again R users, I have a devilishly hard problem, which should be very simple. I hope someone out there will have the answer to this on the tip of their tongue. Please consider the following toy example: x - read.table(textConnection(y x1 x2 indv.1 bagels 4 6 indv.2 donuts 5 1 indv.3

[R] Unable to fit error message from the lrm function in the rms library

2010-06-19 Thread Josh B
Hi all, I have another question about the lrm function (from the rms library) that I cannot find the answer to. I get an error message when I try to fit a model, and I don't know what to make of it. Please forgive me for not having a toy example, but it appears the size and complexity of my

[R] Fitting a polynomial using lrm from the Design library

2010-06-18 Thread Josh B
Hi all, I am looking to fit a logistic regression using the lrm function from the Design library. I am interested in this function because I would like to obtain pseudo-R2 values (see http://tolstoy.newcastle.edu.au/R/help/02b/1011.html). Can anyone help me with the syntax? If I fit the

[R] Accessing the elements of summary(prcomp(USArrests))

2010-06-16 Thread Josh B
Hello again, I was hoping one of you could help me with this problem. Consider the sample data from R: summary(prcomp(USArrests)) Importance of components: PC1 PC2PC3 PC4 Standard deviation 83.732 14.2124 6.4894 2.48279 Proportion of Variance 0.966

[R] Getting the eigenvectors for the dependent variables from principal components analysis

2010-06-15 Thread Josh B
Dear listserv, I am trying to perform a principal components analysis and create an output table of the eigenvalues for the dependent variables. What I want is to see which variables are driving each principal components axis, so I can make statements like, PC1 mostly refers to seed size or

[R] Standard error of regression coefficient

2010-06-13 Thread Josh B
Hi all, This should be a very simple question for you, whereas it is proving devilish for me. How do I output the STANDARD ERROR of the regression coefficient (i.e., the standard error of b) from a simple linear regression? Consider this data, taken directly from ?lm: ctl -

[R] Change the name of one column ONLY

2010-06-09 Thread Josh B
Hi all, I have a very simple problem that I cannot seem to find the answer to. Consider the following toy dataset: x - read.table(textConnection(V1 apples bananas cherries indv.1 7 8 4 3 indv.2 7 7 4 9), header = TRUE) How would I change the column name of ONLY the first column, not the

[R] Subset columns by prefix

2010-06-09 Thread Josh B
Hello R listserve, I would appreciate someone's help with this problem. Consider the following toy dataset: x - read.table(textConnection(worldclim.1 worldclim.2 cru.1 cru.2 indv.1 7 8 32 658 indv.2 7 7 39 422), header = TRUE) How could I create a subset of the data based on the column prefix?

[R] Performing a function on columns specified in another dataframe

2010-06-09 Thread Josh B
Hello Listserve, Here is another question to keep you on your toes. Please consider the following toy dataset: a - read.table(textConnection(fred sam joe alex measure.1 10 4 10 1 measure.2 10 4 2 8 measure.3 3 1 8 3 measure.4 5 1 3 3 measure.5 8 6 8 3 measure.6 9 5 1 0 measure.7 4 6 10 1

[R] Scanning only specific columns into R from a VERY large file

2010-04-16 Thread Josh B
Hi, I turn to you, the R Sages, once again for help. You've never let me down! (1) Please make the following toy files: x - read.table(textConnection(var.1 var.2 var.3 var.1000 indv.1 1 5 9 7 indv.21 2 9 3 8), header = TRUE) y - read.table(textConnection(var.3 var.1000), header = TRUE)

[R] Indexing a matrix within loops

2010-03-13 Thread Josh B
Hi, I was hoping someone could help me with the following problem. Consider this toy example. For the input dataset there are four individuals (rows indv.1 through indv.4), measured for two different variables (columns var.1 and var.2) at two different levels of a factor (column factor.level).

[R] Using something like the by command, but on rows instead of columns

2009-11-09 Thread Josh B
Hello R Forum users, I was hoping someone could help me with the following problem. Consider the following toy dataset: AccessionSNP_CRY2SNP_FLCPhenotype 1NAA0.783143079 2BQA0.881714811 3BQA0.886619488 4AQB0.416893034 5AQB

[R] Filtering a dataset's columns by another dataset's column names

2009-02-27 Thread Josh B
. Thanks very much for your help everyone. Josh B. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

[R] Outputing residuals

2009-01-23 Thread Josh B
Hello, I was wondering if someone could tell me how to output, to file, the residuals from a REML model-fit. The type of residuals I am interested in are the simple original raw values - model fit type. Thanks in advance, Josh B. [[alternative HTML version deleted

[R] Deleting columns based on the number of non-blank observations

2009-01-18 Thread Josh B
-blank observations in each column, but how would I adapt this code to _delete_ columns from the dataset if they do not have at least 375 non-blank observations? lapply(x, function(d) { d.2- na.omit(d) count- length(d.2) } ) Many thanks in advance, Josh B. [[alternative HTML

[R] Deleting columns where the frequency of values are too disparate

2009-01-18 Thread Josh B
? (In my real dataset, there are 1096 loci, so this cannot be done easily by eye.) Thanks again in advance for any suggestions! Josh B. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

[R] Simple question about extracting a subset of data

2008-09-29 Thread Josh B
Hello all, I have a (hopefully) simple question. If I have a data table (named x) such as this: daylengthleavesflowering.datefruits LD1.90055581.64353250.76668986 LD-0.9399410-1.2592968-0.60141837 LD1.0222946-0.9697459 -0.60141837 SD-0.2668132-0.9697459-0.47363322 SD

[R] Using by to create individual variance-covariance matrices

2008-09-27 Thread Josh B
Hello R list subscribers, I am trying to use the by command to create line-specific variance covariance matrices (where x is the original data matrix): by(x, x$line, function(d) { d.clean - d[,-1]}) write.table(d.clean$line[1,1], sep = ,, file = covariances.csv, col.names = FALSE, row.names =

[R] Looping over groups

2008-08-20 Thread Josh B
Hello, My R skills are somewhere between novice and intermediary, and I am hoping that some of you very helpful forum members, whom I've seen work your magic on other peoples' problems/questions, can help me here. I have a matrix with the following format: (i) individual plants comprising

Re: [R] Looping over groups

2008-08-20 Thread Josh B
When I try your suggestion, I get the output, e.g.,: christina.df$gen: 309 NULL Returned for each vector. That doesn't seem good (I associate NULL with something being empty), but perhaps I am misinterpreting it? - Original Message From: Dylan Beaudette [EMAIL PROTECTED] To: Josh B

Re: [R] Looping over groups

2008-08-20 Thread Josh B
Works for me: x - read.csv('christina.txt') x.list - by(x, x$gen, function(d) { d.clean - d[,-1] cov(d.clean, y= NULL, use= complete.obs, method=pearson) } ) note that the output is a list, where each element corresponds to one level of 'gen'. if you need to write each element out to a