Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Robert Baer
coord_cartesian also seems to work for y, and including the breaks = .  
How about:


df=data.frame(year= c(2012,2015,2018,2022),
  score=c(495,493, 495, 474))

ggplot(df, aes(x = year, y = score)) +
  geom_point() +
  geom_smooth(method = "lm", formula = y ~ x) +
  labs(title = "Standard linear regression for France", x = "Year", y = 
"PISA score in mathematics") +

  coord_cartesian(ylim=c(470,500)) +
  scale_x_continuous(breaks = 2012:2022)

On 12/12/2023 3:19 PM, varin sacha via R-help wrote:

Dear Ben,
Dear Daniel,
Dear Rui,
Dear Bert,

Here below my R code.
I really appreciate all your comments. My R code is perfectly working but there 
is still something I would like to improve. The X-axis is showing   2012.5 ;   
2015.0   ;   2017.5   ;  2020.0
I would like to see on X-axis only the year (2012 ; 2015 ; 2017 ; 2020). How to 
do?


#
library(ggplot2)
  
df=data.frame(year= c(2012,2015,2018,2022), score=c(495,493, 495, 474))


ggplot(df, aes(x = year, y = score)) + geom_point() + geom_smooth(method = 
"lm", formula = y ~ x) +
  labs(title = "Standard linear regression for France", x = "Year", y = "PISA score 
in mathematics") + scale_y_continuous(limits=c(470,500),oob=scales::squish)
#









Le lundi 11 décembre 2023 à 23:38:06 UTC+1, Ben Bolker  a 
écrit :







On 2023-12-11 5:27 p.m., Daniel Nordlund wrote:

On 12/10/2023 2:50 PM, Rui Barradas wrote:

Às 22:35 de 10/12/2023, varin sacha via R-help escreveu:

Dear R-experts,

Here below my R code, as my X-axis is "year", I must be missing one
or more steps! I am trying to get the regression line with the 95%
confidence bands around the regression line. Any help would be
appreciated.

Best,
S.


#
library(ggplot2)
   df=data.frame(year=factor(c("2012","2015","2018","2022")),
score=c(495,493, 495, 474))
   ggplot(df, aes(x=year, y=score)) + geom_point( ) +
geom_smooth(method="lm", formula = score ~ factor(year), data = df) +
labs(title="Standard linear regression for France", y="PISA score in
mathematics") + ylim(470, 500)
#

__
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 don't see a reason why year should be a factor and the formula in
geom_smooth is wrong, it should be y ~ x, the aesthetics envolved.
It still doesn't plot the CI's though. There's a warning and I am not
understanding where it comes from. But the regression line is plotted.



ggplot(df, aes(x = as.numeric(year), y = score)) +
   geom_point() +
   geom_smooth(method = "lm", formula = y ~ x) +
   labs(
     title = "Standard linear regression for France",
     x = "Year",
     y = "PISA score in mathematics"
   ) +
   ylim(470, 500)
#> Warning message:
#> In max(ids, na.rm = TRUE) : no non-missing arguments to max;
returning -Inf



Hope this helps,

Rui Barradas




After playing with this for a little while, I realized that the problem
with plotting the confidence limits is the addition of ylim(470, 500).
The confidence values are outside the ylim values.  Remove the limits,
or increase the range, and the confidence curves will plot.

Hope this is helpful,

Dan


   Or use + scale_y_continuous(limits = c(470, 500), oob = scales::squish)


__
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-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] back tick names with predict function

2023-12-03 Thread Robert Baer



On 12/1/2023 11:47 AM, peter dalgaard wrote:

Also, and possibly more constructively, when you get an error like
  

CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c')  # fail

Error in eval(predvars, data, env) : object 'plant-density' not found

you should check your assumptions. Does "newdata" actually contain a columnn called 
"plant-density":


Great advice/strategy. Thanks!



head(data.frame( `plant-density` = x))

   plant.density
1  65.0
2  65.11912
3  65.23824
4  65.35736
5  65.47648
6  65.59560
I.e., it doesn't. So check help for data.frame and looking for something with 
names.


On 1 Dec 2023, at 01:47 , Bert Gunter  wrote:

"Thank you Rui.  I didn't know about the check.names = FALSE argument.

Another good reminder to always read help, but I'm not sure I understood
what help to read in this case"

?data.frame , of course, which says:

"check.names

logical. If TRUE then the names of the variables in the data frame are
checked to ensure that they are syntactically valid variable names and
are not duplicated. If necessary they are adjusted (by make.names) so
that they are. "

-- Bert

__
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.


Re: [R] back tick names with predict function

2023-11-30 Thread Robert Baer
Thank you Rui.  I didn't know about the check.names = FALSE argument.  
Another good reminder to always read help, but I'm not sure I understood 
what help to read in this case.  Since your clue, I've discovered that a 
tibble-based strategy could also work.


x = seq(min(cob_wt$`plant-density`), max(cob_wt$`plant-density`), length 
= 999)

xvals = tibble(`plant-density` = x)
CI.c = predict(mod2, newdata = xvals, interval = 'c')
CI.p = predict(mod2,  newdata = xvals,  interval = 'p')

Again, appreciate the solution.

On 11/30/2023 12:03 PM, Rui Barradas wrote:

Às 17:57 de 30/11/2023, Rui Barradas escreveu:

Às 17:38 de 30/11/2023, Robert Baer escreveu:
I am having trouble using back ticks with the R extractor function 
'predict' and an lm() model. I'm trying too construct some nice 
vectors that can be used for plotting the two types of regression 
intervals.  I think it works with normal column heading names but it 
fails when I have "special" back-tick names.  Can anyone help with 
how I would reference these?  Short of renaming my columns, is there 
a way to accomplish this?


Repex

*# dataframe with dashes in column headings
cob =
   structure(list(`cob-wt` = c(212, 241, 215, 225, 250, 241, 237,
 282, 206, 246, 194, 241, 196, 193, 224, 
257, 200, 190, 208, 224

), `plant-density` = c(137, 107, 132, 135, 115, 103, 102, 65,
    149, 85, 173, 124, 157, 184, 112, 80, 165, 
160, 157, 119)),

class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -20L))

# regression model works
mod2 = lm(`cob-wt` ~ `plant-density`, data = cob)

# x sequence for plotting CI's
# Set up x points
x = seq(min(cob$`plant-density`), max(cob$`plant-density`), length = 
1000)


# Use predict to get CIs for a plot
# Add CI for regression line (y-hat uses 'c')
# usual trick is to assign x to actual x-var name in middle 
dataframe arguement
CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 
'c') # fail


# Add CI for prediction value (y-tilde uses 'p')
# usual trick is to assign x to actual x-var name in middle 
dataframe arguement
CI.p = predict(mod2, data.frame(`plant-density`  = x), interval = 
'p')    # fail

*

__
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,

When creating the new data df, the default check.names = TRUE changes 
the column name, it is repaired and the hyphen is replaced by a legal 
dot.



# check.names defaults to TRUE
newd <- data.frame(`plant-density` = x)
# `plant-density` is not a column name
head(newd)

# check.names set to FALSE
newd <- data.frame(`plant-density` = x, check.names = FALSE)
# `plant-density` is becomes a column name
head(newd)


# Use predict to get CIs for a plot
# Add CI for regression line (y-hat uses 'c')
# usual trick is to assign x to actual x-var name in middle dataframe 
arguement

CI.c = predict(mod2, newdata = newd, interval = 'confidence')  # fail

# Add CI for prediction value (y-tilde uses 'p')
# usual trick is to assign x to actual x-var name in middle dataframe 
arguement

CI.p = predict(mod2, newdata = newd, interval = 'prediction') # fail



Hope this helps,

Rui Barradas



Hello,

Sorry for the comments '# fail' in the last two instructions, I should 
have changed them.



CI.c <- predict(mod2, newdata = newd, interval = 'confidence') # works
CI.p <- predict(mod2, newdata = newd, interval = 'prediction') # works


Hoep 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.


[R] back tick names with predict function

2023-11-30 Thread Robert Baer
I am having trouble using back ticks with the R extractor function 
'predict' and an lm() model.  I'm trying too construct some nice vectors 
that can be used for plotting the two types of regression intervals.  I 
think it works with normal column heading names but it fails when I have 
"special" back-tick names.  Can anyone help with how I would reference 
these?  Short of renaming my columns, is there a way to accomplish this?


Repex

*# dataframe with dashes in column headings
cob =
  structure(list(`cob-wt` = c(212, 241, 215, 225, 250, 241, 237,
    282, 206, 246, 194, 241, 196, 193, 224, 
257, 200, 190, 208, 224

), `plant-density` = c(137, 107, 132, 135, 115, 103, 102, 65,
   149, 85, 173, 124, 157, 184, 112, 80, 165, 160, 
157, 119)),

class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -20L))

# regression model works
mod2 = lm(`cob-wt` ~ `plant-density`, data = cob)

# x sequence for plotting CI's
# Set up x points
x = seq(min(cob$`plant-density`), max(cob$`plant-density`), length = 1000)

# Use predict to get CIs for a plot
# Add CI for regression line (y-hat uses 'c')
# usual trick is to assign x to actual x-var name in middle dataframe 
arguement
CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c')  
# fail


# Add CI for prediction value (y-tilde uses 'p')
# usual trick is to assign x to actual x-var name in middle dataframe 
arguement
CI.p = predict(mod2, data.frame(`plant-density`  = x), interval = 
'p')    # fail

*

__
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] Print hypothesis warning- Car package

2023-09-17 Thread Robert Baer

Thanks John. Appreciate the insights.

On 9/17/2023 9:43 AM, John Fox wrote:

Dear Robert,

Anova() calls linearHypothesis(), also in the car package, to compute 
sums of squares and df, supplying appropriate hypothesis matrices. 
linearHypothesis() usually tries to express the hypothesis matrix in 
symbolic equation form for printing, but won't do this if coefficient 
names include arithmetic operators, in your case - and +, which can 
confuse it.


The symbolic form of the hypothesis isn't really relevant for Anova(), 
which doesn't use the printed representation of each hypothesis, and 
so, despite the warnings, you get the correct ANOVA table. In your 
case, where the data are balanced, with 4 cases per cell, Anova(mod) 
and summary(mod) are equivalent, which makes me wonder why you would 
use Anova() in the first place.


To elaborate a bit, linearHypothesis() does tolerate arithmetic 
operators in coefficient names if you specify the hypothesis 
symbolically rather than as a hypothesis matrix. For example, to test, 
the interaction:


--- snip 

> linearHypothesis(mod,
+  c("TreatmentDabrafenib:ExpressionCD271+ = 0",
+    "TreatmentTrametinib:ExpressionCD271+ = 0",
+    "TreatmentCombination:ExpressionCD271+ = 0"))
Linear hypothesis test

Hypothesis:
TreatmentDabrafenib:ExpressionCD271+ = 0
TreatmentTrametinib:ExpressionCD271+ = 0
TreatmentCombination:ExpressionCD271+ = 0

Model 1: restricted model
Model 2: Viability ~ Treatment * Expression

  Res.Df   RSS Df Sum of Sq F Pr(>F)
1 27 18966
2 24 16739  3    2226.3 1.064 0.3828

--- snip 

Alternatively:

--- snip 

> H <- matrix(0, 3, 8)
> H[1, 6] <- H[2, 7] <- H[3, 8] <- 1
> H
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]    0    0    0    0    0    1    0    0
[2,]    0    0    0    0    0    0    1    0
[3,]    0    0    0    0    0    0    0    1

> linearHypothesis(mod, H)
Linear hypothesis test

Hypothesis:


Model 1: restricted model
Model 2: Viability ~ Treatment * Expression

  Res.Df   RSS Df Sum of Sq F Pr(>F)
1 27 18966
2 24 16739  3    2226.3 1.064 0.3828
Warning message:
In printHypothesis(L, rhs, names(b)) :
  one or more coefficients in the hypothesis include
 arithmetic operators in their names;
  the printed representation of the hypothesis will be omitted

--- snip 

There's no good reason that linearHypothesis() should try to express 
each hypothesis symbolically for Anova(), since Anova() doesn't use 
that information. When I have some time, I'll arrange to avoid the 
warning.


Best,
 John



__
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] Print hypothesis warning- Car package

2023-09-16 Thread Robert Baer
When doing Anova using the car package,  I get a print warning that is 
unexpected.  It seemingly involves have my flow cytometry factor levels 
named CD271+ and CD171-.  But I am not sure this warning should be 
intended behavior.  Any explanation about whether I'm doing something 
wrong? Why can't I have CD271+ and CD271- as factor levels?  Its legal 
text isn't it?

library(car) mod = aov(Viability ~ Treatment*Expression, data = dat1) 
Anova(mod, type =2) Anova Table (Type II tests) Response: Viability Sum 
Sq Df F value Pr(>F) Treatment 19447.3 3 9.2942 0.0002927 *** Expression 
2669.8 1 3.8279 0.0621394 . Treatment:Expression 2226.3 3 1.0640 
0.3828336 Residuals 16739.3 24 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 
0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Warning messages: 1: In printHypothesis(L, 
rhs, names(b)) : one or more coefficients in the hypothesis include 
arithmetic operators in their names; the printed representation of the 
hypothesis will be omitted 2: In printHypothesis(L, rhs, names(b)) : one 
or more coefficients in the hypothesis include arithmetic operators in 
their names; the printed representation of the hypothesis will be 
omitted 3: In printHypothesis(L, rhs, names(b)) : one or more 
coefficients in the hypothesis include arithmetic operators in their 
names; the printed representation of the hypothesis will be omitted


The code to reproduce:

```


dat1 <-structure(list(Treatment = structure(c(1L, 1L, 1L, 1L, 3L, 1L,
   1L, 1L, 1L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
   3L, 3L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L), levels = c("Control",
"Dabrafenib", "Trametinib", "Combination"), class = "factor"),
   Expression = structure(c(2L, 2L, 2L, 2L, 2L, 1L, 
1L, 1L,
    1L, 2L, 2L, 2L, 2L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
    1L, 2L, 2L, 2L, 2L, 1L, 
1L, 1L, 1L), levels = c("CD271-",
"CD271+"), class = "factor"),
   Viability = c(128.329809725159, 24.2360176821065, 
76.3597924274457, 11.0128771862387, 21.4683836248318,
     140.784162982894, 87.4303286565443, 
118.181818181818, 53.603690178743,
     51.2973284643475, 5.47760907168941, 
27.1574091870075, 50.8360561214684,
     56.5250816836441, 28.6949836632712, 
93.2731116663463, 71.900826446281,
     32.2314049586777, 24.2360176821065, 
27.4649240822602, 24.0822602344801,
     26.542379396502, 30.693830482414, 
27.772438977513, 13.4729963482606,
     8.24524312896406, 18.5469921199308, 
13.9342686911397, 13.3192389006342,
     19.9308091485681, 17.6244474341726, 
16.2406304055353)),
  row.names = c(NA,
    -32L),
  class = c("tbl_df", "tbl", "data.frame"))

mod = aov(Viability ~ Treatment*Expression, data = dat1)
summary(mod)
library(car)
Anova(mod, type =2)

```


> sessionInfo() R version 4.3.1 (2023-06-16 ucrt) Platform: 
x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 
25951) Matrix products: default locale: [1] LC_COLLATE=English_United 
States.utf8 LC_CTYPE=English_United States.utf8 
LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C 
LC_TIME=English_United States.utf8 time zone: America/Chicago tzcode 
source: internal attached base packages: [1] stats graphics grDevices 
utils datasets methods base other attached packages: [1] car_3.1-2 
carData_3.0-5 tidyr_1.3.0 readr_2.1.4 readxl_1.4.3 ggplot2_3.4.3 
dplyr_1.1.3 loaded via a namespace (and not attached): [1] crayon_1.5.2 
vctrs_0.6.3 cli_3.6.1 rlang_1.1.1 purrr_1.0.2 generics_0.1.3 
labeling_0.4.3 [8] bit_4.0.5 glue_1.6.2 colorspace_2.1-0 hms_1.1.3 
scales_1.2.1 fansi_1.0.4 grid_4.3.1 [15] cellranger_1.1.0 abind_1.4-5 
munsell_0.5.0 tibble_3.2.1 tzdb_0.4.0 lifecycle_1.0.3 compiler_4.3.1 
[22] pkgconfig_2.0.3 rstudioapi_0.15.0 farver_2.1.1 R6_2.5.1 
tidyselect_1.2.0 utf8_1.2.3 parallel_4.3.1 [29] vroom_1.6.3 pillar_1.9.0 
magrittr_2.0.3 bit64_4.0.5 tools_4.3.1 withr_2.5.0 gtable_0.3.4


[[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] Book Recommendation

2023-09-04 Thread Robert Baer
This is a great find for those of us lurking on this thread. Thanks for 
sharing Greg (and of course Paul).


On 8/30/2023 3:52 PM, Greg Snow wrote:

Stephen,  I see lots of answers with packages and resources, but not
book recommendations.  I have used Introduction to Data Technologies
by Paul Murrell (https://www.stat.auckland.ac.nz/~paul/ItDT/) to teach
SQL and database design and would recommend looking at it as a
possibility.

On Mon, Aug 28, 2023 at 9:47 AM Stephen H. Dawson, DSL via R-help
 wrote:

Good Morning,


I am doing some research to develop a new course where I teach. I am
looking for a book to use in the course content to teach accomplishing
SQL in R.

Does anyone know of a book on this topic to recommend for consideration?


Thank You,
--
*Stephen Dawson, DSL*
/Executive Strategy Consultant/
Business & Technology
+1 (865) 804-3454
http://www.shdawson.com

__
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.


Re: [R] Technical Help Request for "Version Differences" (i.e., CYTOFKIT package)

2023-08-10 Thread Robert Baer
GIven that Cytofkit is removed from Bioconductor, and you seem new to 
everything, I would suggest like others already have that you install 
the most recent version of R for Windows 
https://cran.r-project.org/bin/windows/base/ and seek a more up-to-date 
package.


For flow cytometry, I would like to recommend the CytoExploreR package 
(https://dillonhammill.github.io/CytoExploreR/ which is built on top of 
the core flow cytometry packages produced by RGLab 
(https://cytoverse.org/) and available on Bioconductor 
https://bioconductor.org/packages/release/bioc/html/openCyto.html


God luck,

Rob

On 8/4/2023 2:10 AM, MURAT DELMAN via R-help wrote:



Dear Ms./Mr.,







If the email text and codes below are not properly displayed, you can download 
the attached Word file, which has exactly the same content.



I am a cytometrist and microscopist at Izmir Institute of Technology, 
Integrated Research Center. I operate a cytometer and fluorescence microscope 
to acquire data from our researchers’ samples and then give them analyzed data. 
I need to dive into bulk data to present all of the information in the sample. 
To do this, I have recently been trying to develop my skills in R, RStudio, and 
Cytofkit package for cytometry (flow, spectral, mass, imaging mass cytometry) 
data analysis. I am new in this area and must learn R for data analysis.





May I request help from you or one of your assistants who is competent in R, 
RStudio, and R packages with the installation issues caused by “ version 
differences ” between R itself, R packages, and their dependencies? I really 
had to send this email to you anymore, because I could not run the package 
“Cytofkit” and find a solution on the internet.


It has been nearly 2 weeks since I have been trying to solve the errors and 
warnings. I am in a vicious circle and cannot move forward anymore. This is why 
I needed help from an expert competent in R programming.



I tried to use the renv package, but I could not move forward because I am not 
competent in R.




I explained the errors that I faced during the installation below.



I have two computers, both operating Windows 10, 64-bit.



I installed R 3.5. 2 on the desktop (Windows in English) and R 3.5. 0 on the 
laptop (Windows in Turkish).



I know that you are very busy with your work, but may you (or your assistant) 
help me by informing me how to install consistent versions of R, RStudio, and 
packages/dependencies (for example, Cytofkit, ggplot2, Rtools, devtools, plyr, 
shiny, GUI)?





I guess I will need exact web page links " in an orderly manner" to download 
the correct versions of everything.



I would appreciate it if you could advise me or forward this email to one of 
your assistants or experts.






I really appreciate any help you can provide.






Kind Regards






Please find the technical details below;





I used the installation order listed below;



I downloaded R 3.5.0 and R 3.5.2 using the link and directory below.



Link: [ https://www.freestatistics.org/cran/ | 
https://www.freestatistics.org/cran/ ]



Directory: Download R for Windows > install R for the first time > Previous 
releases > R 3.5.2 (December, 2018) or R 3.5.0





I downloaded RStudio from the link below;



[ https://posit.co/download/rstudio-desktop/ | 
https://posit.co/download/rstudio-desktop/ ]






I downloaded packages via either [ 
https://cran.rstudio.com/bin/windows/contrib/r-devel/ | 
https://cran.rstudio.com/bin/windows/contrib/r-devel/ ] or the “install 
function” tab in RStudio.



Rtools : [ https://cran.r-project.org/bin/windows/Rtools/ | 
https://cran.r-project.org/bin/windows/Rtools/ ]



Devtools : [ https://cran.r-project.org/web/packages/devtools/index.html | 
https://cran.r-project.org/web/packages/devtools/index.html ]



ggplot2 : [ https://cran.r-project.org/web/packages/ggplot2/index.html | 
https://cran.r-project.org/web/packages/ggplot2/index.html ]



[ https://ggplot2.tidyverse.org/ | https://ggplot2.tidyverse.org/ ]



[ https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf | 
https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf ]





plyr : [ https://cran.r-project.org/web/packages/plyr/index.html | 
https://cran.r-project.org/web/packages/plyr/index.html ]



shiny : [ https://cran.r-project.org/web/packages/shiny/index.html | 
https://cran.r-project.org/web/packages/shiny/index.html ]



[ https://shiny.posit.co/r/getstarted/shiny-basics/lesson1/index.html | 
https://shiny.posit.co/r/getstarted/shiny-basics/lesson1/index.html ]



[ https://github.com/rstudio/shiny | https://github.com/rstudio/shiny ]



cytofkit : [ https://github.com/JinmiaoChenLab/cytofkit | 
https://github.com/JinmiaoChenLab/cytofkit ]



[ https://bioconductor.riken.jp/packages/3.3/bioc/html/cytofkit.html | 
https://bioconductor.riken.jp/packages/3.3/bioc/html/cytofkit.html ]



[ 
https://journals.plos.org/ploscompbiol/article/file?id=10.1371/journal.pcbi.1005112=printable
 | 

Re: [R] Format printing with R

2022-12-11 Thread Robert Baer
And you will probably want to read the details of the  ?round help, so 
you understand how it handles 5 rounding.  It is a little more 
complicated than some of us learned in school.



On 11/22/2022 4:24 AM, Steven T. Yen wrote:

Thanks to all. And yes, Ivan, round() did it:

> dput(head(Mean))
c(afactfem = 0.310796641158209, afactblk = 0.188030178893171,
age = 45.3185794338312, nodiscfem = 0.506637018185968, discfem = 
0.493362981814032,

notradgrol = 0.702915000493879)
> dput(head(Std.dev))
c(afactfem = 0.462819715443265, afactblk = 0.390736267472797,
age = 16.3136348021933, nodiscfem = 0.499955948049025, discfem = 
0.499955948049025,

notradgrol = 0.456974290933931)
> round(cbind(Mean,Std.dev),2)[1:10,]
    Mean Std.dev
afactfem    0.31    0.46
afactblk    0.19    0.39
age    45.32   16.31
nodiscfem   0.51    0.50
discfem 0.49    0.50
notradgrol  0.70    0.46
tradgrol    0.30    0.46
nofemnopol  0.80    0.40
femnopol    0.20    0.40
nopreshurt  0.66    0.47

On 11/22/2022 3:08 PM, Ivan Krylov wrote:

On Tue, 22 Nov 2022 08:15:57 +0800
"Steven T. Yen"  wrote:


Thanks to all, but no, signif() did not work:

It worked, just didn't do what you wanted it to do. I think you want
round(), not signif(). Some of your numbers (45.3185794) will be rounded
to 4 significant digits and others (0.096) will be rounded to 1
significant digit, but the number of decimal places will be 2.



__
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.


Re: [R] Why R >= 4.1 warns about installing Rtools on Windows?

2022-09-28 Thread Robert Baer
I don't know for sure, but I imagine this warning is for"old users" that 
have been using RTools for some of their packages and need to know that 
the old RTools no longer works with the latest builds.  It certainly was 
helpful to me.  I understand how frightening it could be to new users, 
but everyone should benefit from learning the difference between a 
warning and an error at some time.


On 9/27/2022 3:51 AM, Samuel Granjeaud wrote:


Hi,

I don't understand why Rtoosl seems to be required even if a package 
is pure R. For sure, this is just a warning, but it frightens new 
comers. So, why encouraging people add stuff that will be probably 
unneeded?


Have a nice,
Samuel

__
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.


--
__
Robert W. Baer, Ph.D.
Professor of Physiolgy
Kirksville College of Osteopathic Medicine
A.T. Still University of Heallth Sciences
800 W. Jefferson St.
Kirksville, MO 63501
P: 660-626-2322


 

 


The ATSU Mission
A.T. Still University of Health Sciences serves as a learning-centered 
university dedicated to preparing highly competent professionals through 
innovative academic programs with a commitment to continue its osteopathic 
heritage and focus on whole person healthcare, scholarship, community health, 
interprofessional education, diversity, and underserved populations.

Proud recipient of INSIGHT Into Diversity’s 2017-19 Higher Education Excellence 
in Diversity Awards.

__
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] viewing, editing and saving an RDATA file

2020-07-22 Thread Robert Baer
You may misunderstand how RData files work.  Note that RData files are 
not necessarily JUST a single variable unless they were explicitly 
written to store a single variable only.


If you save a single variable (a dataframe, for example) named 'mydata' 
with save(mydata, file = "saveddata.RData") and then load the variable 
back into a new R session with y  <- load("saveddata.RData"), your data 
will still be contained in a variable named 'mydata',  not renamed  y.


Look at ?load and ?save

On 7/22/2020 5:47 AM, Jim Lemon wrote:

Hi Jason,
I assume that you actually have "WVS.RData" in your working directory
when you try to load it. Otherwise you will get an error message. If
you don't get an error message when you do this:

load("WVS.RData")

there will be a new object in your workspace. So if you want to see
what the object is, try this:

objects()
load("WVS.RData")
objects()

Unless you have already run the "load" command, there will be a new
object in the list. That is what you're looking for. Say that object
is named "x". You can look at the first part of it with:

head(x)

and maybe do some basic editing with:

edit(x)

Good luck.

Jim

__
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.


Re: [R] saving an R script

2019-05-10 Thread Robert Baer
I agree that an editor or a development environment like RStudio is the 
best answer, but perhaps savehistory() function is what you are looking for.


On 5/10/2019 8:32 AM, Doran, Harold wrote:

David

Most of us use an editor of some kind to write our code. I use Notepad++ but 
there are many options. In this way, you simply write your code in a text file 
and save it.

Some editors allow for you to execute your code from the script.

-Original Message-
From: R-help  On Behalf Of David Winters
Sent: Thursday, May 09, 2019 10:54 PM
To: r-help@r-project.org
Subject: [R] saving an R script

Greetings,

This is a super embarrassing question. But, how do you save an R script with code? that 
is, not doing it the cheat way? where you just hit the "save" button? what 
function would it be?

I know how to save the environment in code:

save.image(file='myEnvironment.RData')
quit(save='no')
load('myEnvironment.RData')

But how would I do the same thing with a script? rather than the environment?

David

__
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.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Finding unique terms

2018-10-15 Thread Robert Baer




On 10/11/2018 5:12 PM, roslinazairimah zakaria wrote:

Dear r-users,

I have this data:

structure(list(STUDENT_ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L), .Label = c("AA15285", "AA15286"), class = "factor"),
 COURSE_CODE = structure(c(1L, 2L, 5L, 6L, 7L, 8L, 2L, 3L,
 4L, 5L, 6L), .Label = c("BAA1113", "BAA1322", "BAA2113",
 "BAA2513", "BAA2713", "BAA2921", "BAA4273", "BAA4513"), class =
"factor"),
 PO1M = c(155.7, 48.9, 83.2, NA, NA, NA, 48.05, 68.4, 41.65,
 82.35, NA), PO1T = c(180, 70, 100, NA, NA, NA, 70, 100, 60,
 100, NA), PO2M = c(NA, NA, NA, 37, NA, NA, NA, NA, NA, NA,
 41), PO2T = c(NA, NA, NA, 50, NA, NA, NA, NA, NA, NA, 50),
 X = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.1 = c(NA,
 NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("STUDENT_ID",
"COURSE_CODE", "PO1M", "PO1T", "PO2M", "PO2T", "X", "X.1"), class =
"data.frame", row.names = c(NA,
-11L))

I want to combine the same Student ID and add up all the values for PO1M,
PO1T,...,PO2T obtained by the same ID.

How do I do that?
Thank you for any help given.

oops!  Forgot to clean up after my cut and paste. Solution with dplyr 
looks like this:

# Create sums by student ID
library(dplyr)
dat %>%
  group_by(STUDENT_ID) %>%
  summarize(sum.PO1M = sum(PO1M, na.rm = TRUE),
    sum.PO1T = sum(PO1T, na.rm = TRUE),
    sum.PO2M = sum(PO2M, na.rm = TRUE),
    sum.PO2T = sum(PO2T, na.rm = TRUE))

__
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] Finding unique terms

2018-10-15 Thread Robert Baer




Dear r-users,

I have this data:

structure(list(STUDENT_ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L), .Label = c("AA15285", "AA15286"), class = "factor"),
 COURSE_CODE = structure(c(1L, 2L, 5L, 6L, 7L, 8L, 2L, 3L,
 4L, 5L, 6L), .Label = c("BAA1113", "BAA1322", "BAA2113",
 "BAA2513", "BAA2713", "BAA2921", "BAA4273", "BAA4513"), class =
"factor"),
 PO1M = c(155.7, 48.9, 83.2, NA, NA, NA, 48.05, 68.4, 41.65,
 82.35, NA), PO1T = c(180, 70, 100, NA, NA, NA, 70, 100, 60,
 100, NA), PO2M = c(NA, NA, NA, 37, NA, NA, NA, NA, NA, NA,
 41), PO2T = c(NA, NA, NA, 50, NA, NA, NA, NA, NA, NA, 50),
 X = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.1 = c(NA,
 NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("STUDENT_ID",
"COURSE_CODE", "PO1M", "PO1T", "PO2M", "PO2T", "X", "X.1"), class =
"data.frame", row.names = c(NA,
-11L))

I want to combine the same Student ID and add up all the values for PO1M,
PO1T,...,PO2T obtained by the same ID.

How do I do that?
Thank you for any help given


# load data

# Enter dataframe by hand
dat <- structure(list(STUDENT_ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L), .Label = c("AA15285", "AA15286"), class = "factor"),
    COURSE_CODE = structure(c(1L, 2L, 5L, 6L, 7L, 8L, 2L, 3L,
    4L, 5L, 6L), .Label = c("BAA1113", "BAA1322", "BAA2113",
    "BAA2513", "BAA2713", "BAA2921", "BAA4273", "BAA4513"), class =
"factor"),
    PO1M = c(155.7, 48.9, 83.2, NA, NA, NA, 48.05, 68.4, 41.65,
    82.35, NA), PO1T = c(180, 70, 100, NA, NA, NA, 70, 100, 60,
    100, NA), PO2M = c(NA, NA, NA, 37, NA, NA, NA, NA, NA, NA,
    41), PO2T = c(NA, NA, NA, 50, NA, NA, NA, NA, NA, NA, 50),
    X = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), X.1 = c(NA,
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("STUDENT_ID",
"COURSE_CODE", "PO1M", "PO1T", "PO2M", "PO2T", "X", "X.1"), class =
"data.frame", row.names = c(NA,
-11L))

# Create sums by student ID

library(dplyr)
dat %>%
  group_by(STUDENT_ID) %>%
  summarize(sum.PO1M = sum(PO1M, na.rm = TRUE),
    sum.PO1T = sum(PO1M, na.rm = TRUE),
    sum.PO2M = sum(PO1M, na.rm = TRUE),
    sum.PO2T = sum(PO1M, na.rm = TRUE))

__
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] Fortune candidate

2018-01-29 Thread Robert Baer

On 1/27/2018 12:16 PM, David Winsemius wrote:

John (to a serial querulant):

 ...but with such a sweeping lack of
information from you, don't congratulate yourself if you get a helpful
answer.  It wasn't your fault.


David Winsemius
Alameda, CA, USA

Second that nomination!



'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
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.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Facing problem in installing the package named "methyAnalysis"

2017-12-29 Thread Robert Baer

Bioconductor help is here:

https://www.bioconductor.org/help/



On 12/29/2017 6:00 AM, Pijush Das wrote:

Thank you Michael Dewey.
Can you please send me the email id for Bioconductor.




regards
Pijush

On Fri, Dec 29, 2017 at 5:20 PM, Michael Dewey 
wrote:


Dear Pijush

You might do better to ask on the Bioconductor list as IRanges does not
seem to be on CRAN so I deduce it is a Bioconductor package too.

Michael


On 29/12/2017 07:29, Pijush Das wrote:


Dear Sir,




I have been using R for a long time. But recently I have faced a problem
when installing the Bioconductor package named "methyAnalysis". Firstly it
was require to update my older R (R version 3.4.3 (2017-11-30)) in to
newer
version. That time I have also updated the RStudio software.

After that when I have tried to install the package named "methyAnalysis".
It shows some error given below.

No methods found in package ‘IRanges’ for requests: ‘%in%’,
‘elementLengths’, ‘elementMetadata’, ‘ifelse’, ‘queryHits’, ‘Rle’,
‘subjectHits’, ‘t’ when loading ‘bumphunter’
Error: package or namespace load failed for ‘methyAnalysis’:
   objects ‘.__T__split:base’, ‘split’ are not exported by
'namespace:IRanges'
In addition: Warning message:
replacing previous import ‘BiocGenerics::image’ by ‘graphics::image’ when
loading ‘methylumi’

I also try to install the package after downloading the source package
from
Bioconductor but the method is useless.

Please help me to install the package named "methyAnalysis".

Thanking you



regards
Pijush

 [[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/posti
ng-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Michael
http://www.dewey.myzen.co.uk/home.html


[[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.

Re: [R] Converting SAS Code

2017-09-30 Thread Robert Baer


On 9/29/2017 3:37 PM, Rolf Turner wrote:
> On 30/09/17 07:45, jlu...@ria.buffalo.edu wrote:
>
> 
>
>>
>> The conceptual paradigm for R is only marginally commensurate with 
>> that of
>> standard statistical software.
>> You must immerse yourself in R to become proficient.
>
> Fortune nomination.
For newer list members wondering what Rolf is talking about try:

library(fortunes) fortune() to get a flavor! There are many pearls of 
wisdom.


>
> cheers,
>
> Rolf
>


[[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] PROC MIXED RANDOM equivalence in R nlme

2017-08-11 Thread Robert Baer



On 8/10/2017 8:34 AM, Dennis F. Kahlbaum wrote:

-- snip --
I don't have real help, but I'll remind you that R is case sensitive, 
and it looks like that will be at least one problem in the solution your 
are working on below:

lme not LME
data not DATA
random = RANDOM

--

The R code I've devised for the PROC MIXED statement is shown below:

--
FitTHC <- LME(ln_thc ~ rv + t5 + t9 + ar + ol + ox + su + bz,
  DATA = emiss,
  RANDOM = ??? )
--

As indicated, the problem I'm having is in constructing the equivalent 
code for the RANDOM and any remaining settings. I've tried


RANDOM = ~1 + rv + t5 + t9 + ar + ol + ox + su + bz | new)

but R hangs 
Are the items in your random formula columns in a dataframe named 
emiss?  Do they have data types?  Even if the data are proprietary some 
fake data can make the problem more concrete.
You are saying "gets caught in a processing loop that produces no errors 
or warnings"???


and never produces a result. Therefore, what is the equivalent code 
for the SAS RANDOM?


Thanks!

__
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.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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 can I make the legend in ggplot2 the same height as my plot?

2017-07-06 Thread Robert Baer

Don't know what your data looks like, but you might  try:

p <-  Scenario1+guides(fill = guide_colorbar(bar width = 1.5, barheight 
= unit(10, "mm")))


print(p)


On 7/5/2017 5:13 PM, Kristi Glover wrote:

Hi R Users,

I tried to increase the legend height in ggplot2, but it did not respond at all 
using the follwoing code. Do you have any suggestions for me?



dat<-data.frame(temperature)

P1<-ggplot(dat, aes(X, Y))

Scenario1<-P1+geom_point(aes(colour = value), size = 1)+ theme_bw()+ 
theme(axis.text.x = element_blank(),axis.text.y = element_blank())

Scenario1<-Scenario1+facet_wrap(~variable, 
ncol=2)+scale_color_gradientn(colours = rainbow(48))

Scenario1+guides(fill = guide_colorbar(bar width = 1.5, barheight = unit(10, 
"mm")))


Thanks,

KG


[[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.


Re: [R] MODISTools Help

2017-06-23 Thread Robert Baer



On 6/22/2017 7:05 PM, Caroline wrote:

##MODISTools example
library(MODISTools)
library(lubridate)
setwd('~/Documents/Modis data')

#MODISTools with buffalo data

###Read in data rename for easier coding
tbdata <- read.csv('~/Desktop/All TB data for EVI, NDVI.csv')
Since this dataset is only on your desktop it cannot help us reproduce 
your error.  Can you supply a small dataset that cause the

error you are talking about?

One way to do this is to use supply the results of
dput(tbdata)
if it is small enough.  If not, maybe create a subset of the data and 
then use dput()


Did you get the problem when you tried with the tutorial Bert suggested?

firstobs <- subset(tbdata, capture.ID == 'B1-1108')
firstobs <- firstobs[,c(1,2,2,3,4)]
colnames(firstobs) <- c('id', 'start.date','end.date','lat','long')

###change date format and change start date to previous 14 days
firstobs$start.date <- dmy(firstobs$start.date)
firstobs$end.date <- dmy(firstobs$end.date)
firstobs$start.date <- firstobs[,2] - as.difftime(14, unit='days') ###time 
frame now spands two weeks

###define parameters
product <- "MOD13Q1"
bands <- c('250m_16_days_EVI', '250m_16_days_NDVI', '250m_16_days_VI_Quality')
pixel <- c(0,0)

###define data
period <- data.frame(lat=firstobs$lat, long=firstobs$long, start.date 
=firstobs$start.date, end.date = firstobs$end.date, id=firstobs$id)


###MODISSubsets
MODISSubsets(LoadDat = period, Products = product, Bands=bands, Size=pixel, 
SaveDir='.', StartDate=T)


###MODISSummaries
MODISSummaries(LoadDat = period, FileSep=',',Product='MOD13Q1', Bands = 
'250m_16_days_EVI', ValidRange=c(-2000,1), NoDataFill=-3000, ScaleFactor = 
0.0001, StartDate = TRUE, Interpolate = T, QualityScreen = TRUE, 
QualityThreshold = 0, QualityBand = '250m_16_days_VI_Quality')



On Jun 22, 2017, at 4:50 PM, Bert Gunter  wrote:

1. You should always cc the list unless there is a clear reason not to.

2. You still have failed to follow the posting guide: You say you have
difficulty troubleshooting your code, but you have shown us no code.
You got an error message that seems explicit, but with neither code
nor data, I do not know whether anyone can make sense of it. In any
case, I certainly cannot.


Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jun 22, 2017 at 4:41 PM, Caroline
 wrote:

Hi Bert,

I have spent a lot of time searching the web for my error message and have gone 
through multiple tutorials. I have not found anything relevant to my error 
message which is why I posted on R-help.

Caroline


On Jun 22, 2017, at 4:38 PM, Bert Gunter  wrote:

This is a specialized package that fairly few of us are likely to have
familiarity with, especialy when you have not followed the posting
guide (below) and posted code and a reproducible example.

That said, a web search on R MODIS appeared to bring up relevant hits,
including a MODIS tutorial. Have you tried that?

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jun 22, 2017 at 2:12 PM, Caroline
 wrote:

I am using MODIS Tools and am having a lot of difficulty troubleshooting my 
code.

I am a PhD student studying African buffalo in Kruger National Park, South 
Africa. The study I am currently working on involves a herd of 200 African 
buffalo caught every six months for 4 years. I am trying to use EVI and NDVI to 
assess seasonal variation thus I would like mean EVI and NDVI for each 
observation (each time each buffalo was captured). I have capture date, lat and 
long for each observation.

However, when using ‘250m_16_days_pixel_reliability’ as my quality control band 
I keep getting the warning message:

Warning in MODISSummaries(LoadDat = period, FileSep = ",", Product = "MOD13Q1", 
 :
Only single data point that passed the quality screen: cannot summarise

When using ‘250m_16_days_VI_Quality’ as my quality control band I keep getting 
the warning message:

Error in QualityCheck(Data = band.time.series, QualityScores = QA.time.series,  
:
QualityScores not all in range of MOD13Q1's QC: 0-3

I seem to get this message with all subsets of my data (I have tried running 
all of my data at once and then just one data point at a time). I have also 
tried using wider date ranges as well as wider size ranges (in case the pixel 
reliability is poor within a certain area or time frame) but still get the same 
messages.
   [[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 

Re: [R] creat contingency tables with fixed row and column margins

2017-05-29 Thread Robert Baer

getAnywhere(fisher.test) probably has some clues


On 5/27/2017 2:49 PM, li li wrote:

Hi all,
   Is there an R function that can be used to enumerate all the contingency
tables with fixed row and column margins. For example, can we list all 3 by
3 tables with row margins 3,6,6 and column margins 5,5,5.
Thanks very much!
Hanna

[[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.


Re: [R] Need help for Netbeans R plugin development

2017-05-29 Thread Robert Baer

rJava and Rserve might be architectures of interest.


On 5/28/2017 1:12 PM, Peter Cheung wrote:

Hi
My name is Peter, developing R plugin for netbeans, it is entirely in Java. 
What is the best way to interact Java with R and how can I hook some R 
functions such as plot()? so everytime plot() is called and i can capture the 
generated graph.
thanks
from Peter
__
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.


Re: [R] Fwd: Cannot generate a *.docx file

2017-05-14 Thread Robert Baer
I don't know what the error is, but your code snippet worked fine for me 
on Windows 10, R 3.4.0-patched.


I noticed that rJava is a dependency.   Don't know that the patch or 
Java updates I installed today could be a difference, but you might 
update packages, patched version,  Java, etc  and try again [since it 
worked here pasted right from your example].



On 5/14/2017 2:30 PM, Yves S. Garret wrote:

I'm using R 3.4.0.

-- Forwarded message --
From: Yves S. Garret 
Date: Sun, May 14, 2017 at 2:35 PM
Subject: Cannot generate a *.docx file
To: r-help 


Hello,

I have the following code example:

library(ReporteRs)

# Create a word document to contain R outputs
doc <- docx()

# Add a title to the document
doc <- addTitle(doc, "Simple Word document", level = 1)

# Add a paragraph of text into the Word document
cat("Output 1\n")
doc <- addParagraph(doc, "This.")
cat("Output 2\n")

# Write the Word document to a file
writeDoc(doc, file = "r-reporters-simple-word-document.docx")

When I run it, this is what I see:

source("writing_to_ms_word_new.R")
Output 1
Error in UseMethod("addParagraph") :
   no applicable method for 'addParagraph' applied to an object of class
"docx"

Why?  The library loads as it should.  So why am I getting the above error?

Thanks in advance.

[[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.


Re: [R] display double dot over character in plotmath?

2017-05-14 Thread Robert Baer
I got this but the spacing is all wrong and plotmath() seems to have no 
way to do kernning or overprinting.  I'm surprised Paul didn't 
generalize the hat()-type functionality.


ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) +
  xlab(expression(atop("\U0308",Omega)))

ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) +
  xlab(expression(atop("\U0308",omega)))


On 5/14/2017 11:18 AM, Ranjan Maitra wrote:

On Sun, 14 May 2017 09:08:46 -0700 David Winsemius  
wrote:


On May 14, 2017, at 8:43 AM, Ranjan Maitra  wrote:

Thanks, Duncan!

This works for the particular case and is, to my mind, a great solution!

However, I was wondering: is it possible to use these double dots with another 
character, such as omega?

I apologize for changing the question somewhat, but I did not realize earlier 
that there were separate codes for putting double dots over different letters 
and I thought that figuring out the simpler question would be enough for me to 
figure out the next step.

I think you should be looking for a LaTeX solution. There is a 
tikzDevice-package.

This says you can assemble symbols with backspaces:

https://www.stat.berkeley.edu/~partha/symbols.pdf

For instance, LATEX defines \hbar (“~”) as a “¯” character (\mathchar’26) 
followed by a backspace of 9 math units (\mkern-9mu), followed by the letter 
“h”:

The second example in ?tikz, which could be a starting point for completing 
your task fails on my Mac by only displaying the names of the glyphs but not 
the glyphs themselves in the plot,  but it might have a better chance of 
succeeding on a Linux box.


Thanks! I was trying to avoid using tikz but I guess that there may well be no 
other alternative.

Best wishes,
Ranjan

__
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] update.packages() error R 3.4.0

2017-04-28 Thread Robert Baer
Is there an easy work-around for the update.packages error I'm getting 
on Windows 10 with R 3.4.0?


> update.packages()
--- Please select a CRAN mirror for use in this session ---
foreign :
 Version 0.8-67 installed in C:/Program Files/R/R-3.4.0/library
 Version 0.8-68 available at https://mirror.las.iastate.edu/CRAN
Update (y/N/c)?  y
Warning in install.packages(update[instlib == l, "Package"], l, repos = 
repos,  :

  'lib = "C:/Program Files/R/R-3.4.0/library"' is not writable
Error in if (file.exists(dest) && file.mtime(dest) > file.mtime(lib) &&  :
  missing value where TRUE/FALSE needed

--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Presentation Quality Tables, e.g., Ten rows, Five columns, with nice headers

2017-03-26 Thread Robert Baer
Quite nice Jim.  A little par() magic, some well thought plot window 
dimensions, and good to go.


I wasn't looking, but now that I've seen it, I can imagine uses.

Bruce - see also 
https://cran.r-project.org/web/packages/xtable/vignettes/xtableGallery.pdf


On 3/26/2017 4:28 PM, Jim Lemon wrote:

Hi Bruce,
Well, a start might be:

bdf<-data.frame(Pre=sample(10:20,10),
  During=sample(8:18,10),
  EOT=sample(5:15,10),fu3mo=sample(7:17,10),
  fu6mo=sample(10:20,10))
rownames(bdf)<-paste("S",1:10,sep="")
plot.new()
library(plotrix)
addtable2plot(0.15,0.2,bdf,display.rownames=TRUE,
  bty="o",vlines=TRUE,hlines=TRUE,title="My table")

Jim


On Mon, Mar 27, 2017 at 4:16 AM, MyCalendar  wrote:

Hi R'ers:
After browsing for a good package for quality table construction, I found 
nothing.
Any advice?
Thanks
Bruce

---
__
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-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] List raster files

2017-03-05 Thread Robert Baer

On 3/4/2017 7:54 AM, Tomás Pérez C. wrote:

I am working with raster images of modis of the satellites aqua and terra
and I need to combine the images by its day and year (originally in Julian
day). However, for the earth I have 6031 images and for aqua 5277. I want
to know how to create an object that selects the images for both folders
with their same date and then create a loop after.
Thank you
You will need to provide more information on how where date information 
is stored and how the files are organized to get any useful response.  
If you are using file time stamps, I'm guessing some system info might 
be useful.  Please read the posting guide and see what you can do to 
help the list help you.







[[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.


Re: [R] Run a Python code from R

2016-11-19 Thread Robert Baer
 From https://www.r-bloggers.com/rpithon-vs-rpython/

"Similar to rPython, the 
rPithon package (http://rpithon.r-forge.r-project.org) allows users to 
execute Python code from R and exchange the data between Python and R. 
However, the underlying mechanisms between these two packages are 
fundamentally different. Wihle rPithon communicates with Python from R 
through pipes, rPython accomplishes the same task with json. A major 
advantage of rPithon over rPython is that multiple Python processes can 
be started within a R session. However, rPithon is not very robust while 
exchanging large data objects between R and Python."


On 11/16/2016 7:10 PM, David Winsemius wrote:
>> On Nov 16, 2016, at 4:53 PM, Nelly Reduan  wrote:
>>
>> Thank you very much for your help !
>>
>>
>> I 'm trying to use the package "rPithon" but I obtain this error message:
> Are you sure you are not just misspelling rPython? If that's not the issue 
> than you need to say where you got rPithon,

 From https://www.r-bloggers.com/rpithon-vs-rpython/

"Similar to rPython, the rPithon package 
(http://rpithon.r-forge.r-project.org) allows users to execute Python 
code from R and exchange the data between Python and R. However, the 
underlying mechanisms between these two packages are fundamentally 
different. While rPithon communicates with Python from R through pipes, 
rPython accomplishes the same task with json. A major advantage of 
rPithon over rPython is that multiple Python processes can be started 
within a R session. However, rPithon is not very robust while exchanging 
large data objects between R and Python."


>> On Wed, Nov 16, 2016 at 4:53 PM, Nelly Reduan  wrote:
>>> Hello,
>>>
>>>
>>> How can I run this Python code from R ?
>>>
>>>
>> import nlmpy
>> nlm = nlmpy.mpd(nRow=50, nCol=50, h=0.75)
>> nlmpy.exportASCIIGrid("raster.asc", nlm)
>>>
>>> Nlmpy is a Python package to build neutral landscape models
>>>
>>> https://pypi.python.org/pypi/nlmpy . The example comes from this website. I 
>>> tried to use the function system2 but I don't know how to use it.
>>>
>>>
>>> path_script_python <- "C:/Users/Anaconda2/Lib/site-packages/nlmpy/nlmpy.py"
>>>
>>> test <- system2("python", args = c(path_script_python, as.character(nRow), 
>>> as.character(nCol), as.character(h)))
>>>
>>> Thanks a lot for your help.
>>> Nell
>>>
>>>
>>> nlmpy 0.1.3 : Python Package Index
>>> pypi.python.org
>>> NLMpy. NLMpy is a Python package for the creation of neutral landscape 
>>> models that are widely used in the modelling of ecological patterns and 
>>> processes across ...
>>>
>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>>
>>> David Winsemius
>>> Alameda, CA, USA
>>>
>>> __
>>> 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] convert matrix

2016-10-30 Thread Robert Baer



On 10/29/2016 11:19 AM, Elham - via R-help wrote:

Dear Madam / Sir,I saw this function for "Convert to matrix as it is that you wanted" 
> test2<-as.matrix(test1)

colnames(test2)<-NULL
genelist<-c("Fkh2","Swi5","Sic1")
rownames(test2)<-genelist
test2
#  [,1]  [,2]  [,3]
#Fkh2 0.141 0.242 0.342
#Swi5 0.224 0.342 0.334
#Sic1 0.652 0.682 0.182


what is function for large data?my data and genelist are 28031 rows,how can I convert? clear that I can not 
write 28031 genes like genelist<-c("Fkh2","Swi5","Sic1")
You can assign the names of your genes by any method convenient. The 
point is not necessarily to use the c() function.   If you have them in 
a .csv file somewhere, simply read them in to create the genelist vector.


If you do not know how to to this you should probably read, "An 
Introduction to R", 
https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf


?read.csv typed at the command prompt will give you some specifics

In the end, you will do something like:
genelist  <- read.csv("AfileOfMyGenes.csv", header = TRUE)

# assume your gene names are in the first column which is titled genename
genelist <- genelist$genename





Your attention would be really appreciated.Best Regards,Elham Dalalbshi Esfahani

[[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.


Re: [R] remove a "corrupted file" after using download.file() with R on Windows 7

2016-09-29 Thread Robert Baer

On 9/28/2016 11:32 PM, Fabien Tarrade wrote:

Hi there,

Sometime download.file() failed to download the file and I would like 
to remove the correspond file.

No answers, but a couple of additional questions:
1)  Does the issue persist if you close R or does the file remain locked 
against deletion?
2) If so, is there a related process in the task list if you use 
CTRL-ALT-DEL?

3) Does   print(e$message) yield any useful information when it hangs?

Would debugging in R Studio shed additional light?

The issue is that I am not able to do it and Windows complain that the 
file is use by another application.
I try to closeAllConnections(), or unlink() before removing the file 
but without sucess.


Any idea how I should proceed &

Please find the code below

 # consider warning as an error
  options(warn=2)

  # try to download the file
  tryCatch({
download.file(url,path_file,mode="wb",quiet=quiet)
return(0)
  },error = function(e){
if(verbose){
  print(e)
  print(e$message)
}
# close file when it failed
if (file.exists(path_file)){
  closeAllConnections()
  #unlink(path_file, recursive=TRUE)
  #file.create(path_file,overwrite=TRUE,showWarning=TRUE)
  #system(paste0('open "', path_file, '"'))
  file.remove(path_file,overwrite=TRUE,showWarning=TRUE)
}
return(1)
}
)

Thanks a lot
Cheers
Fabien



--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Return the indices of rows of a data frame

2016-09-20 Thread Robert Baer



On 9/19/2016 10:37 PM, John wrote:

Hi,

I have the following dataframe:


temp<-data.frame(a=c(1,1,2), b=2:4, c=1:3)
row.names(temp)<-c("D", "E", "F")
temp

   a b c
D 1 2 1
E 1 3 2
F 2 4 3

I would like R to tell me which rows has value "a" equal to 1. The
answer is the first row and the second row, or row D and row E. Which
function should i use? function subset? function which?


row.names(temp[temp$a==1,])

--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Same code on Mac?

2016-09-01 Thread Robert Baer

On 9/1/2016 9:44 AM, Sarah Goslee wrote:

On Wed, Aug 31, 2016 at 4:25 PM, Tom Mosca  wrote:

Using a PC I have written the R code for my elementary statistics students.  
One of the students has a Mac.  Should the same lines of code work on a Mac?

Where can the student find support for R on her Mac?  I don't know anything 
about them, and have never used one.



There's an official FAQ for Mac, just as there is for Windows.
https://cran.r-project.org/faqs.html
There's also a Mac-specific email help list.
https://www.r-project.org/mail.html

Most R code will run as well or better on Mac. All of the OS problems
I've run into tend to be problems with Windows. It's a bit harder to
get some geospatial stuff working on Mac, but that's unlikely to be a
problem with your elementary stats students.
Sarah has pointed you at some Mac support, but some additional advice as 
to the student audience.   [I live in a Windows world most of the time 
and a Ubuntu world the rest of the time, so I have minimal knowledg of 
OSX].Having students install RStudio has really helped because it 
brings cross-platform commonality here and there.


The biggest problems I've run into with beginning statistics students 
are the issues related to getting them connected to our network and/or 
reading in textbook datasets located on that network.  Differences in 
handling of line endings on text files. However, if you do ground work 
to show them how to do some basic basic things early, they can support 
themselves with these things. The commands will work the same


For text files I often have (Windows) students copy data to the 
clipboard and use a command like  x <- read.table(file = 'clipboard', 
sep = '\t', header = TRUE)  so we can work through some statistical 
tests or graphing.   This won't work on a Mac.  An equivalent 
formulation that is helpful on the Mac is x <- read.table(file = 
pipe('pbpaste'), sep = '\t', header = TRUE)


Other than that, I think you'll find R extremely OS agnostic in a 
teaching environment.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] loading .rda file

2016-08-30 Thread Robert Baer
I think that the .rda extension is the old extension convention for what 
now gets the .RData extension name by convention.


These are basically workspaces. These .RData files can contain multiple 
data objects, and all objects seem to read back in with the same name 
that they were saved with using the save() function.  Of course, you can 
assign a new name to the objects you read in with the standard <- or -> 
syntax.


See ?save, to lean how to save them with the new name.  You can save 
just an individual data object in an .rda or .RData file and make the 
data object name match the filename if you so wish.



On 8/30/2016 9:37 AM, Leslie Rutkowski wrote:

Hi,

I'm slowly migrating from SAS to R and - for the very first time - I'm
working with a native .Rda data file (rather than importing data from other
sources). When I load this .Rda file into the global environment using
load("file path") I see a data.frame in the global environment called
"mydata" that corresponds to the .rda file.

My question: how can I change the name of this data.frame to something of
my choosing?

Thanks for considering this very simple question.

Leslie

[[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.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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] Importint stata file and using value labels

2016-08-27 Thread Robert Baer
There has been some good advice not to lose the labels, but perhaps this 
gets you where you seem determined to go?


?read.dta

read.dta(file, convert.dates = TRUE, convert.factors = TRUE,
 missing.type = FALSE,
 convert.underscore = FALSE, warn.missing.labels = TRUE)

or

library(readstata13)

?read.dta13

read.dta13(file, convert.factors = TRUE, generate.factors = FALSE,
  encoding = NULL, fromEncoding = NULL, convert.underscore = FALSE,
  missing.type = FALSE, convert.dates = TRUE, replace.strl = FALSE,
  add.rownames = FALSE, nonint.factors = FALSE)

Perhaps the convert. factors setting at FALSE?


On 08/27/2016 10:55 AM, Michael Friendly wrote:

On 8/26/2016 11:05 AM, Juan Ceccarelli Arias wrote:

Yep. Im a bit stalled.
I can't find the option to import only the values and drop the value 
labels

from the dta file.
Im quite sure R can do that. Then i'd only used the values and i'd 
rely on

my memory.
It isn't a bad alternative.



Hint: use str() to see the class of what you've read.
Then try as.data.frame() on the resulting object read from the .dta file.




__
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] Windows 10 Application Compatibility Check | FreeWare R Statistical Environment v3.2.2

2016-07-26 Thread Robert Baer

Runs fine on Windows 10 for me.


On 7/25/2016 7:18 AM, Ramar, Rohini wrote:

Hello Team,

We are, Citi Application Readiness Team, need your assistance in order to gather info 
about below application compatibility and support for Win 10 as part of Window 10 
Readiness initiative. CITI Bank has been using below "FreeWare R Statistical 
Environment v3.2.2"  software products currently on Win 7 operating system.

We would like to know whether the below listed application is compatible and 
supported even for Win 10 (64 Bit) or is there any other higher version of 
application which would be compatible for Win10. If you have not tested for Win 
10, could you please provide us with a tentative date by when we can reach you.

Application Name : FreeWare R Statistical Environment v3.2.2


Note: Kindly re-direct this email to appropriate team if we reached you wrongly.


Regards,
Rohini R
Citi Architecture & Technology Engineering
Client Computing
Direct Phone #:+91 22 3346 1497
Email ID: rohini.ra...@citi.com



[[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.


Re: [R] Documenting data

2016-06-30 Thread Robert Baer

You might look at:

http://stackoverflow.com/questions/7979609/automatic-documentation-of-datasets

You might also, try the  FIle | Compile Notebook  from within R-Studio 
(https://www.rstudio.com/) on your well-documented R-scripts to get a 
nice reproducible recording/report of data analysis workflow.  Similar 
functionality is available from basic R, but involves more work.  There 
are many other approaches, but the best choice depends on your precise 
needs.


And, as a programmer, you are probably already familiar with things like:
https://google.github.io/styleguide/Rguide.xml



On 6/30/2016 9:51 AM, Pito Salas wrote:

I am studying statistics and using R in doing it. I come from software 
development where we document everything we do.

As I “massage” my data, adding columns to a frame, computing on other data, 
perhaps cleaning, I feel the need to document in detail what the meaning, or 
background, or calculations, or whatever of the data is. After all it is now 
derived from my raw data (which may have been well documented) but it is “new.”

Is this a real problem? Is there a “best practice” to address this?

Thanks!

Pito Salas
Brandeis Computer Science
Feldberg 131

__
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.

Re: [R] x-axis tick marks on log scale plot

2016-05-20 Thread Robert Baer
Very, very nice.  Thanks for sharing.


On 5/20/2016 4:21 AM, Martin Maechler wrote:
>> Brian Smith 
>>  on Thu, 19 May 2016 11:04:55 -0400 writes:
>  > Thanks all !!  On Thu, May 19, 2016 at 9:55 AM, Ivan
>  > Calandra  wrote:
>
>  >> Hi,
>  >>
>  >> You can do it by first plotting your values without the
>  >> x-axis: plot(x,y,log="xy", xaxt="n")
>  >>
>  >> and then plotting the x-axis with ticks where you need to:
>  >> axis(side=1, at=seq(2000,8000,1000))
>
> Getting nicer looking axis ticks  for log-scale axes (and
> traditional graphics) I have created the function
> eaxis()
> and utility functionpretty10exp(.)
>
> and I also created standard R's  axTicks(.)  to help with these.
>
>  if(!require("sfsmisc")) install.packages("sfsmisc")
>  require("sfsmisc")
>
>  x <- lseq(1e-10, 0.1, length = 201)
>  plot(x, pt(x, df=3), type = "l", xaxt = "n", log = "x")
>  eaxis(1)
>
> gives the attached plot
>
>
>
> __
> 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] Use of "file.choose()" or "change working directory" tab causing stall on Mac

2015-12-20 Thread Robert Baer


On 12/19/2015 10:39 PM, Vinny Mo wrote:
> Hello,
>
>
> I used to use the "file.choose()" command quite a lot, as well as the "change 
> working directory" drop down tab as part of my workflow with R, but for over 
> 1 year both of these actions have caused the spinning-wheel to crash R (just 
> R, not any other program).
>
>
> The issue seems to happen when the GUI pops up, and happens about 80% of the 
> time I use either of these actions. This issue has remained constant across 
> different computers (though all macs), different R builds, and different Mac 
> OS's. I had asked about this issue before, and had hoped that this bug might 
> be fixed at some point, but it has persisted.
The posting guide asks for a reproducible example.  This is problematic 
if you only have only an 80% failure rate. Nevertheless, do you have a 
verbatim example that has failed at least once?  If a particular 
formulation fails one time for you, does it always fail or can a certain 
syntax work 1 in 5 times?

If this is a mac-only problem you might get more help on that mailing list:
*https://stat.ethz.ch/mailman/listinfo/r-sig-mac***

You should install the most recent version of R and reproduce the 
problem there.  When posting again, it would be helpful to supply the 
results of
R.Version()   for your setup.

>
> I know I can work around this issue programmatically by typing these commands 
> manually, but both of these features represent a nice function that R has 
> that I'd like to continue to use as was intended. Does anyone have any idea 
> how I might be able to get this functionality back, or if the R Gods have any 
> thoughts about addressing this issue?
>
>   [[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] testing whether two character vectors contain (the same) items in the same order

2015-08-08 Thread Robert Baer



On 8/6/2015 5:25 AM, Federico Calboli wrote:

Hi All,

let’s assume I have a vector of letters drawn only once from the alphabet:

x = sample(letters, 15, replace = F)
x
  [1] z t g l u d w x a q k j f n “v

y = x[c(1:7,9:8, 10:12, 14, 15, 13)]

I would now like to test how good a match y is for x.  Obviously I can 
transform the letters in numbers and use a rank test, but I was left wondering 
whether this is the only solution and whether there are more appropriate 
solutions that are already implemented in R (I am not going to reinvent the 
wheel if I can avoid it).

BW

F

Perhaps
install.packages(stringdist)
help(package = 'stringdist')







--
Federico Calboli
Ecological Genetics Research Unit
Department of Biosciences
PO Box 65 (Biocenter 3, Viikinkaari 1)
FIN-00014 University of Helsinki
Finland

federico.calb...@helsinki.fi

__
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.

Re: [R] testing whether two character vectors contain (the same) items in the same order

2015-08-08 Thread Robert Baer

And I probably should have included this link:
http://journal.r-project.org/archive/2014-1/loo.pdf

On 8/8/2015 12:50 PM, Robert Baer wrote:



On 8/6/2015 5:25 AM, Federico Calboli wrote:

Hi All,

let’s assume I have a vector of letters drawn only once from the 
alphabet:


x = sample(letters, 15, replace = F)
x
  [1] z t g l u d w x a q k j f n “v

y = x[c(1:7,9:8, 10:12, 14, 15, 13)]

I would now like to test how good a match y is for x.  Obviously I 
can transform the letters in numbers and use a rank test, but I was 
left wondering whether this is the only solution and whether there 
are more appropriate solutions that are already implemented in R (I 
am not going to reinvent the wheel if I can avoid it).


BW

F

Perhaps
install.packages(stringdist)
help(package = 'stringdist')







--
Federico Calboli
Ecological Genetics Research Unit
Department of Biosciences
PO Box 65 (Biocenter 3, Viikinkaari 1)
FIN-00014 University of Helsinki
Finland

federico.calb...@helsinki.fi

__
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.

Re: [R] R GUI plot by color

2015-07-26 Thread Robert Baer



On 7/24/2015 6:23 AM, Jim Lemon wrote:

Hi jpara3,
Your example, when I got it to go:

one-c(3,2,2)
two-c(a,b,b)
data-dataframe(one,two)
plot(data$one,col=data$two)
Wow Jim. Psychic indeed!  Not only did you answer with NO reproducible 
example, but on round 2 you fixed a non-working example and explained 
why it was an accident that it works.  What is the stock market about to 
do? :)


jpara3 - Those of us without Jim's talent can be more helpful if you 
read and follow the guide at the bottom of each email.:


PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





does indeed work, and I'll explain how. You are plotting the values of
data$one against the _values_ of data$two (see point 3 of my
response). In this case, the values of data$two are of class factor,
which means that they have numeric values attached to the levels (a,
b) of the factor. When you pass these values as the col argument,
they are silently converted to their numeric values (1,2,2). In the
default palette, these numbers represent the colors - black, red, red.
Those are the colors in which the points are plotted. So far, so good.
Let's look at the other two points that I guessed.

1) The column names of data2 are not numbers

colnames(data)
[1] one two

As you can see, the column names are character variables, and they
don't translate to numbers:

as.numeric(colnames(data))
[1] NA NA

2) The number of columns in data2 is not equal to the number of values
in data1 that you are plotting

It's pretty obvious that there are two values in the column names and
three in the vector of values that you are plotting in your
example.So, I think I got three out of three without knowing what the
data were.

Jim


On Fri, Jul 24, 2015 at 7:53 PM, jpara3 j.para.fernan...@hotmail.com wrote:

I have done a trial with a dataframe like this:
one-c(3,2,2)
two-c(a,b,b)
data-dataframe(uno,dos)

plot(data$one,col=data$two)

and it plots perfect.
If you paste the code above in R, it has errors and does NOT plot 
perfectly.   I still did not understand what you were trying to do. You 
owe Jim big time.



If I try it with the code that i have post in the first message, selecting
data1 and data2 as i nthis example, the plot is plotted, but all dots with
the same color.

Thanks for the answer but noone of the 3 topics is the root problem.





--
View this message in context: 
http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710300.html
Sent from the R help mailing list archive at Nabble.com.

__
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-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] Downloading file.Rdata from internet

2015-05-04 Thread Robert Baer


On 5/3/2015 7:58 PM, Rafael Costa wrote:
 Dear R users,

 To load the file into http://www.datafilehost.com/d/c7f0d342;, I first
 uncheck the Use our download manager and get recommended downloads option
 and I click the DOWNLOAD button. How do I load and save the file directly
 from R?

 Any help on this is most appreciated.
Use the load command:
?load

On windows it might look something like:

load(C:/Users/Rafael Costa/Downloads/tabela1.1.RData)



 Thanks in advance,
 Rafael Costa.

   [[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.

-- 


Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
rbaer(at)atsu.edu


[[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] gdata library 2.16.1

2015-05-04 Thread Robert Baer



On 5/4/2015 9:01 AM, Marc Girondot wrote:

Dear list-members,

Since I update gdata library to 2.16.1 version this morning, I have an 
error on the two macs I use (details on system and R versions at the 
end).


When I load the package, I have this error:

 library(gdata, 
lib.loc=/Library/Frameworks/R.framework/Versions/3.2/Resources/library)

gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Then if I try installXLSXsupport(), I get another error:
 installXLSXsupport()
Error in installXLSXsupport() :
Unable to install Perl XLSX support libraries.

But my perl system seems to be ok:
 system(perl -v)

This is perl 5, version 16, subversion 3 (v5.16.3) built for 
darwin-thread-multi-2level


and the perl folder is correctly located in 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/gdata/perl/


And of course if I try to use read.xls, I get an error (xxx.xlsx is a 
valid file):

 info - read.xls(xxx.xlsx), stringsAsFactors=FALSE)
WARNING: Perl module Spreadsheet::ParseXLSX cannot be loaded.
WARNING: Microsoft Excel 2007 'XLSX' formatted files will not be 
processed.


Does someone have a solution ? (other than saving file in .csv ! )

Don't know about this problem, but much has been written on various 
alternatives (e.g., http://www.milanor.net/blog/?p=779)

One of their suggestions is (cross-platform, java-based solution),

require(XLConnect)
wb=loadWorkbook(myfile.xlsx)
df=readWorksheet(wb,sheet=Sheet1,header=TRUE)







Thanks

Marc


R version 3.2.0 Patched (2015-05-01 r68301) -- Full of Ingredients
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

OS: MacOSX - Yosemite

__
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.


--


Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
rbaer(at)atsu.edu

__
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] Obfuscate AES password

2015-04-14 Thread Robert Baer
I'm not sure I completely understand your authentication needs, but 
perhaps the RCurl package could be of some use to you.


Rob

On 4/13/2015 1:26 AM, Luca Cerone wrote:

Thanks Jeff,
and OK I'll move next questions on the topic to the devel list :)

I was hoping there were packages that already dealt with this sort of
things, that's why I posted my question here in the first place..

Thanks a lot for helping me with this,

Cheers,
Luca

[[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.


--


Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
rbaer(at)atsu.edu

__
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] API request from R

2015-02-19 Thread Robert Baer

On 2/19/2015 8:06 AM, Barry Rowlingson wrote:
 On Wed, Feb 18, 2015 at 11:44 AM, Mittal Ashra via R-help
 r-help@r-project.org wrote:
 Dear All,
 Apologies for mailing it to the whole crowd. This is Mittal, presently 
 working in a Project where we have build a platform for displaying 
 recommendations and the results are based on the statistical models.
 I have gone through the CRAN repository to look out for an package which 
 converts the R code into an JAVA API and that can be called from the 
 platform. However, did not find any. If anyone can guide me to the right 
 package that will be grateful.
 The packages can be similar to DeployR from Revolution Analytics.
   I doubt there's anything smart enough to take a set of R functions
 and magically create all the necessary Java boilerplate code that
 constitutes an implementation of an API in Java (cynics would say Java
 was all boilerplate...).

   There's the rJava package, which includes the JRI system for calling
 R from Java. Then your java can kick off an R engine and do R stuff:
I thought rJava called java from R not the other way around.

Description: Low-level interface to Java VM very much like .C/.Call and 
friends. Allows creation of objects, calling methods and accessing fields.





[boilerplate code deleted]

Rengine re=new Rengine(args, false, new TextConsole());

[more deleted boilerplate]

re.eval(data(iris),false);

 What you would have to do would be to write the Java
 functions/methods/classes with the appropriate arguments for your API
 and make them call the R code this way.

   I think RCaller is another way of doing this from Java - its not on
 CRAN since its not an R package, its a Java library.

 Barry

 __
 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.

-- 


Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
rbaer(at)atsu.edu


[[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] Installing RStudio

2015-02-12 Thread Robert Baer


On 2/12/2015 10:22 AM, John Sorkin wrote:

Windows 7, 64-bit.
  
I am trying to install RStudio. Before installing RStudio, I installed R 3.1.2. During the installation or R, I installled (as per the default) 32- and 64-bit packages. When I tried to install RStudio, I received the message

R does not appear to be installed. Please install R before using RStudio.
I know R is installed, beacuse I am able to run R.
Can anyone suggest what I can do to get RStudio installed?
Thank you
John
  
Tools  Global opetions  general, and fill in the top box to point the 
top line at the Installed version of R you wish to use. Usually, it will 
do a pretty good job of finding it on its own, but you can always adjust 
you version to suit here.


Rob



John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for ...{{dropped:18}}


__
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] Question about range of letters

2014-10-04 Thread Robert Baer


On 10/4/2014 8:21 AM, Nia Gupta wrote:

Hello,

I have a column with a bunch of letters. I would like to keep some of these 
letters (A,C,D,L) and turn the rest into 'X'.

I have tried using ifelse with '|' in between the argument but it didn't work 
nor did 4 separate ifelse statements.

Example, I currently have:
LettersABCDE
I would like to have:
LettersAXCDX
Thank you

[[alternative HTML version deleted]]

try:
let = sample(LETTERS[1:5],100,replace=TRUE)
let
let1 =  ifelse(let %in% c('A','C','D'),let,'X')
let1


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] very basic series correlation question

2014-01-05 Thread Robert Baer


On 1/4/2014 7:42 PM, Peter Turner wrote:

Hi, I hope the following question is appropriate for the list; reflects
that I've yet to use R and have limited statistical sensibility.

I've two metal ion concentration data sets, one each for two nearby
watercourses recorded over the same period (2008 to 2012), for which the
sampling dates differ across that period.

Would R's cor (stats) function be suitable to obtain a correlation measure
for the Y data sets?
Probably if it is paired on years. Start by plotting your data as 
scatter plot to check linearity. To read the help:

?plot
Then read ?cor and note the method argument.  By default cor() gives you 
Pearson correlation coefficients, but depending on the nature of your 
data, non-parametric Spearman or Kendall coefficients might be more 
appropriate.

Is there a better or more appropriate option?


Thanks, Peter

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rJava problems

2013-12-08 Thread Robert Baer

You don't really provide enough information like
 R.Version()

but my guess is that you are running 64-bit R either directly or through 
R Studio but that you have only 32-bit Java installed.   I am doing fine 
on Windows with Java 7 update 45 but had some 64-bit run issues with 
only Java 7 update 40 64-bit JDK.


HTH,
Rob


On 12/8/2013 8:03 AM, Tolga Uzuner wrote:

Dear R Users
Have run into a problem with the rJava package recently. I do not seem 
to be able to load the package. I am on R 3.0.2 and updated the rJava 
package this morning from the Pennsylvania mirrors. I get the 
following error:



package ‘mnormt’ successfully unpacked and MD5 sums checked
package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
 library(rJava)
Error in get(Info[i, 1], envir = env) :
cannot allocate memory block of size 2.8 Gb
Error: package or namespace load failed for ‘rJava’



Any pointers ?

Thanks in advance

__
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-guide.html

and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Robert Baer

On 12/2/2013 9:35 AM, Bert Gunter wrote:
 Not true, Rich.
The point about alphabetical ordering explains why the author likely 
explicitly set the levels for the factor, though.

As to why ordered factors, we may never know, but one possible 
explanation is that at some point he was going to use statistics where 
he wanted to use polynomial contrasts. See

options()$contrasts

Note that the default contrast type differs for normal factors and ordered 
factors.



 z -factor(letters[1:3],lev=letters[3:1])
 sort(z)
 [1] c b a
 Levels: c b a

 What you say is true only for the **default** sort order.

 (Although maybe the code author didn't realize this either)

 -- Bert


 On Mon, Dec 2, 2013 at 7:24 AM, Richard M. Heiberger r...@temple.edu wrote:
 If days of the week is not an Ordered Factor, then it will be sorted
 alphabetically.
 Fr Mo Sa Su Th Tu We

 Rich

 On Mon, Dec 2, 2013 at 6:24 AM, Bill william...@gmail.com wrote:
 I am reading the code below. It acts on a csv file called dodgers.csv with
 the following variables.


 print(str(dodgers))  # check the structure of the data frame
 'data.frame':   81 obs. of  12 variables:
   $ month  : Factor w/ 7 levels APR,AUG,JUL,..: 1 1 1 1 1 1 1 1 1
 1 ...
   $ day: int  10 11 12 13 14 15 23 24 25 27 ...
   $ attend : int  56000 29729 28328 31601 46549 38359 26376 44014 26345
 44807 ...
   $ day_of_week: Factor w/ 7 levels Friday,Monday,..: 6 7 5 1 3 4 2 6 7
 1 ...
   $ opponent   : Factor w/ 17 levels Angels,Astros,..: 13 13 13 11 11 11
 3 3 3 10 ...
   $ temp   : int  67 58 57 54 57 65 60 63 64 66 ...
   $ skies  : Factor w/ 2 levels Clear ,Cloudy: 1 2 2 2 2 1 2 2 2 1
 ...
   $ day_night  : Factor w/ 2 levels Day,Night: 1 2 2 2 2 1 2 2 2 2 ...
   $ cap: Factor w/ 2 levels NO,YES: 1 1 1 1 1 1 1 1 1 1 ...
   $ shirt  : Factor w/ 2 levels NO,YES: 1 1 1 1 1 1 1 1 1 1 ...
   $ fireworks  : Factor w/ 2 levels NO,YES: 1 1 1 2 1 1 1 1 1 2 ...
   $ bobblehead : Factor w/ 2 levels NO,YES: 1 1 1 1 1 1 1 1 1 1 ...
 NULL
 I don't understand why the author of the code decided to make the factor
 days_of_week into an ordered factor. Anyone know why this should be done?
 Thank you.

 Here is the code:

 # Predictive Model for Los Angeles Dodgers Promotion and Attendance

 library(car)  # special functions for linear regression
 library(lattice)  # graphics package

 # read in data and create a data frame called dodgers
 dodgers - read.csv(dodgers.csv)
 print(str(dodgers))  # check the structure of the data frame

 # define an ordered day-of-week variable
 # for plots and data summaries
 dodgers$ordered_day_of_week - with(data=dodgers,
ifelse ((day_of_week == Monday),1,
ifelse ((day_of_week == Tuesday),2,
ifelse ((day_of_week == Wednesday),3,
ifelse ((day_of_week == Thursday),4,
ifelse ((day_of_week == Friday),5,
ifelse ((day_of_week == Saturday),6,7)))
 dodgers$ordered_day_of_week - factor(dodgers$ordered_day_of_week,
 levels=1:7,
 labels=c(Mon, Tue, Wed, Thur, Fri, Sat, Sun))

 # exploratory data analysis with standard graphics: attendance by day of
 week
 with(data=dodgers,plot(ordered_day_of_week, attend/1000,
 xlab = Day of Week, ylab = Attendance (thousands),
 col = violet, las = 1))

 # when do the Dodgers use bobblehead promotions
 with(dodgers, table(bobblehead,ordered_day_of_week)) # bobbleheads on
 Tuesday

 # define an ordered month variable
 # for plots and data summaries
 dodgers$ordered_month - with(data=dodgers,
ifelse ((month == APR),4,
ifelse ((month == MAY),5,
ifelse ((month == JUN),6,
ifelse ((month == JUL),7,
ifelse ((month == AUG),8,
ifelse ((month == SEP),9,10)))
 dodgers$ordered_month - factor(dodgers$ordered_month, levels=4:10,
 labels = c(April, May, June, July, Aug, Sept, Oct))

 # exploratory data analysis with standard R graphics: attendance by month
 with(data=dodgers,plot(ordered_month,attend/1000, xlab = Month,
 ylab = Attendance (thousands), col = light blue, las = 1))

 # exploratory data analysis displaying many variables
 # looking at attendance and conditioning on day/night
 # the skies and whether or not fireworks are displayed
 library(lattice) # used for plotting
 # let us prepare a graphical summary of the dodgers data
 group.labels - c(No Fireworks,Fireworks)
 group.symbols - c(21,24)
 group.colors - c(black,black)
 group.fill - c(black,red)
 xyplot(attend/1000 ~ temp | skies + day_night,
  data = dodgers, groups = fireworks, pch = group.symbols,
  aspect = 1, cex = 1.5, col = group.colors, fill = group.fill,
  layout = c(2, 2), type = c(p,g),
  strip=strip.custom(strip.levels=TRUE,strip.names=FALSE, style=1),
  xlab = Temperature (Degrees Fahrenheit),
  ylab = Attendance (thousands),
  key = list(space = top,
  text = list(rev(group.labels),col = rev(group.colors)),
  points = list(pch = rev(group.symbols), col = rev(group.colors),
  fill = rev(group.fill

 # attendance by opponent and 

Re: [R] how to install R 3.0.1

2013-05-31 Thread Robert Baer

On 5/31/2013 11:59 AM, Ranjan Maitra wrote:

Hi John,

I suspect you may be missing a c()?

On Fri, 31 May 2013 06:05:45 -0800 John Kane jrkrid...@inbox.com
wrote:


paks  -  install.packages( Hmisc, plyr)

paks - install.packages( c(Hmisc, plyr))



   install.packages(paks)
You can use the command  library()  to get a list of what is installed on your 
machine.

Is it possible to get this as a vector of only the package names, or
is post-processing the output of library() the only way out?

Do you mean something like:
paks = library()$results[,1]
save(paks, file = 'paks.RData')
Rob

--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Rank Amateur Question

2013-05-29 Thread Robert Baer

You probably want from windows GUI:

source(test.R)
To read help to learn about this command type:
?source
at the command prompt. (Similar pattern get help on other commands too - 
its an important R skill/habit).


If your are going to do a lot of script development, I would highly 
recommend you take a look at RStudio, 
http://www.rstudio.com/ide/download/ which is a front end for R that 
greatly streamlines script development and use.


Rob


On 5/28/2013 1:07 PM, Mark Russell wrote:

Greetings,

  


I have just downloaded R onto a 64bit PC running Microsoft 7 Home Edition
via Rgui. I have quite a bit of programming experience, though not as a
professional programmer. I am a Measurement and Assessment professional
(standardized testing). I would like to be able to write R scripts, and call
them from the command line in Rgui. After two attempts, I receive the
following error messages

  


R CMD BATCH test.R

Error: unexpected symbol in R CMD

  


Rscript test.R

Error: unexpected symbol in Rscript test.R

  


These commands were taken directly from the R documents found on the
R-project website.

  


Clearly, I am doing something wrong. The script test.R resides in the R
directory, and includes

  


24 + 6

  


and nothing more. The path to test.R is C:\Program Files\R\test.R

  


Any assistance would be appreciated.

  


Mark Russell, MEd MESA

  


Quidquid Latine dictum sit altum videtur.

  



[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Very basic statistics in R

2013-05-08 Thread Robert Baer

On 5/6/2013 7:02 AM, arun wrote:
   stErr- sd(vec1)/sqrt(length(vec1))

Or possibly,

 stErr- sd(vec1)/sqrt(!is.na(vec1))


--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Scatterplot and Causality

2013-04-22 Thread Robert Baer

On 4/22/2013 9:48 AM, Lorenzo Isella wrote:

Dear All,
I hope this is not too off topic.
I am given a set of scatteplots (nothing too fancy; think about a
normal x-y 2D plot).
I do not deal with two time series (indeed I have no info about time).
If I call A=(A1,A2,...) and B=(B1, B2, ...) the 2 variables (two
vectors of numbers most of the case, but sometimes they can be
categorical variables), I can plot one against the other and I
essentially I need to determine whether

A=f(B, noise) or B=g(A, noise)

where the noise is the effect of other possibly unknown variables,
measurement errors etc and f and g are two functions.

Without the noise, if I want to test if A=f(B) [B causes A], then I
need at least to ensure that f(B1)!=f(B2) must imply B1!=B2 (different
effects must have a different cause), whereas it is not ruled out that
f(B1)=f(B2) for B1!=B2 (different causes may lead to the same effect).

However, in presence of the noise, these properties will hold only
approximately soany idea about how a statistical test, rather than
eyeballing, to tell apart A=f(B, noise) vs B=g(A, noise)?
Any suggestion is welcome.
It strikes me that this is not a particularly productive approach to 
causality, particularly in an observational setting.  You would need to 
design an experiment where you had a known manipulation of an 
explanatory variable and studied the change in a response variable, and 
then, you came back with the roles  reversed.  I don't think R or indeed 
any statistical package can help you here.


Rob


Lorenzo

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] scanning data in R

2013-04-03 Thread Robert Baer
On 4/3/2013 4:33 AM, Naser Jamil wrote:
 Dear R-user,
 May I seek your suggestion.  I have a data file 'stop' to be scanned in R.
 But I want to ignore one specific number '21' there. Putting differently, I
 want to get all numbers in the file except 21. Is there any command to
 achieve it?

 --

 b-scan(F:\\stop.txt)

 --
Well, I don't know what is in stop.txt, but I will assume  it is a 
string of numbers or strings separated by the end of line character and 
then a terminating EOL.  Read it in as you have it and then:
b - b[-21]

If you are reading in a dataframe, simply use what you have and then do:
b - b[-21, ]

and you should have what you want, or perhaps you want
b[21, ] -  NA  # indicate row 21 as a missing value


 Many thanks for your kind attention.

 Regards,
 Jamil.


 __
 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-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA


[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Console display buffer size

2013-04-01 Thread Robert Baer

On 4/1/2013 4:08 PM, Peter Ehlers wrote:

On 2013-04-01 13:37, Ted Harding wrote:

Greetings All.
This is a somewhat generic query (I'm really asking on behalf
of a friend who uses R on Windows, whereas I'm on Linux, but
the same phenomenon appears on both).

Say one has a largish dataframe -- call it G -- which in the
case under discussion has 592 rows and 41 columns. The intention
is to display the data by simply entering its name (G) as command.

Say the display console has been set wide enough to display 15
columns (determined by lengths of column names). Then R will output
succesively to the console, in continuous flow:
   Chunk 1: rows 1:592 of columns 1:15
   Chunk 2: rows 1:592 of columns 16:30
   Chunk 3: rows 1:592 of columns 31:41
If the number of rows that can be displayed on the screen is, say, 60,
then only rows 533:592 of Chunk 3 will be visible in the first instance.

However, on my Linux system at any rate, I can use Shift+PgUp to
scroll back up through what has been output to the console. It seems
that my friend proceeds similarly.

But now, after a certain number of (Shift+PgUps), one runs out
of road before getting to Row 1 of Chunk 1 (in my friend's case,
only Rows 468-592 of Chunk 1 can be seen).

The explanation which occurs to me is that the console has a buffer
in which such an output is stored, and if the dataframe is too big
then lines 1:N (for some N) of the output are dropped from the start
of the buffer, and it is impossible to go further back than line (N+1)
of Chunk 1 where in this case N=467 (of course one may not even be
able to go further back than Chunk K, for some K  1, for a bigger
dataframe).

The query I have is: In the light of the above, is there a way to
change the size of the buffer so that one can scroll all the way
back to the very first row of Chunk 1? (The size-change may perhaps
have to be determined empirically).


Isn't this set by the 'bufbytes' and 'buflines' specifications in the
Rconsole file?
Anyway, it's probably best to use 'View' to inspect data.

Although I have not tried them, Windows RGUI  [ -- Edit | GUI 
Preferences --] has settings for both buffer and lines which on my 
64-bit machine default to 25 and 8000 respectively.


Rob Baer


Peter Ehlers



With thanks,
Ted.

-
E-Mail: (Ted Harding) ted.hard...@wlandres.net
Date: 01-Apr-2013  Time: 21:37:17
This message was sent by XFMail

__
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-guide.html

and provide commented, minimal, self-contained, reproducible code.



__
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-guide.html

and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do you graph data when you have lots of small values but few extremely large values?

2013-03-29 Thread Robert Baer

On 3/29/2013 10:52 AM, Shane Carey wrote:

I was thinking of splitting the y-axis into two? Is this possible?

Thanks


Look at the plotrix package and see:
https://stat.ethz.ch/pipermail/r-help/2011-September/290685.html


--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-help Digest, Vol 121, Issue 5

2013-03-26 Thread Robert Baer
On 3/26/2013 7:21 AM, Kerry wrote:
 Thank you Jason!  actually, there have been two solutions and one is yours

 setting row.names=F works great, additionally what Ive been having problems 
 with is the European version of Word 2010.  Apparently it sets delimiters of 
 ; instead of , as in the English/USA version.  This is something that 
 messes not only with R exporting txt or csv files, but will effect Office 
 products, ArcGIS and several more.  So having to go into the Region and 
 Language settings of the computer and changing the defaults has cleared up 
 quite a bit of the issues I was having with R.
   
 ~K
?read.csv2
This is a wrapper to read.table().   read.csv2 expects the delimiter to 
be '; by default and the decimal to be ,  by default.


 Not all who wander are lost
 K. L. Nicholson PhD
 Associate Wildlife Biologist®




 
   From: Law, Jason jason@portlandoregon.gov


 Sent: Tuesday, March 5, 2013 5:31 PM
 Subject: RE: R-help Digest, Vol 121, Issue 5

 On R 2.15.2 and ArcGIS 9.3.1, it works for me in ArcCatalog but you have to 
 follow the particulars here:

 http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Accessing_delimited_text_file_data

 For example:

 write.table(test, '***.tab', sep = '\t', row.names = F)

 The extension .tab and sep = '\t' are required for text files.  Didn't test 
 row.names=T but I wouldn't count on that working either.

 Jason Law
 Statistician
 City of Portland, Bureau of Environmental Services
 Water Pollution Control Laboratory
 6543 N Burlington Avenue
 Portland, OR 97203-5452
 503-823-1038
 jason@portlandoregon.gov

 -Original Message-
 Date: Mon, 04 Mar 2013 10:48:39 -0500
 From: Duncan Murdoch murdoch.dun...@gmail.com

 Cc: r-help@r-project.org r-help@r-project.org
 Subject: Re: [R] Mysterious issues with reading text files from R in
  ArcGIS and Excel
 Message-ID: 5134c257.6020...@gmail.com
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed

 On 04/03/2013 10:09 AM, Kerry wrote:
 It seems within the last ~3 months Ive been having issues with writing text 
 or csv files from a R data frame.  The problem is multifold and it is hard 
 to filter  out what is going on and where the problem is.  So, Im hoping 
 someone else has come across this and may provide insight.
 I think you need to provide a simple example for us to try, either by
 putting a small example of one of your files online for us to download,
 or (better) by giving us self-contained code to duplicate the problem.

 You might also get better help (especially about ArcGIS) on the
 R-sig-Geo mailing list: https://stat.ethz.ch/mailman/listinfo/r-sig-geo.

 Duncan Murdoch



 My current settings for R:
 R version 2.15.2 (2012-10-26)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 locale:

 [1] LC_COLLATE=Swedish_Sweden.1252  LC_CTYPE=Swedish_Sweden.1252
 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C
 [5] LC_TIME=Swedish_Sweden.1252

 attached base packages:
 [1] tcltk stats graphics  grDevices utils datasets  methods   
 base

 other attached packages:
 [1] adehabitat_1.8.11 shapefiles_0.6foreign_0.8-51tkrplot_0.0-23
 ade4_1.5-1

 loaded via a namespace (and not attached):
 [1] tools_2.15.2

 I am using Microsoft Excel 2010 and ArcGIS 10.1sp1 for Desktop

 Basically, no matter what data frame I am working on, when I export it to a 
 text file to be use in Excel or ArcGIS problems arise.  Im not sure if it is 
 R or these other programs, maybe forums for ArcGIS might be more 
 appropriate, but this problem only occurs when I use tables that have been 
 produced from an R session.

 When I try to open a text file in Excel, either I get an error message 
 stating
 The file you are trying to open is in a different format than specified by 
 the file extension.  Verify that the file is not corrupted and is from a 
 trusted source.
 Followed by
 Excel has detected that 'file.txt' is a SYLK file, but cannot load it.  
 Either the file has errors or is not a SYLK file format.  Click OK to open 
 the file in a different format
 Then the file opens


 Otherwise, the file opens fine the first time through - and looks ok. I 
 can't figure out what Im doing different between the two commands of 
 write.table as they are always written the same:
 write.csv(file, file = D:/mylocations/fileofinterest.csv) or 
 write.table(file, file = D:/mylocations/fileofinterest.txt)
 Sometimes I will try to add sep = , or sep = ; but these don't make a 
 difference (which I didn't figure they would).

 The other program I use is ArcGIS and bringing in a txt file from R is 
 really messing things up as 2 new columns of information are typically added 
 and date/time data is usually lost with txt files, but not with csv files.

 For instance - a text file that looks like this in Excel:
id   x   ydateR1dmedR1dmean R1error 
 R2error
 1 F07001 1482445 6621768 2007-03-05 10:00:53 2498.2973 

Re: [R] Automatic script for updating packages in R

2013-03-25 Thread Robert Baer

try,
update.packages(ask='graphics', checkBuilt=TRUE)
?update.packages
?download.file
?url  #  file:// URLs

On 3/25/2013 6:09 AM, PIKAL Petr wrote:

Hi

Strange, I thought that only Windows users are sending Html mail and providing 
sparse info describing their problems.

I presume, you use 2.15.3 R version.

There is some readme in Ubuntu CRAN repository and if you followed that and 
fail it would be necessary to provide at least what you did (some code) and 
what was the error messages.

http://cran.r-project.org/bin/linux/ubuntu/README

Regards
Petr



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Twaha Mlwilo
Sent: Monday, March 25, 2013 11:21 AM
To: r-h...@stat.math.ethz.ch
Subject: [R] Automatic script for updating packages in R


Hello all,Good day,Internet access have been a problem , and learning R





forced to download packages manual.I  have google for script for
automatic R update  didnt getPlease any one with help?am using ubuntu
12.04R-2.5.3Thank you
[[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-
guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating a boxplot from a data summary

2013-03-24 Thread Robert Baer

On 3/24/2013 11:39 AM, Josh Hall wrote:

Hi,
I'm trying to create a boxplot from the summary of a large data set and I'm
having trouble finding any way to do this.  I'm familiar with, but by no
means good at, using R, so the only two websites I've found pertaining to
this issue have been way over my head.  I was hoping for a simple set of
instructions that I could follow to produce a boxplot, in R, for three
groups of data, with 8 weighted responses.  For example, the groups are
three different professions, each asked to fill out and rank 8 statements
in order from 1-8.  Ideally these would be on one graphic output, but if
that can't be done, one output per group would be suitable.


Look at the help for bxp:
?bxp

# The following give you insight into a boxplot structure
bp = boxplot(list(a=rnorm(10),b = rnorm(10), c = rnorm(10)))
bp



[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxplot

2013-03-22 Thread Robert Baer
On the subject of boxplots, I have multiple data sets of unequal sample 
sizes and was wondering what would be the most efficient way to read in 
the data and plot side-by-side boxplots, with options for controlling 
the orientation of the plots (i.e. vertical or horizontal) and the 
spacing? Your assistance is greatly appreciated, but please try to be 
explicit as I am no R expert.


Thanks Janh

Not sure without a reproducible example (please read posting guide) but 
maybe this will help:


a = sample(1:100, 30)
b = sample(1:100, 50)
c = sample(50:100,19)
d = sample(1:50, 15)
e = sample(1:50, 15)
f = sample(1:50, 25)

x11(width = 7, height = 3.5)
op =par(mfrow = c(1,2))  # plot side by side

# horizontal
boxplot(list(a,b,c), horizontal = TRUE, main = 'Horizontal',
xlim = c(0,9), names = c('a', 'b','c'))
boxplot(list(e, f), horizontal = TRUE, xlim = c(0,9), names = c('e', 'f'),
at = c(7,8), add = TRUE, col ='red')

# vertical
boxplot(list(a,b,c), horizontal = FALSE, xlim = c(0,9), main = 'Verticalal',
 names = c('a', 'b','c'))
boxplot(list(e, f), horizontal = FALSE, xlim = c(0,9), names = c('e', 'f'),
at = c(7,8), add = TRUE, col ='red')
par(op)

Cheers,

Rob



___
 Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to skip part of the code

2013-03-20 Thread Robert Baer

On 3/20/2013 8:21 AM, PIKAL Petr wrote:

Hi


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Andras Farkas
Sent: Wednesday, March 20, 2013 2:11 PM
To: r-help@r-project.org
Subject: [R] how to skip part of the code

Dear All,

another quick question, this one is on skipping part of my code, so let
us say:

a -5
b -2
e -0

d -a+b
f -a-b

what I would like to do is to have R NOT to calculate the value for d
in case the value of e equals to zero (essentially skip that chunk),
but instead move on to calculate te value for f. In the code I am
working with the value of e changes, and I would like to calculate d
and f at all times when the value of e is greater then zero. If
possible, I would like to do this without using the functions ifelse
and if else

Why? This is exactly the reason for which if else was invented?

I am not sure if some simple solution without if is available.

if (e  0) { d - a+b; f - a-b }

seems to be simple.

Regards
Petr
I second Petr on the question, why not use if?  But this might meet your 
criteria.

a - 5
b - 2
e - 0

#
dat - data.frame(a, b, e)


dat$d[dat$e   0] - a + b
dat$f - a - b




appreciate the help,

Andras
[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Export R generated tables and figures to MS Word

2013-03-13 Thread Robert Baer
R2wd (http://cran.r-project.org/web/packages/R2wd/R2wd.pdf 
http://cran.r-project.org/web/packages/R2wd/R2wd.pdf) might do what 
you want.

Rob

On 3/12/2013 7:02 PM, Santosh wrote:
 Dear Rxperts,
 I am aware of Sweave that generates reports into a pdf, but do know of any
 tools to generate to export to a MS Word document...

 Is there  a way to use R to generate and export report/publication quality
 tables and figures and export them to MS word (for reporting purposes)?

 Thanks so much,
 Santosh

   [[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-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA


[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] image color analysis

2013-03-13 Thread Robert Baer

On 3/13/2013 12:05 AM, ishi soichi wrote:

I am not sure if I should ask this question in this list. But I'll try.

Currently I am trying to analyze images using EBImage and biOps.
One of the features that I need to extract from various images is the color
spectrum, namely, which colors each image consists of.

So, each image hopefully can be converted into some sort of color histogram
so that color ingredients are easily comparable with each other.

There are so many functionalities that these packages and others provide,
and I am hoping that someone would give me some guideline for the analysis.

Any suggestion?
Your question is quite general, so I'll make a couple of general 
comments, returning us to R at the end.


You need to read about spectral color systems, for example 
http://www.fourmilab.ch/documents/specrend/. You undoubtedly have used 
filters, whether a Bayer filter typically built into a color camera or 
more specific filters if you have used a monochrome camera to collect 
non-RGB channels.  You need to know what type of transforms might have 
been performed during the storage process.  For example, has the image 
already been transformed to RGB space before storage? In fluorescent 
spectroscopy, for example, it is common to use pseudo-coloring so the 
channels of the stored image may not be directly convertible into 
spectral color without additional information.


R can do all the appropriate matrix algebra once you define the 
specifics of your individual conversion.


Hope this helps,

Rob




Thanks.

ishida

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating 1-bit and 8-bit BMP files using R

2013-03-05 Thread Robert Baer

On 3/5/2013 12:51 AM, Ingo Reinhold wrote:

Hi,

I'm trying to use the data which I generate within R to make images in .bmp 
format to be lateron printed by a printer.

My first thought was the RImageJ package, but this seems to be discontinued. What I am 
currently doing is generating a matrix of grey values, which needs to be parsed into the 
right image format. Is anyone aware of a package or rather easy way to 
generate these images using R?
Sorry to hear this about RImageJ.  I did find that old versions are 
still available in the repository archive: 
http://cran.r-project.org/src/contrib/Archive/RImageJ/


Some of the capabilities you might be looking for are available in 
EBImage on Bioconductor, but I don't remember specifically whether the 
.bmp format was supported.


Rob

Many thanks,

Ingo

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rJava works with 32-bit but not 64

2013-02-06 Thread Robert Baer
For what it is worth Spencer, I can start rJava in both 32-bit R and 
64-bit R for Windows 7.  [And could even before Simon fixed the error 
message).


And yes, I have both 32-bit Java and 64-bit Java 1.7.0_13 installed.  
They should be separate entries under your control panel.


Rob

--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rJava works with 32-bit but not 64

2013-02-04 Thread Robert Baer
Is it feasible to have both installed in a way that allows the 
each version of R to select its own version of Java?  A comment on 
stackoverflow suggests that may not be easy 
(http://stackoverflow.com/questions/5272216/is-it-possible-to-install-both-32bit-and-64bit-java-on-windows-7). 



One of the simplest ways to be sure of getting 64-bit Java is to use the 
64-bit version of Internet Explorer which makes things almost automatic.


Rob

--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Calculation of extremely low p-values (in lm)

2012-12-03 Thread Robert Baer

On 12/3/2012 6:20 AM, Sindri wrote:

Dear R-users

Please excuse me if this topic has been covered before, but I was unable to
find anything relevant by searching

I am currently doing a comparison of two biological variables that have a
highly significant linear relationship.   I know that the p-value of linear
regression is not so interesting in itself, but this particular value does
raise a question.

How does R calculate (extremely low) p-values for linear regression?

For my data I got a p-value on the order of 10^-9 and a reviewer commented
on this.  I tried to run the same analysis in both SAS and Sigmastat to be
sure that I was doing it right, but both these programs only return a
p-value of p  0.0001
Since I am unable to reproduce my results in another statistics program, it
would be nice to be able to explain this unusally low p-value to the
reviewers.
This is a matter of you understanding that the p-value is an area under 
a probability density curve.  R is simply printing out the actual area 
in a tail of some distribution.  The other statistical program is making 
the assumption that you are using the p-value to compare to a cutoff 
alpha value that is (in most fields) never set much below p0.001.  If p 
 alpha the hypothesis test crowd , would choose to reject NULL  
hypothesis, so the other statistics programs take the attitude --  why 
provide more detail?.  R chooses to give you the actual number and let 
you do what you will with it.  You could probably benefit from reviewing 
hypothesis testing in a basic statistics book if this is not clear.


Note that 10e-9 is indeed less than 0.0001, so the programs don't 
disagree.  R just provides more detail.




This problem can be illustrated with the following made-up data:

x_var-c(0.149,0.178,0.3474,0.167,0.121,0.182,0.176,0.448,0.091,0.083,0.090,0.407,0.378,0.132,0.227,0.172,0.088,0.392,0.425,0.150,0.319,0.190,0.171,0.290,0.214,0.431,0.193)

y_var-c(0.918,0.394,0.131,0.9084,0.916,0.934,0.928,0.279,0.830,0.927,0.964,0.323,0.097,0.914,0.614,0.790,0.984,0.530,0.207,0.858,0.408,0.919,0.869,0.347,0.834,0.276,0.940)

fit-lm(y_var~x_var)


summary(fit)

Call:
lm(formula = y_var ~ x_var)

Residuals:
  Min   1Q   Median   3Q  Max
-0.39152 -0.06027  0.00933  0.10024  0.22711

Coefficients:
 Estimate Std. Error t value Pr(|t|)
(Intercept)  1.186960.06394  18.562 3.90e-16 ***
x_var   -2.255290.24788  -9.098 2.08e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1503 on 25 degrees of freedom
Multiple R-squared: 0.768,  Adjusted R-squared: 0.7588
F-statistic: 82.78 on 1 and 25 DF,  p-value: 2.083e-09


With kind regards,
Sindri Traustason



-
-
Sindri Traustason
Glostrup Hospital Ophthalmology Research Dept.
Copenhagen, Demark

--
View this message in context: 
http://r.789695.n4.nabble.com/Calculation-of-extremely-low-p-values-in-lm-tp4651823.html
Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
__
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] r function definition

2012-12-03 Thread Robert Baer

On 12/3/2012 2:30 PM, qq wrote:

I am a very new R user. I am trying to write functons and debug functions.
One problem for me is that I need to alwasy copy the whole function body and
resubmit to R console every time I changed even one line of the function.
Because I have long algorithm function, copying and pasting is very tedious
for me. I assume if I save the function files, R should be able to just use
the new function body since it is a scripting language. Can somebody let me
know his best practice of using R function?
You might be at the point where a development environment is useful.  
There are multiple choices, but I'm quite fond of RStudio.

http://www.rstudio.com/ide/download/

Rob




--
View this message in context: 
http://r.789695.n4.nabble.com/r-function-definition-tp4651943.html
Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
__
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] screen if a value is within range

2012-12-01 Thread Robert Baer

On 12/1/2012 10:50 AM, Andras Farkas wrote:

Dear all,
  
could you please give me some pointers on how I could make R screen for a value if it falls within a certain range?

I looked at the subset function, but is not doing it, perhaps because I only 
have 1 value to screen?
  
aptreciate the input
  
ex:

a -16.5
I would like to screen to see if a is within the range of 15 to 20, (which it 
is:-)), and I would like the code to return a value of 1 if a is within the 
specified range or 0 if it is not.
  
Apreciate the insights,
  
Andras

[[alternative HTML version deleted]]

a = 16.5
ans = (a = 15  a = 20)
ans
[1] TRUE

Rob

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lines density

2012-11-17 Thread Robert Baer
On 11/17/2012 4:38 AM, bgnumis wrote:
 Hi all,

 I attach a picture, with my output plot.

 I put this command to obtain it:

 hist(MCT[,2],probability=TRUE,xlab= ,ylab=Max,main=M distribution)
 lines(density(MCT[,2]), lwd = 2)

 The problem is that when I extract the bell is too high? And the higher
 part doesn´t appear in the plot. There is some trick to adjust the line on
 the plotted area?

Use the ylim= argument of hist to change the y scale
?hist
Perhaps,
ylim = range(density(MCT[,2]),

But without data and a full working example I couldn't test it.

Rob


 __
 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-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
__
Robert W Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 US


[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rgl package and animation

2012-11-05 Thread Robert Baer

-- snip --
 On 11/4/2012 7:45 AM, Duncan Murdoch wrote:


First, draw the new sphere at the first point and save the object id:

sphereid - sphere3d(dat[1,c(X, Y, Z)], col=red, radius=1)

# Also save the spinner that you like:

spin - spin3d( ) #maybe with different parms

# Now, the animation function:

f - function(time) {
   par3d(skipRedraw = TRUE) # stops intermediate redraws
   on.exit(par3d(skipRedraw=FALSE)) # redraw at the end

   rgl.pop(id=sphereid) # delete the old sphere
   pt - time %% 40 + 1 # compute which one to draw
   pnt - dat[pt, c(X, Y, Z)] # maybe interpolate instead?
   sphereid - spheres3d(pnt, radius=1, col=red)
   spin(time)
}

Duncan Murdoch


Thanks so much Duncan!

I probably never would have gotten there without your help. (Especially
since I had to look at the help for the - operator, which is
conceptually a level beyond where I usually work).   It would be great
to have an additional creative example or two for  f(time) functions in
the play3d() help.  Your useful code comments really help me see what
needs to happen in an f(time) function.

I really appreciate that you took the time to get me going!



I've made a small addition to the spin3d function and added an example 
to the ?spin3d page.  This isn't on CRAN yet, but you can get the 
latest from R-forge.  Make sure you get 0.92.898 or newer.


The new example shows a rotating view of spinning cubes, using the 
sprites3d function within the animation function.


Duncan Murdoch

Thanks so much for taking the time to do this and for all the other 
contributions you make to the R community!


I should tell you that I also looked at your rgl function writeWebGL() 
over the weekend, and I think it holds tremendous potential for sharing 
visualizations of multidimensional data with a non-technical audience.  
Who knew it could be so easy to move three dimensional data from R to 
the web?


Rob Baer

--
__
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] exporting 3D dynamic graph

2012-11-05 Thread Robert Baer
On 11/5/2012 8:23 AM, Christophe Genolini wrote:
 Hi the list,

 Using misc3d, we can export 3d dynamic graph in pdf format.

 Is it also possible to export these graph into a format that we can publish 
 on the web?

 Christophe
You don't provide enough information to know exactly what your needs 
are,  but writeWebGL() in the rgl function may be of some use in doing 
what you want.  I don't think that it can handle the dynamic part on 
its own yet, but perhaps with some creative JavaScript additions you can 
get there.

Rob




 __
 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-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
__
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA


[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Saving R Graph to a file

2012-11-04 Thread Robert Baer

Some hints:
For pdf(), height and width are in inches, not pixels.  dev.off() is 
necessary after drawing the image for pdf(). The name for the file 
argument (file=c:/figure.xxx) is file not filename


hist(CO2[,5]) is more interesting

And yes,
?pdf
?postscript
?ping

On 11/3/2012 11:16 PM, frespider wrote:

Hi

I am not sure why I can't get my plot saved to a file as .ps, I searched
online and I found that I have to use something is called postscript,png or
pdf function which I did but still not working.

Actually what I have is a matrix with almost 300-400 columns. I need to
create a histogram and boxplot for some columns as .ps file (with reasonable
size if i can adjust that would be nice also) so I can import them in my
latex code to display a good chart on my report.  And I found out R display
a certain limit of device.
Can you please help me code this?

This an example I create
data(CO2)
png(filename=C:/R/figure.png, height=295, width=300,  bg=white)
hist(CO2[,4])
device.off()
pdf(filename=C:/R/figure.pdf, height=295, width=300,  bg=white)
hist(CO2[,4])
postscript(filename=C:/R/figure.pdf, height=295, width=300,  bg=white)
hist(CO2[,4])


Thanks





--
View this message in context: 
http://r.789695.n4.nabble.com/Saving-R-Graph-to-a-file-tp4648369.html
Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
__
Robert W Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 US

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Saving R Graph to a file

2012-11-04 Thread Robert Baer

On 11/4/2012 4:32 AM, Robert Baer wrote:

Some hints:
For pdf(), height and width are in inches, not pixels.  dev.off() is 
necessary after drawing the image for pdf(). The name for the file 
argument (file=c:/figure.xxx) is file not filename


hist(CO2[,5]) is more interesting

And yes,
?pdf
?postscript

?png


On 11/3/2012 11:16 PM, frespider wrote:

Hi

I am not sure why I can't get my plot saved to a file as .ps, I searched
online and I found that I have to use something is called 
postscript,png or

pdf function which I did but still not working.

Actually what I have is a matrix with almost 300-400 columns. I need to
create a histogram and boxplot for some columns as .ps file (with 
reasonable

size if i can adjust that would be nice also) so I can import them in my
latex code to display a good chart on my report.  And I found out R 
display

a certain limit of device.
Can you please help me code this?

This an example I create
data(CO2)
png(filename=C:/R/figure.png, height=295, width=300, bg=white)
hist(CO2[,4])
device.off()
pdf(filename=C:/R/figure.pdf, height=295, width=300, bg=white)
hist(CO2[,4])
postscript(filename=C:/R/figure.pdf, height=295, width=300, 
bg=white)

hist(CO2[,4])


Thanks





--
View this message in context: 
http://r.789695.n4.nabble.com/Saving-R-Graph-to-a-file-tp4648369.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html

and provide commented, minimal, self-contained, reproducible code.






--
__
Robert W Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 US

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rgl package and animation

2012-11-03 Thread Robert Baer

On 11/3/2012 6:47 AM, Duncan Murdoch wrote:

On 12-11-02 7:47 PM, Robert Baer wrote:

I am trying to figure out how to use rgl package for animation.  It
appears that this is done using the play3d() function.  Below I have
some sample code that plots a 3D path and puts a sphere at the point
farthest from the origin (which in this case also appears to be at the
end of the path).  What I would like to do is animate the movement of
another sphere along the length of the path while simultaneously
rotating the viewport.

Duncan Murdock's (wonderful) Braided Knot YouTube video:
   (http://www.youtube.com/watch?v=prdZWQD7L5c)
makes it clear that such things can be done, but I am having trouble
understanding how to construct the f(time) function that gets passed to
play3d().  The demo(flag) example is a little helpful, but I still can't
quite translate it to my problem.

Can anyone point to some some simple f(time) function examples that I
could use for reference or give me a little hint as to how to construct
f(time) for movement along the path while simultaneously rotating the
viewport?

Thanks,

Rob



library(rgl)
# Generate a 3D path
dat -
structure(list(X = c(0, 0.06181308, 0.002235635,
-0.03080658, -0.1728054, -0.372467, -0.5877065,
-0.8814848, -1.103668, -1.366157, -1.625862, -1.948066,
-2.265388, -2.689826, -3.095001, -3.49749, -3.946068,
-4.395653, -4.772034, -5.111259, -5.410515, -5.649475, -5.73439,
-5.662201, -5.567145, -5.390334, -5.081581, -4.796631,
-4.496559, -4.457024, -4.459564, -4.641746, -4.849105,
-5.0899430001, -5.43129, -5.763724, -6.199448, -6.517578,
-6.864234, -6.907439), Y = c(0, -0.100724,
-0.1694719,
0.036505999886, -0.09299519, -0.222977, -0.3557596,
-0.3658229, -0.3299489, -0.2095574,
-0.08041446,
0.02013388, 0.295372, 0.1388314, 0.2811047,
0.2237614, 0.1419052, 0.06029464,
-0.09330875,
-0.2075969, -0.3286296, -0.4385684,
-0.4691093,
-0.6235059, -0.5254676, -0.568444, -0.6388859,
-0.727356, -1.073769, -1.0321350001, -1.203461, -1.438637,
-1.6502310001, -1.861351, -2.169083, -2.4314730001,
-2.6991430001,
-2.961258, -3.239381, -3.466103), Z = c(0, 0.1355290002,
0.40106200024, 1.216374, 1.5539550003, 1.7308050003,
1.8116760003, 2.185124, 2.5260320004, 3.034794,
3.4265440004, 3.822512, 4.7449040002, 4.644837,
5.4184880002, 5.8586730001, 6.378356, 6.8339540001,
7.216339, 7.5941160004, 7.9559020004, 8.352936, 
8.709319,

9.0166930003, 9.4855350003, 9.9000550001, 10.397003,
10.932068, 11.025726, 12.334595, 13.177887, 13.741852, 14.61142,
15.351013, 16.161255, 16.932831, 17.897186, 18.826691, 19.776001,
20.735596), time = c(0, 0.0116, 0.0196,
0.0311, 0.0391, 0.0507,
0.0623,
0.0703, 0.0818, 0.0899,
0.101,
0.109, 0.121, 0.129, 
0.141,

0.152, 0.16, 0.172, 0.18, 0.191,
0.199, 0.211, 0.222, 0.23,
0.242, 0.25, 0.262, 0.27, 0.281,
0.289, 0.301, 0.312, 0.32,
0.332, 0.34, 0.351, 0.359,
0.371, 0.379, 0.391)), .Names = 
c(X,

Y, Z, time), row.names = c(1844, 1845, 1846, 1847,
1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855,
1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863,
1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871,
1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879,
1880, 1881, 1882, 1883), class = data.frame)


# Plot 3d path
with(dat, plot3d(X,Y,Z, type = 'l', col = 'blue', lty = 1))

# get absolute distance from origin
dat$r = sqrt(dat$X ^ 2 + dat$Y ^ 2 + dat$Z ^ 2)
mr = max(dat$r)  # yes sorry, didn't get copied to original 
email code

mxpnt = dat[dat$r == mr,] # Coordinates of furthest point

# Plot a blue sphere at max distance
plot3d(mxpnt$X, mxpnt$Y, mxpnt$Z, type = 's', radius = 1, col = 'blue',
add = TRUE)



Your code didn't include the mr variable, but I assume it's just 
max(dat$r).  With that assumption, I'd do the animation function as 
follows:


First, draw the new sphere at the first point and save the object id:

sphereid - sphere3d(dat[1,c(X, Y, Z)], col=red, radius=1)

# Also save the spinner that you like:

spin - spin3d( ) #maybe with different parms

# Now, the animation function:

f - function(time) {
  par3d(skipRedraw = TRUE) # stops intermediate redraws
  on.exit(par3d(skipRedraw=FALSE)) # redraw at the end

  rgl.pop(id=sphereid) # delete the old sphere
  pt - time %% 40

[R] rgl package and animation

2012-11-02 Thread Robert Baer
I am trying to figure out how to use rgl package for animation.  It 
appears that this is done using the play3d() function.  Below I have 
some sample code that plots a 3D path and puts a sphere at the point 
farthest from the origin (which in this case also appears to be at the 
end of the path).  What I would like to do is animate the movement of 
another sphere along the length of the path while simultaneously 
rotating the viewport.


Duncan Murdock's (wonderful) Braided Knot YouTube video:
 (http://www.youtube.com/watch?v=prdZWQD7L5c)
makes it clear that such things can be done, but I am having trouble 
understanding how to construct the f(time) function that gets passed to 
play3d().  The demo(flag) example is a little helpful, but I still can't 
quite translate it to my problem.


Can anyone point to some some simple f(time) function examples that I 
could use for reference or give me a little hint as to how to construct 
f(time) for movement along the path while simultaneously rotating the 
viewport?


Thanks,

Rob



library(rgl)
# Generate a 3D path
dat -
structure(list(X = c(0, 0.06181308, 0.002235635,
-0.03080658, -0.1728054, -0.372467, -0.5877065,
-0.8814848, -1.103668, -1.366157, -1.625862, -1.948066,
-2.265388, -2.689826, -3.095001, -3.49749, -3.946068,
-4.395653, -4.772034, -5.111259, -5.410515, -5.649475, -5.73439,
-5.662201, -5.567145, -5.390334, -5.081581, -4.796631,
-4.496559, -4.457024, -4.459564, -4.641746, -4.849105,
-5.0899430001, -5.43129, -5.763724, -6.199448, -6.517578,
-6.864234, -6.907439), Y = c(0, -0.100724, 
-0.1694719,

0.036505999886, -0.09299519, -0.222977, -0.3557596,
-0.3658229, -0.3299489, -0.2095574, 
-0.08041446,

0.02013388, 0.295372, 0.1388314, 0.2811047,
0.2237614, 0.1419052, 0.06029464, 
-0.09330875,
-0.2075969, -0.3286296, -0.4385684, 
-0.4691093,

-0.6235059, -0.5254676, -0.568444, -0.6388859,
-0.727356, -1.073769, -1.0321350001, -1.203461, -1.438637,
-1.6502310001, -1.861351, -2.169083, -2.4314730001, 
-2.6991430001,

-2.961258, -3.239381, -3.466103), Z = c(0, 0.1355290002,
0.40106200024, 1.216374, 1.5539550003, 1.7308050003,
1.8116760003, 2.185124, 2.5260320004, 3.034794,
3.4265440004, 3.822512, 4.7449040002, 4.644837,
5.4184880002, 5.8586730001, 6.378356, 6.8339540001,
7.216339, 7.5941160004, 7.9559020004, 8.352936, 8.709319,
9.0166930003, 9.4855350003, 9.9000550001, 10.397003,
10.932068, 11.025726, 12.334595, 13.177887, 13.741852, 14.61142,
15.351013, 16.161255, 16.932831, 17.897186, 18.826691, 19.776001,
20.735596), time = c(0, 0.0116, 0.0196,
0.0311, 0.0391, 0.0507, 
0.0623,
0.0703, 0.0818, 0.0899, 
0.101,

0.109, 0.121, 0.129, 0.141,
0.152, 0.16, 0.172, 0.18, 0.191,
0.199, 0.211, 0.222, 0.23,
0.242, 0.25, 0.262, 0.27, 0.281,
0.289, 0.301, 0.312, 0.32,
0.332, 0.34, 0.351, 0.359,
0.371, 0.379, 0.391)), .Names = c(X,
Y, Z, time), row.names = c(1844, 1845, 1846, 1847,
1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855,
1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863,
1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871,
1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879,
1880, 1881, 1882, 1883), class = data.frame)


# Plot 3d path
with(dat, plot3d(X,Y,Z, type = 'l', col = 'blue', lty = 1))

# get absolute distance from origin
dat$r = sqrt(dat$X ^ 2 + dat$Y ^ 2 + dat$Z ^ 2)
mxpnt = dat[dat$r == mr,] # Coordinates of furthest point

# Plot a blue sphere at max distance
plot3d(mxpnt$X, mxpnt$Y, mxpnt$Z, type = 's', radius = 1, col = 'blue', 
add = TRUE)


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Java, rJava, and Windows x64

2012-10-29 Thread Robert Baer
When running [1] R version 2.15.1 (2012-06-22) x86_64-pc-mingw32, 
rJava fails. I have installed both the 32-bit and 64-bit versions of 
Java 7 update 9.


 library(rJava)
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: stop(No CurrentVersion entry in ', key, '! Try re-installing 
Java and make sure R and Java have matching architectures.)

error: object 'key' not found
Error: package/namespace load failed for ‘rJava’


It appears that rJava was not seeing the x64 Java. For clarity, I 
installed the 32-bit java library second, and I imagined this might be 
the problem. The Java installer told me that it was already present, and 
the x64 library appeared to be working with the 64-bit IE9 browser


Indeed, reinstalling Java x64, the rJava package iloaded fine with the 
library(rJava) command in 64-bit R. rJava could STILL be loaded with 
library(rJava) within x86 R.


My question is, should the order of Java installation affect the ability 
of rJava to load under 64-bit R? Are there environmental variables or 
registry settings that should be checked in such cases or is it 
literally necessary to do a complete reinstall?


Rob

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RMySQL install on windows

2012-10-12 Thread Robert Baer

On 10/10/2012 12:58 PM, Greg Snow wrote:

I finally was able to compile/load it under windows 7.  I had similar
problems to what you show below.

I set the MYSQL_HOME environmental variable through windows (start
button  control panel  System and Security  system  Advanced
System Settings  Environmental variables).  I had to set it to the
version of the path without spaces, in my case it was:
c:\PROGRA~1\MySQL\MYSQLS~1.5

Then I opened a command prompt window, changed to the directory where
I  had downloaded the tar.gz file from cran and entered the command:
c:\Program Files\R\R-2.15.1\bin\x64\R CMD INSTALL RMySQL_0.9-3.tar.gz

and everything worked (it did not work if I used i386 or just the
regular bin folder, possibly due to the version of MySQL I
downloaded).

Then I started a new instance of R and did library(MySQL) and
everything loaded and I was able to connect to a local MySQL database.

Hope this helps you as well.



Thanks, Greg.   I got a couple of warnings during the build, but I can 
at least load the library.  Now, I'll to to learn to use itG


I had downloaded the 64-bit MySQL engine.  The seemingly successful 
install was on R (64-bit).


I guess not unexpectedly I get the from R (i386)
 library(RMySQL)
Error: package ‘RMySQL’ is not installed for 'arch=i386'

Appreciate the guidance.

Rob

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RMySQL install on windows

2012-10-09 Thread Robert Baer
I have been trying to install RMySQL on Windows 7 following the 
procedure at:

http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

I think I have properly installed RTools and created a proper 
Renviron.site file saying:

MYSQL_HOME=C:/Program Files/MySQL/MySQL Server 5.5

When I try to install the packages from source, I get warnings that 
suggest I'm still not quite with the program yet. There are comments 
about POSIX paths that I don't quite grasp. Can anyone give me 
additional hints?


There seems to be a libmysql.dll in the /lib subdirectory although the 
install seems to be looking in the /bin directory for a file of similar 
name. Is this something that has changed with recent versions of MySQL 
that should be fixed in the RMySQL package or is it something I can work 
around by hand or by properly setting some environmental variable?


Thanks,

Rob

The errors ...

 install.packages('RMySQL',type='source')
trying URL 'http://cran.wustl.edu/src/contrib/RMySQL_0.9-3.tar.gz'
Content type 'application/x-gzip' length 165363 bytes (161 Kb)
opened URL
downloaded 161 Kb

* installing *source* package 'RMySQL' ...
** package 'RMySQL' successfully unpacked and MD5 sums checked
checking for $MYSQL_HOME... C:/Program Files/MySQL/MySQL Server 5.5
cygwin warning:
MS-DOS style path detected: C:/Program
Preferred POSIX equivalent is: /cygdrive/c/Program
CYGWIN environment variable option nodosfilewarning turns off this 
warning.

Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
test: Files/MySQL/MySQL: unknown operand
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-215~1.1/etc/x64/Makeconf
Preferred POSIX equivalent is: 
/cygdrive/c/PROGRA~1/R/R-215~1.1/etc/x64/Makeconf
CYGWIN environment variable option nodosfilewarning turns off this 
warning.

Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc -m64 -IC:/PROGRA~1/R/R-215~1.1/include -DNDEBUG -IC:/Program 
Files/MySQL/MySQL Server 5.5/include 
-Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -std=gnu99 
-mtune=core2 -c RS-DBI.c -o RS-DBI.o

RS-DBI.c: In function 'RS_na_set':
RS-DBI.c:1219:11: warning: variable 'c' set but not used 
[-Wunused-but-set-variable]
gcc -m64 -IC:/PROGRA~1/R/R-215~1.1/include -DNDEBUG -IC:/Program 
Files/MySQL/MySQL Server 5.5/include 
-Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -std=gnu99 
-mtune=core2 -c RS-MySQL.c -o RS-MySQL.o

RS-MySQL.c: In function 'RS_MySQL_fetch':
RS-MySQL.c:657:13: warning: variable 'fld_nullOk' set but not used 
[-Wunused-but-set-variable]

RS-MySQL.c: In function 'RS_DBI_invokeBeginGroup':
RS-MySQL.c:1137:30: warning: variable 'val' set but not used 
[-Wunused-but-set-variable]

RS-MySQL.c: In function 'RS_DBI_invokeNewRecord':
RS-MySQL.c:1158:20: warning: variable 'val' set but not used 
[-Wunused-but-set-variable]

RS-MySQL.c: In function 'RS_MySQL_dbApply':
RS-MySQL.c:1219:38: warning: variable 'fld_nullOk' set but not used 
[-Wunused-but-set-variable]
gcc -m64 -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o 
RS-MySQL.o C:/Program Files/MySQL/MySQL Server 5.5/bin/libmySQL.dll 
-Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 
-Ld:/RCompile/CRANpkg/extralibs64/local/lib 
-LC:/PROGRA~1/R/R-215~1.1/bin/x64 -lR
gcc.exe: error: C:/Program Files/MySQL/MySQL Server 
5.5/bin/libmySQL.dll: No such file or directory

ERROR: compilation failed for package 'RMySQL'
* removing 'C:/Program Files/R/R-2.15.1/library/RMySQL'

The downloaded source packages are in
‘C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ\downloaded_packages’
Warning messages:
1: running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD INSTALL -l 
C:/Program Files/R/R-2.15.1/library 
C:\Users\rbaer\AppData\Local\Temp\Rtmps9adPQ/downloaded_packages/RMySQL_0.9-3.tar.gz' 
had status 1

2: In install.packages(RMySQL, type = source) :
installation of package ‘RMySQL’ had non-zero exit status
 R.Version()
$platform
[1] x86_64-pc-mingw32

$arch
[1] x86_64

$os
[1] mingw32

$system
[1] x86_64, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 15.1

$year
[1] 2012

$month
[1] 06

$day
[1] 22

$`svn rev`
[1] 59607

$language
[1] R

$version.string
[1] R version 2.15.1 (2012-06-22)

$nickname
[1] Roasted Marshmallows

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading Chess Data

2012-09-11 Thread Robert Baer

On 9/2/2012 11:41 AM, David Arnold wrote:

All,

What would be the most efficient way to load the data at the following
address into a dataframe?

http://ratings.fide.com/top.phtml?list=men
It depends.  The most efficient for me was to highlight it, copy it to 
the windows clipboard and execute the following R command.

chess - read.table(file='clipboard', header = TRUE, sep = '\t')

If you want you can then set it to use in an R post or a script:
chess2 - dput(chess)
chess2
# You would include similar to the following in your script or email:
chess3 -
structure(list(Rank = 1:101, Name = structure(c(17L, 8L, 48L,
77L, 66L, 5L, 45L, 18L, 40L, 61L, 35L, 91L, 88L, 44L, 97L, 30L,
29L, 53L, 42L, 33L, 90L, 75L, 56L, 21L, 41L, 1L, 96L, 6L, 26L,
83L, 15L, 99L, 4L, 58L, 14L, 64L, 79L, 82L, 9L, 47L, 63L, 69L,
7L, 55L, 60L, 86L, 95L, 74L, 84L, 92L, 93L, 20L, 52L, 80L, 81L,
98L, 67L, 94L, 38L, 24L, 19L, 31L, 2L, 87L, 49L, 13L, 25L, 46L,
16L, 39L, 3L, 23L, 22L, 78L, 12L, 51L, 37L, 89L, 34L, 72L, 70L,
101L, 10L, 85L, 100L, 54L, 65L, 28L, 76L, 32L, 57L, 71L, 50L,
43L, 68L, 62L, 27L, 73L, 59L, 36L, 11L), .Label = c( Adams, Michael,
 Akopian, Vladimir,  Alekseev, Evgeny,  Almasi, Zoltan,
 Anand, Viswanathan,  Andreikin, Dmitry,  Areshchenko, Alexander,
 Aronian, Levon,  Bacrot, Etienne,  Balogh, Csaba,  Bartel, 
Mateusz,
 Bauer, Christian,  Berkes, Ferenc,  Bologan, Viktor,  Bruzon 
Batista, Lazaro,
 Bu, Xiangzhi,  Carlsen, Magnus,  Caruana, Fabiano,  Cheparinov, 
Ivan,

 Ding, Liren,  Dominguez Perez, Leinier,  Dreev, Aleksey,
 Edouard, Romain,  Efimenko, Zahar,  Eljanov, Pavel,  Fressinet, 
Laurent,
 Fridman, Daniel,  Gareev, Timur,  Gashimov, Vugar,  Gelfand, 
Boris,
 Georgiev, Kiril,  Gharamian, Tigran,  Giri, Anish,  Grachev, 
Boris,

 Grischuk, Alexander,  Gupta, Abhijeet,  Gyimesi, Zoltan,
 Harikrishna, P.,  Inarkiev, Ernesto,  Ivanchuk, Vassily,
 Jakovenko, Dmitry,  Jobava, Baadur,  Jones, Gawain C B,
 Kamsky, Gata,  Karjakin, Sergey,  Kasimdzhanov, Rustam,
 Korobov, Anton,  Kramnik, Vladimir,  Kryvoruchko, Yuriy,
 Kurnosov, Igor,  Laznicka, Viktor,  Le, Quang Liem,  Leko, Peter,
 Li, Chao b,  Malakhov, Vladimir,  Mamedyarov, Shakhriyar,
 Matlakov, Maxim,  McShane, Luke J,  Meier, Georg,  Moiseenko, 
Alexander,

 Morozevich, Alexander,  Motylev, Alexander,  Movsesian, Sergei,
 Naiditsch, Arkadij,  Najer, Evgeniy,  Nakamura, Hikaru,
 Navara, David,  Negi, Parimarjan,  Nepomniachtchi, Ian,
 Ni, Hua,  Nielsen, Peter Heine,  Onischuk, Alexander,
 Petrosian, Tigran L.,  Polgar, Judit,  Ponomariov, Ruslan,
 Potkin, Vladimir,  Radjabov, Teimour,  Ragger, Markus,
 Riazantsev, Alexander,  Rublevsky, Sergei,  Sargissian, Gabriel,
 Sasikiran, Krishnan,  Shirov, Alexei,  Short, Nigel D,
 So, Wesley,  Sokolov, Ivan,  Sutovsky, Emil,  Svidler, Peter,
 Tiviakov, Sergei,  Tomashevsky, Evgeny,  Topalov, Veselin,
 Vachier-Lagrave, Maxime,  Vallejo Pons, Francisco,  Van Wely, Loek,
 Vitiugov, Nikita,  Volokitin, Andrei,  Wang, Hao,  Wang, Yue,
 Wojtaszek, Radoslaw,  Zhigalko, Sergei,  Zvjaginsev, Vadim
), class = factor), Title = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
), .Label =  g, class = factor), Country = structure(c(22L,
1L, 25L, 3L, 27L, 16L, 25L, 18L, 26L, 25L, 25L, 5L, 25L, 27L,
6L, 17L, 3L, 15L, 13L, 21L, 25L, 26L, 3L, 7L, 25L, 10L, 26L,
25L, 12L, 19L, 7L, 24L, 15L, 10L, 20L, 14L, 25L, 16L, 12L, 26L,
1L, 25L, 26L, 25L, 26L, 21L, 25L, 15L, 10L, 12L, 11L, 6L, 29L,
25L, 1L, 6L, 8L, 21L, 16L, 26L, 5L, 5L, 1L, 17L, 26L, 15L, 26L,
28L, 6L, 25L, 25L, 12L, 25L, 2L, 12L, 8L, 15L, 21L, 25L, 27L,
6L, 25L, 15L, 23L, 4L, 6L, 25L, 27L, 25L, 12L, 25L, 9L, 25L,
10L, 16L, 25L, 14L, 1L, 14L, 16L, 24L), .Label = c( ARM,  AUT,
 AZE,  BLR,  BUL,  CHN,  CUB,  CZE,  DEN,  ENG,
 ESP,  FRA,  GEO,  GER,  HUN,  IND,  ISR,  ITA,
 LAT,  MDA,  NED,  NOR,  PHI,  POL,  RUS,  UKR,
 USA,  UZB,  VIE), class = factor), Rating = c(2843L,
2816L, 2797L, 2788L, 2783L, 2780L, 2778L, 2773L, 2769L, 2758L,
2754L, 2752L, 2747L, 2746L, 2742L, 2738L, 2737L, 2737L, 2734L,
2730L, 2730L, 2729L, 2729L, 2725L, 2724L, 2722L, 2718L, 2718L,
2714L, 2714L, 2713L, 2713L, 2713L, 2713L, 2712L, 2712L, 2712L,
2707L, 2705L, 2705L, 2705L, 2704L, 2702L, 2700L, 2699L, 2699L,
2699L, 2698L, 2698L, 2697L, 2697L, 2694L, 2693L, 2693L, 2693L,
2691L, 2691L, 2691L, 2690L, 2689L, 2689L, 2687L, 2687L, 2687L,
2686L, 2685L, 2684L, 2684L, 2683L, 2683L, 2682L, 2678L, 2677L,
2677L, 2676L, 2675L, 2674L, 2674L, 2672L, 2672L, 2671L, 2671L,
2668L, 2667L, 2667L, 2665L, 2664L, 2663L, 2663L, 2663L, 2663L,
2662L, 2660L, 2658L, 2658L, 2658L, 2657L, 2657L, 2656L, 2654L,
2654L), Games = c(10L, 0L, 0L, 0L, 10L, 0L, 9L, 0L, 0L, 2L, 9L,
0L, 9L, 

Re: [R] return first index for each unique value in a vector

2012-08-28 Thread Robert Baer

On 8/28/2012 5:52 PM, Bert Gunter wrote:

Sheesh!

I would have thought that someone would have noticed that on the
?unique Help page there is a link to ?duplicated, which gives a
_logical_ vector of the duplicates. From this, everything else can be
quickly derived -- and packaged in a simple Matlab like function, if
you insist on that. e.g.

unik - !duplicated(A)  ## logical vector of unique values
seq_along(A)[unik]  ## indices
A[unik] ## the values

If you want the indices in increasing order, see ?order

-- Bert

Another way that works is:
as.numeric(rownames(unique(data.frame(A)[1])))

However, this may not be too efficient.

On Tue, Aug 28, 2012 at 3:32 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:

On Tue, Aug 28, 2012 at 2:58 PM, Bronwyn Rayfield
bronwynrayfi...@gmail.com wrote:

I would like to efficiently find the first index of each unique value in a
very large vector.

For example, if I have a vector

A-c(9,2,9,5)

I would like to return not only the unique values (2,5,9) but also their
first indices (2,4,1).

I tried using a for loop with which(A==unique(A)[i])[1] to find the first
index of each unique value but it is very slow.

You'll get marginally more speed from which.max() but I'm sure there's
a better way. I'll write if I can think of it.

Michael


What I am trying to do is easily and quickly done with the unique
function in MATLAB (see
http://www.mathworks.com/help/techdoc/ref/unique.html).

Thank you for your help,
Bronwyn

 [[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-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.





__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ANOVA repeated measures and post-hoc

2012-08-16 Thread Robert Baer
Check out:
http://rtutorialseries.blogspot.com/2011/02/r-tutorial-series-two-way-repeated.html
On 8/15/2012 11:32 AM, Diego Bucci wrote:
 Hi,
 I performed an ANOVA repeated measures but I still can't find any good news 
 regarding the possibility to perform multiple comparisons.
 Can anyone help me?
 Thanks

 Diego Bucci
 Fisiologia Veterinaria
 Dipartimento di Scienze Mediche Veterinarie
 Università degli Studi di Bologna
 Via Tolara di Sopra, 50
 40064 Ozzano dell'Emilia, BO
 Tel. 00390512097904
 mail diego.buc...@unibo.it


   [[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-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Turning off continuation prompt?

2012-07-30 Thread Robert Baer
On Mon, 30 Jul 2012 09:58:09 +0100 (BST) (Ted Harding) 
ted.hard...@wlandres.net wrote:

Greetings All.
My apologies for a question whose answer is probably
readily available somewhere (for some interpetation
of somewhere) ...

Say I have just typed (from a sheet of paper) several
lines into the R command-line, and what I see is:


chisq.test(matrix(c(3,6,3,4,4,

+ 4,1,4,6,5,
+ 2,7,4,2,5,
+ 8,2,4,4,2,
+ 3,4,5,4,4),ncol=5))

Later, I find that would like to re-input the data part
of this command (matrix(c(...)...)). Without the +
continuation prompts, it would be easy to do this by
copypaste with the mouse in one operation. With the +
marks there, I have to do the copypaste for each separate line.

So is there a way to suppress the output of the + at the
beginning of each continuation line?
At some level of complexity it is worth thinking of using a programming 
front end to R rather than the basic GUI.  I have really benefited from 
downloading RStudio myself, but there are any number of other choices 
that might be suited to your needs as well. Knowing how long you have 
been around this list, you probably can name more than I.

Rob

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Workspace Question.

2012-07-23 Thread Robert Baer
The objects from an R session are saved in the RWorking directory of the 
session.  The answer to your question will depend on whether you started 
the different versions of R using shortcuts located in different folders 
or the same folder.  The objects should not be automatically deleted so 
I would think that unless you deleted them yourself, you are dealing 
with a situation where you are not starting the previous version of R 
with the same working directory as before.


Sorry this is only general advice, but there is not enough detail to say 
more.


Rob


On 7/23/2012 2:36 AM, Michael Trianni wrote:

I recently installed R version 2.14.1. After a session (not my first) in 
2.14.1, I
saved the 'workspace image'. I then opened earlier R versions, 2.14.0
 2.12.0, and the only objects listed were from the 2.14.1 session.
All the work under those previous versions were gone, to my dismay. This did 
not happen when I was working in 2.14.0, as 2.12.0 objects were not affected 
when saving the workspace image in 2.14.0.

Are the 2.14.0  2.12.0 objects retrievable or permanently deleted?

Thanks for any input,

Mike

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R2wd package wdGet() error

2012-07-23 Thread Robert Baer

On 7/23/2012 4:25 PM, Jean V Adams wrote:

I am having trouble using the R2wd package.  The last time I used it
successfully, I was running an earlier version of R and an earlier version
of Word with an earlier Windows OS.  I'm not sure which if any of these
changes might be contributing to the problem.  Right now I'm using
  R version 2.15.0 (2012-03-30) for Windows
  MS Word 2010 version 14.0.6112.5000 (32-bit)
  Windows 7 Enterprise 2009 (Service Pack 1)

When I submit the following code
  library(R2wd)
  library(rcom)
  wdGet()
I get this error message
  Error in if (wdapp[[Documents]][[Count]] == 0)
wdapp[[Documents]]$Add() :
argument is of length zero
I have a new R on a new Win7 OS since I last wdget() so i decided to try 
to reproduce your error

I tried your code and got the same error (R2.15.1), but the library(rcom)

However, as you note below, that line also told me to install 
RDCOMClient with the command;


installstatconnDCOM()

I did this and the install happened seamlessly with only a few user 
interactions.


wdget() now works just fine.  The only missing instruction here is that 
it is necessary to stop and restart R after installing the RDCOMClient.  
If you did not try that give it a try.  It worked well for me.


Rob


I saw in a previous posting to r-help (
http://r.789695.n4.nabble.com/R2wd-error-in-wdGet-td4632737.html), someone
asked if RDCOMClient was installed and working properly.  So, I tried
submitting this code
  install.packages(RDCOMClient, repos = http://www.omegahat.org/R;)
And I got this warning message:
package ?RDCOMClient? is not available (for R version 2.15.0)

I also ran
  installstatconnDCOM()
And it seemed to install fine.  But when I try to run statconn DCOM's
Server 01 ? Basic Test, and then select Start R, I get this message
  Loading StatConnector Server... Done
  Initializing R...Function call failed
Code: -2147221485
Text: installation problem: unable to load connector
   Method '~' of object '~' failed
  Releasing StatConnector Server...Done

Any suggestions for how I might get wdGet() to work?

Thanks in advance.

Jean
[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] binary tree

2012-07-02 Thread Robert Baer

On 6/27/2012 3:20 AM, Peppino wrote:

Hi I am new with R

I Have to build a binary tree with R. I'm very confused was wondering if
anyone had any R sample code they would share.

Any bady can help me?

You might want to look at the R Task view for phylogenetics:
http://cran.r-project.org/web/views/Phylogenetics.html.

The ape package may be some help depending on what you want to do.

Rob


Bye

Giuseppe

--
View this message in context: 
http://r.789695.n4.nabble.com/binary-tree-tp4634593.html
Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to plot linear, cubic and quadratic fitting curve in a figure?

2012-06-13 Thread Robert Baer



dput(test)

structure(list(sp = c(4L, 5L, 9L, 12L, 14L), env = c(12L, 18L,
20L, 17L, 15L)), .Names = c(sp, env), class = data.frame, row.names = 
c(NA,

-5L))
plot(test$sp~test$env, main = S vs. temp, xlim=c(0,20), ylim=c(0,14), 
ylab=S,xlab=env)

linear-lm(test$sp~test$env)
quadratic-lm(test$sp~test$env+I(test$env^2))
#summary(quadratic)
cubic-lm(test$sp~test$env+I(test$env^2)+I(test$env^3))
#summary(cubic)
#fitting curve
abline(linear)


Thanks and waiting for your suggestions

sincerely,
Kristi Glover

Try adding the following lines of code
cq = coef(quadratic)
cc = coef(cubic)
newenv = seq(min(test$env), max(test$env), by = (max(test$env) - 
min(test$env))/500)

sp.quad = cq[1] + cq[2]*newenv +cq[3]*newenv^2
lines(newenv,sp.quad, col='red')

sp.cubic = cc[1] + cc[2]*newenv +cc[3]*newenv^2 +cc[4]*newenv^3
lines(newenv, sp.cubic, col='blue', lty=2)

--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R2wd error in wdGet

2012-06-10 Thread Robert Baer

wdGet()

Error in if (wdapp[[Documents]][[Count]] == 0)
wdapp[[Documents]]$Add() :
 argument is of length zero


Not sure what your error means without more context, you should see:
Loading required package: rcom
Loading required package: rscproxy

Do you have RDCOMClient installed and working properly?

rcom requires a current version of statconnDCOM installed.
To install statconnDCOM type
installstatconnDCOM()

This will download and install the current version of statconnDCOM

You will need a working Internet connection
because installation needs to download a file.

HTH,

Rob
Error in if (wdapp[[Documents]][[Count]] == 0) 
wdapp[[Documents]]$Add() :

 argument is of length zero





-Original Message- 
From: Andreia Leite

Sent: Thursday, June 07, 2012 2:53 PM
To: r-help@r-project.org
Subject: [R] R2wd error in wdGet  that

Dear list,

I'm trying to use R2wd package. I've installed the package and try wdGet().
However a error message came up. I'm presently using R 2.15.0


wdGet()

Error in if (wdapp[[Documents]][[Count]] == 0)
wdapp[[Documents]]$Add() :
 argument is of length zero

Does anyone knows what this means?

Thanks a lot.

Andreia Leite




--
View this message in context: 
http://r.789695.n4.nabble.com/R2wd-error-in-wdGet-tp4632737.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ggplot2, grid graphics, x11(), windows(), and device fonts

2012-06-05 Thread Robert Baer
I am trying to use ggplot() to produce a graph and am getting warnings that 
I don't understand.  This is happening from within RStudio, but also happens 
if I start Windows R GUI.   Can anyone help me understand the warning and 
how to make sure the right fonts are designated?  The relevant code fragment 
is:


x11(width=7, height = 7)
library(ggplot2)
# Now some Distance ~ Time plots
p2 - ggplot(lu.mig, aes(x=Time, y=Net.Distance, colour = PlateRow)) +
 geom_point(size= 3) +
 geom_line(size=1) +
 facet_grid(Substrate ~ Expression) +
 xlab(Time After Scratch (h)) +
 ylab(Net half-distance (um)) +
 opts(title='Repaired Raw 1205Lu Scratch Time Course') +
 theme_bw(base_size = 18, base_family = )
print(p2)

The warnings are:
There were 22 warnings (use warnings() to see them)


warnings()

Warning messages:
1: Removed 1 rows containing missing values (geom_point).
2: Removed 1 rows containing missing values (geom_path).
3: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... :
 Font family not found in Windows font database
4: In grid.Call(L_textBounds, as.graphicsAnnot(x$label),  ... :
 Font family not found in Windows font database
...  snip ...   # repeat same warning
22: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label),  ... :
 Font family not found in Windows font database

If I comment out,
   x11(width=7, height = 7)
so that the plot is drawn to the RStudio graphics device (or the default 
device in R GUI), I only get the expected first two warnings.  As I have 
traced through the documentation I've seen reference to an 'Rdevga’ that may 
be a culprit, but I can't quite understand how I set this up properly.  Any 
debugging pointers?


It also seems that if I replace x11() with windows(), the warnings 
disappear.  Somewhere (wrongly, I guess) I had gotten the impression that 
x11() on the windows platform behaved just like windows().  For now, I've 
just reverted to using windows(), but I'd like to understand this better, 
particularly how to be certain ggplot() (or grid()) will be able to find a 
default font.  Of course, despite the warnings the graph draws fine so it 
could be something to evaluation in ggplot.


Thanks,
Rob


R.Version()

$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 15.0

$year
[1] 2012

$month
[1] 03

$day
[1] 30

$`svn rev`
[1] 58871

$language
[1] R

$version.string
[1] R version 2.15.0 (2012-03-30)

$nickname
[1] 


C:\Users\rbaerpath
PATH=C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\GTK\bin;C:\Program 
Files\ImageMagick-6.7.6-Q16;C:\Program Files\Mende
ley Desktop\wordPlugin;C:\Program Files\Common Files\Microsoft 
Shared\Windows Live;c:\Rtools\bin;c:\Rtools\perl\bin;c:\R

tools\MinGW\bin;c:\Rtools\MinGW64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Window
sPowerShell\v1.0\;C:\Program Files\Microsoft Application Virtualization 
Client;C:\Program Files\WIDCOMM\Bluetooth Softwa
re\;C:\Program Files\Windows Live\Shared;C:\Program Files\MiKTeX 
2.9\miktex\bin\;C:\Program Files\QuickTime\QTSystem\;C:

\GTK\bin;


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to check given number seq. is time series or not?

2012-05-29 Thread Robert Baer

Perhaps ?str is the command you seek?

-Original Message- 
From: sagarnikam123

Sent: Saturday, May 26, 2012 10:24 PM
To: r-help@r-project.org
Subject: Re: [R] how to check given number seq. is time series or not?

Yes,sir index of above/below numbers is time (both dataset are same)

   x
1   0.8890464
2   1.2272616
3   1.2272616
4   1.3578511
5   1.3578511
6   1.1070461
7   1.4424190
8   1.2277843
9   1.3578511
10  0.9708839
11  0.8221709
12  1.3578511
13  0.3588158
14  0.7742342
15  0.8221709
16  0.8221709
17  0.7259998
18  0.6715839
19  0.8132233
20  0.7742342
21  1.0018480
22  1.4424190
23  1.2272616
24  0.9708839
25  0.3588158
26  1.3101684
27  0.9708839
28  1.4424190
29  0.8890464
30  4.9167998
31  1.2277843
32  1.2160533
33  0.3698620
34  0.7747481
35  0.3698620
36  1.4424190
37  1.2272616
38  1.4424190
39  1.2272616
40  1.1629110
41  2.3386331
42  0.7742342
43  4.9167998
44  0.9670581
45  0.9708839
46  0.9670581
47  1.1070461
48  4.9167998
49  1.4424190
50  1.0541099
51  1.2272616
52  1.2160533
53  1.3578511
54  0.8221709
55  1.4424190
56  0.9708839
57  0.8354292
58  0.7742342
59  1.6132899
60  0.9708839
61  1.2277843
62  1.2272616
63  0.9708839
64  1.1070461
65  1.1070461
66  1.1070461
67  1.4424190
68  1.2272616
69  1.4424190
70  1.3578511
71  0.9670581
72  0.9670581
73  0.8854192
74  1.1629110
75  0.3698620
76  0.9670581
77  0.7747481
78  1.2272616
79  1.4424190
80  1.2272616
81  1.3101684
82  0.8132233
83  1.4424190
84  0.8221709
85  1.0541099
86  0.8530141
87  1.3245534
88  0.7742342
89  0.7742342
90  1.2272616
91  0.8890464
92  1.4424190
93  0.8426226
94  0.8890464
95  0.8890464
96  1.3189847
97  1.4424190
98  1.3578511
99  0.6826173
100 0.9651803

kindly tell me is this is time series or not ?
if yes,how can i find by coding/programming?


--
View this message in context: 
http://r.789695.n4.nabble.com/how-to-check-given-number-seq-is-time-series-or-not-tp4631434p4631482.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Names of Greek letters stored as character strings; plotmath.

2012-05-20 Thread Robert Baer
-Original Message- 
From: William Dunlap

Sent: Saturday, May 19, 2012 11:07 AM
To: Rolf Turner
Cc: r-help
Subject: Re: [R] Names of Greek letters stored as character 
strings;plotmath.


parse(text=paste(...)) works in simple cases but not in others.  The
fortune about it is there because it is tempting to use but if you bury it
in a general purpose function it will cause problems when people
start using nonstandard names for variables.  bquote(), substitute(),
call(), and relatives work in all cases.  E.g.,

  par(mfrow=c(2,1))
  power - gamma ; x - Waist ; y - Weight # valid R variable names
  plot(0, main=bquote(.(as.name(x))^.(as.name(power))/.(as.name(y
  plot(0, main=parse(text=paste0(x, ^, power, /, y))) # same as 
previous

 
  power - gamma ; x - Waist Size (cm) ; y - Weight (kg) # invalid 
R names

  plot(0, main=bquote(.(as.name(x))^.(as.name(power))/.(as.name(y
  plot(0, main=parse(text=paste0(x, ^, power, /, y))) # whoops
 Error in parse(text = paste0(x, ^, power, /, y)) :
   text:1:7: unexpected symbol
 1: Waist Size
  ^

Now you might say that serves me right for using weird variable names,
but some of us use R as a back end to a GUI system (one not designed
around R) and don't want to inflict on users R's rules for names when
we do not have to.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] 
On Behalf

Of Bert Gunter
Sent: Saturday, May 19, 2012 7:24 AM
To: Gabor Grothendieck
Cc: r-help
Subject: Re: [R] Names of Greek letters stored as character strings; 
plotmath.


... and here is another incantation that may be  informative.

xnm- as.name(gamma')  ## This does the parsing
plot(0, xlab =bquote(.(xnm))

The initial puzzle is that if you just set
xnm - gamma

bquote will insert the string gamma rather than the symbol. After
all, that's what plotmath sees for xnm. So the key is telling plotmath
that it's a symbol, not a string. This can either be done before, as
above, or inline, as you and Gabor showed. Unsurprisingly. this also
does it, since as.name() is doing the parsing:

xnm - gamma
 plot(0,xlab=bquote(.(as.name(xnm

AND we are adhering to Thomas's dictum: bquote is a wrapper for
substitute(), which is what he recommends as the preferable
alternative to eval(parse(...)) . But, heck -- all such software
principles are just guidelines. Whatever works (robustly).

HTH.

Cheers,
Bert

On Sat, May 19, 2012 at 3:17 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 On Sat, May 19, 2012 at 1:18 AM, Rolf Turner rolf.tur...@xtra.co.nz 
 wrote:


 I had such good luck with my previous question to r-help, (a few 
 minutes

 ago) that I thought I would try again with the following query:

 Suppose I have

xNm - gamma

 I would like to be able to do

plot(1:10,xlab = something involving xNm)

 and get the x axis label to be the Greek letter gamma
 (rather than the literal text string gamma).

 Is this possible?  I've messed around with substitute()
 and bquote() and got nowhere.


 Then, just before clicking on Send, I had one more thimk, and blow
 me down, I got something that worked:

 plot(1:10,xlab=eval(expression(parse(text=xNm


 That can be shortened to:

 plot(0, xlab = parse(text = xNm))



-- snip --


This discussion has been exceedingly helpful, sort of.

Every time I try to do a task involving this I read the documentation for 
bquote(), expression(), plotmath(), etc.,  over and over, and I still fail 
to get the big picture of how R parses things under the hood.  Typically, I 
only succeed each time by frustrating trial and error.   Can I ask how you 
guys got a handle on the bigger (besides your usual brilliance G)?


Is there more comprehensive documentation in the developer literature or is 
there a user wiki that you would recommend for those who never quite get the 
big picture?  If not, this would be a worthy topic for an R Journal article 
if someone has knowledge and the time to do it.  Wish I were knowledgeable 
enough to do it myself.


Thanks,

Rob
__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to create axis y axis for horizontal bar plot?

2012-05-18 Thread Robert Baer
-Original Message- 
From: Manish Gupta

Sent: Friday, May 18, 2012 2:52 AM
To: r-help@r-project.org
Subject: [R] How to create axis y axis for horizontal bar plot?

Hi,

i am working on bar plot but i need to generate y axis for horizontal bar
plot.  In the attached diagram x-axis is there with scale 0 to 12 but i need
y axis.  How can i implement it?

http://r.789695.n4.nabble.com/file/n4630478/barplot2.jpg

Thanks

Try:
gears = c(3,4,5)
b = barplot(gears, horiz=TRUE)
axis(2, at=b, labels=c('three','four','five'))

Rob
--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to find outliers from the list of values

2012-05-17 Thread Robert Baer
Petr and Bert offer sound advice. At the risk of getting completely 
ostracized, here's how you could find outliers using the definition of 
'outlier' used by R's boxplot function and at the same time see your data.



dat = c(11489,  11008,  11873,  8000,  9558,  8645,  8024,  8371)
a = boxplot(dat)
a$out

[1] 8e+07



-Original Message- 
From: Prakash Thomas

Sent: Tuesday, May 15, 2012 7:00 AM
To: r-help@r-project.org
Subject: [R] how to find outliers from the list of values

Hi,
   I am new to R and I would like to get your help in finding
'outliers'.
I have mvoutlier package installed in my system and added the package .
But I not able find a function from 'mvoutlier' package which will identify
'outliers'.
This is the sample list of data I have got which has one out-lier.
  11489  11008  11873  8000  9558  8645  8024  8371  It will be of
great help if somebody have got an example script for the same.

Thanks  Regards,
Thomas

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to read ANOVA output

2012-05-07 Thread Robert Baer

Hey all who have responded to this post. I am a newbie to ANOVA analysis in
R, and let me tell you- resources for us learners are scant, horrible,
unclear, imprecise.. in other words.. the worst ever. So advice like go
look it up in your classical textbook or on google is not helpful at all.
I am scouring posts like these to try to find some kind soul who not only
understands the basics, but is willing to help us new folk out.. sadly..
here is not the place.

--
Although it would be rude to tell you to go look it up yourself, you do not 
pose a specific problem so it is impossible to provide a specific answer. 
This is why there is a posting guide requesting  that you do so.  Further, 
you pose your question in a rather rude way which makes the list readers 
less likely to want to help you!


I myself am a user of statistics, not a statistician, but I firmly believe 
that we must understand the statistics we use.  That means you won't get a 
prescriptive answer from me without a focused question.


What made a huge difference for me in understanding ANOVA in R was John 
Fox's book, An R and S-Plus Companion to Applied Regression Analysis.  It 
really helps understand the R way of doing things.  Another helpful resource 
for some of the classical ANOVA models is Murray Logan's, Biostatistical 
Design and Analysis Using R: A Practical Guide .  It is an R resource that 
follows the Quinn and Keogh Experimental and Data Analysis text with plenty 
of R code and examples.  The only downside to the latter text is that it has 
numerous typos that seem to have escaped the editing process.  If you 
haven't already, I'd check these two resources.


Rob

--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] r-package RDCOMClient

2012-04-29 Thread Robert Baer
These sorts of issues are often machine dependent and not R package or R 
software dependent, especially when it comes to processes like com.  I a,m 
not a RDCOMClient user, but it's been on my list to look at. You don't 
provide much info on your various component versions (see posting guide) so 
specific advice is impossible.


If it helps, On my 64-bit window 7 running32-bit  i386-pc-mingw32 R 2.15.0 
machine (I don't think 64-bit R is supported for RDCOMClient, but I could be 
wrong), I was just able to install a fresh RDCOMClient from Omegahat 
repository.  The code:



require(RDCOMClient)
ex = COMCreate(Excel.Application)
ex[[Visible]] = TRUE


produced an open visible Excel Window.  My Excel is 32-bit version Office 
2010.  Bottom line, success should be possible.


Good luck.

Rob

-Original Message- 
From: lm

Sent: Saturday, April 28, 2012 2:01 PM
To: r-help@r-project.org
Subject: Re: [R] r-package RDCOMClient

Hi, I am new to R. I was trying to use RDCOMClient package to access com
object based applications within R. This has been working fine for a while.
I have identical set up on two PCs (R-2.1.10 running on XP both on network
so same profile). Recently while installing a new package, I had to upgrade
one of the PCs to R-2.14.0 and since then while calling the methods or
accessing properties make RGui to crash.

i.eR

ex = COMCreate(Excel.Application) works fine before and after R upgrade (I
can see Excel under task manager. But ex[[Visible]] = TRUE will crash the
RGui.

On the same PC, I can interact with Bloomberg using RBloomberg package
before and after R upgrade.

I tried to uninstall R-2.14.0 and reinstall R-2.10.0 and still does not
work.

I thought it could be to do with COM objects registry issues   etc. , so a
complete rebuild of the PC might fix the issue. Instead of rebuilding the
PC, I  replaced my old hard disk with a new one and unfortunately had no
joy.

I wonder if anyone had faced similar issues. Any help on this will be
greatly appreciated.

Thanks
lm







--
View this message in context: 
http://r.789695.n4.nabble.com/r-package-RDCOMClient-tp836060p4595143.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Histogram from a table in R

2012-04-03 Thread Robert Baer

intv = c('0-19','10-19','20-29','30-39')
cnts = c(0, 3117, 4500, 2330)
barplot(cnts, space=0, names = intv, xlab='Age Range', ylab = 'Counts', 
main='My Histogram')


-Original Message- 
From: gina_alessa

Sent: Tuesday, April 03, 2012 4:08 PM
To: r-help@r-project.org
Subject: [R] Histogram from a table in R

Hi all,

I am new in R. I am trying to make an histogram but I can't figure it out.
I have .cvs table with a lot of data that look like this: I already have the
frequency of each interval (Counts).

Interval   Counts
00:19   0
10:19  3117
20:29 4500
30:39 2330...

I want to make the histogram with that. At the y axis I want to have the
Counts and at x axis I want to have the intervals.

Thanks in advanced!!!




--
View this message in context: 
http://r.789695.n4.nabble.com/Histogram-from-a-table-in-R-tp4530175p4530175.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem loading package 'JGR' using R-2.15.0 (Win32).

2012-04-02 Thread Robert Baer
On a 32-bit windows 7 machine running R 2.15.0 standard binary install, JGR 
loaded fine as seen below:

library(JGR)

Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots

Please type JGR() to download/launch console. Launchers can also be obtained 
at http://www.rforge.net/JGR/files/.


What's more, the jgr 1.62 launcher that worked previously with my R 2.14.2 
still works.


For what it's worth, JGR() fails as it did previously because my path 
contains spaces in it that cause problems.  Altering the batch to use 8.3 
notation (at least that's what I think it was called, I'm getting too old) 
takes care of this issue.  In other words, make the libpath notation look 
like the RHome notation in the batch file they ask you to construct.


Hope this helps,

Rob
---
-Original Message- 
From: Caitlin

Sent: Friday, March 30, 2012 5:23 PM
To: r-help@r-project.org
Subject: [R] Problem loading package 'JGR' using R-2.15.0 (Win32).

Hi all.

Upon attempting to load the 'JGR' package, on a Win32 machine (SP3), a
pop-up message appeared stating that R had encountered a problem and needs
to close. Has anyone else encountered this?

Thanks.

~Caitlin

[[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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to get the input of a function right?

2012-03-25 Thread Robert Baer
Your definition of x1, x2 and x3 requires the c() function.  Try leaving 
some space around operators for increased readability.


Remember that the that the result of operations on sets containing NA is 
often set to NA as well.  My guess is that if you print out x it contains 
NA and that your function does operations on x that are included in the 
function result.


Rob

-Original Message- 
From: stella

Sent: Thursday, March 22, 2012 10:43 AM
To: r-help@r-project.org
Subject: [R] How to get the input of a function right?

Hi,

I wrote a function with three inputs fun(x,y,z).

x is a matrix of three vectors combined with cbind. e.g.

x1-(1,2,3,4)
x2-(2,3,4,5)
x3-(3,4,5,6)

x-cbind(x1,x2,x3)

y is a vector e.g
y-c(7,8,9)

z is a real number e.g.
z-2.5

If a give the function an input like this, I get 'NA' in return. If I give
the function a vector e.g c(1,2,3) instead of 'x' the function works just
fine.
Does anyone has an idea why the function would not except 'x' as an input?

Thank you very much!
Stella

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-get-the-input-of-a-function-right-tp4495879p4495879.html

Sent from the R help mailing list archive at Nabble.com.

__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965 


__
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-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Identifying a change in events between bins

2012-03-19 Thread Robert Baer
Your description was too general for me to know exactly what you want but 
perhaps this will help you solve your own problem

set.seed(123)
evtlist = sample(c('fwd','rev'),100,replace=TRUE)
evtlist
 [1] fwd rev fwd rev rev fwd rev rev rev fwd rev 
fwd rev
[14] rev fwd rev fwd fwd fwd rev rev rev rev rev rev 
rev
[27] rev rev fwd fwd rev rev rev rev fwd fwd rev fwd 
fwd
[40] fwd fwd fwd fwd fwd fwd fwd fwd fwd fwd rev fwd 
fwd
[53] rev fwd rev fwd fwd rev rev fwd rev fwd fwd fwd 
rev
[66] fwd rev rev rev fwd rev rev rev fwd fwd fwd fwd 
rev
[79] fwd fwd fwd rev fwd rev fwd fwd rev rev rev fwd 
fwd

[92] rev fwd rev fwd fwd rev fwd fwd rev

rle(evtlist)

Run Length Encoding
 lengths: int [1:50] 1 1 1 2 1 3 1 1 1 2 ...
 values : chr [1:50] fwd rev fwd rev fwd rev fwd rev fwd 
...

rle(evtlist)$lengths
[1]  1  1  1  2  1  3  1  1  1  2  1  1  3  9  2  4  2  1 12  1  2  1  1  1 
2  2  1  1

[29]  3  1  1  3  1  3  4  1  3  1  1  1  2  3  2  1  1  1  2  1  2  1



see ?rle

Rob
-Original Message- 
From: Mark Hills

Sent: Friday, March 16, 2012 3:55 PM
To: r-help@r-project.org
Subject: [R] Identifying a change in events between bins

Hi there,

First off, despite this being my first post here, I have scanned the R help 
forums a lot in the past few months to help with some questions, so a big 
thank you to the community as a whole for being so helpful!


I'm somewhat of an R newbie, and have run up against a problem that I can't 
seem to solve.  If anyone is able to help I would really appreciate it!


I'm looking at a number of events across a chromosome, and have written a 
program that collects them into different bins, based on a specified 
binsize.  The events are directional, either forward or reverse, and a 
chromosome can either be fwd/fwd (all the events fall into the fwd bins), 
rev/rev (all the events fall into the rev bins) or fwd/rev (events are 
evenly split).  In some cases, chromosomes switch from one state to another 
(eg fwd/fwd to fwd/rev).  There are a number of rules that dictate my data. 
First, while there is stochastic variation, the sum of fwd and rev in each 
bin should have approximately the same value. If I were to take the total 
number of events and divide them by the number of bins to get an average 
count per bin, I would expect approximately that value in each bin; in the 
case of fwd/fwd it would be about average number in the fwd column and close 
to zero in the rev column, in rev/rev it would be about the average number 
in the rev column and close to zero in the fwd column, and in fwd/rev it 
would be about half the average number in both.


Hopefully my png attachment worked and you can see an example.  The top plot 
shows fwd reads, the 2nd shows rev reads and the third shows fwd minus rev 
reads.


What I would like to be able to do is to automatically assign regions in 
which the chromosome switches from one state to another. From the graphs 
(and from the read.table output below) you can see that this particular 
chromosome is fwd/fwd from bin 1 to 59, fwd/rev from bin 61 to 73, and 
rev/rev for the remainder of the chromosomes.


These are generated from a read.table that looks like this:

bin  fwd  rev
50  484   2
51  366   4
52  527   6
53  635   2
54  573   6
55  506   4
56  600   6
57  560   2
58  504   2
59  545   0
60  501  68
61  419 223
62  252 109
63  259 138
64  355 189
65  218 125
66  140  57
67   45  31
68  276 144
69  263 152
70  330 193
71  439 204
72  347 207
73   10 611
746 619
752 578
767 372
776 436
784 373
798 417
802 276

My question is this:

1. Is there an obvious way to automatically identify these regions?

I am not sure how I can go about scanning previous lines within a read.table 
to find a point at which the values change.  In the above example, I would 
like the program to identify that the fwd graph shifts from ~1x the average 
to ~0.5x the average between bin 61 and 62, and from ~0.5x the average to 
~0x the average between bin 72 and 73. Conversely I'd like to identify the 
rev graph shifting from ~0x average to ~0.5x average between bins 59 and 60, 
and from 0.5x average to 1x average from bin 72 to 73.  Finally, I'd like to 
cross-reference the output from fwd and rev to  only pull out reciprocal 
switches (ie those that occur within 3 bins of each other in both fwd and 
rev data sets).


What I've been trying to gt to work is to generate values based on 0, 0.5 
and 1x the average events, and trying to pull out the range of bins that 
fall into each of those categories (possibly 1 SD higher or lower to account 
for the stochastic variation), but I'm not really sure how to go about that.


2. If I can find a way to identify a shift between bins, is there any way to 
then look in smaller bin sizes across those regions.  The bins shown above 
are for 200,000 bases of DNA.  If my program automatically found an event 
between bin 72 and 73 (14,400,000 bases to 14,600,000), is it possible to 
feed that 

  1   2   >