Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread PIKAL Petr
Hi elaborating answers you already got sapply(X, function(m){nlevels(factor(m$latitudes))}) tapply(N$latitudes, N$species, function(x) nlevels(factor(x))) shall do the trick Petr From: 张以春 [mailto:yczh...@nigpas.ac.cn] Sent: Tuesday, January 21, 2014 2:58 PM To: PIKAL Petr Cc: r-help@r-p

Re: [R] My problem with R

2014-01-21 Thread PIKAL Petr
Hi From: Lee Marine [mailto:marine1...@gmail.com] Sent: Wednesday, January 22, 2014 2:01 AM To: PIKAL Petr Subject: Re: [R] My problem with R ps. >str(timestamp3) POSIXlt[1:36568], format: "2013-10-04 04:42:00" "2013-10-04 04:42:01" ... POSIX format can have list structure or vector structure

Re: [R] Strange error on text assignment to variable

2014-01-21 Thread Frede Aakmann Tøgersen
Hi Well, for is a basic control-flow construct and as such a reserved word in R. See e.g. ?for Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com htt

[R] Strange error on text assignment to variable

2014-01-21 Thread Sumitrajit Dhar
Hello folks, I am using R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) on Mac OS 10.9.1 When I try a simple assignment as below, the first "For" works but the second "for" gives me a

Re: [R] [datatable-help] Error in structure(ordered, dim = ns) : dims [product 1] do not match the length of object [0]

2014-01-21 Thread Prof Brian Ripley
On 21/01/2014 22:45, William Dunlap wrote: You probably want to use %w instead of %u. On Linux 'man strftime' says %w The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. %u The day of the week as a decimal, range 1 to 7, Monday bei

Re: [R] Windows7, R-Studio, can't find package rJava,

2014-01-21 Thread Prof Brian Ripley
You need to install Java. That seems not to be in the rJava documentation: you get it from here: http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html and need the version for the version of R (32- or 64-bit, x86 or x64 in Oracle parlance) you want to run. Plea

[R] Porting Legacy R Code to Different Language

2014-01-21 Thread toshiharu . saito
Hi, I'm trying to port a quite big piece of legacy R code to a different language ( Java or C# ). The package I'm trying to port is quite large but I'm only interested in one function in the package. I was just wondering if there's any tools that would allow me to get a trace of all the code th

Re: [R] Getting the current number of rows in windows R gui console (Carlos Arias)

2014-01-21 Thread Duncan Murdoch
On 14-01-21 7:27 PM, Carlos Arias wrote: Hello, I'm currently trying to set some default settings and I know how to get the width of the console with getOption("width"), this corresponds to the number of columns of the console in the Rconsole file. I would also like to get the current number of r

[R] Getting the current number of rows in windows R gui console (Carlos Arias)

2014-01-21 Thread Carlos Arias
Hello, I'm currently trying to set some default settings and I know how to get the width of the console with getOption("width"), this corresponds to the number of columns of the console in the Rconsole file. I would also like to get the current number of rows from inside R. Is there an R option to

Re: [R] Problems downloading and installing nlme under Linux Mint 15

2014-01-21 Thread John Sorkin
Clint, Thank you! Problem solved. John 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,

Re: [R] Problems downloading and installing nlme under Linux Mint 15

2014-01-21 Thread Clint Bowman
There is the error message: Error : package ‘lattice’ was built before R 3.0.0: please re-install it Perhaps the problem lies there. Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology

Re: [R] PCA factominer package, question about changing labels in individuals factor map

2014-01-21 Thread Andy.P
That worked! Wow easy fix, i feel dumb! Thanks! -- View this message in context: http://r.789695.n4.nabble.com/PCA-factominer-package-question-about-changing-labels-in-individuals-factor-map-tp4683924p4683941.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Problems downloading and installing nlme under Linux Mint 15

2014-01-21 Thread John Sorkin
I am running R under Linux Mint 15 and trying to download and install nlme. During the download I get an error message: Warning message: In install.packages("nlme") : installation of package ‘nlme’ had non-zero exit status When I try to load the package, I get an error message > library(nlme) E

Re: [R] [datatable-help] Error in structure(ordered, dim = ns) : dims [product 1] do not match the length of object [0]

2014-01-21 Thread William Dunlap
You probably want to use %w instead of %u. On Linux 'man strftime' says %w The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. %u The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. (SU) where "(

Re: [R] [datatable-help] Error in structure(ordered, dim = ns) : dims [product 1] do not match the length of object [0]

2014-01-21 Thread William Dunlap
When I use R-3.0.2 on Windows 7 the %u descriptor for format.Date() always gives "", while on Linux in gives as.character(day-of-the-week). The resulting NA's on Windows could be the source of your problem. On Linux I get: > format(as.Date(c("2014-01-21", "2014-01-22", "2014-01-28")), "%u")

[R] Windows7, R-Studio, can't find package rJava,

2014-01-21 Thread Rainer K. SACHS
example: > getwd() # with RStudio you can read it off the console bar[1] > "C:/Users/ra`-/Documents/1ray/plans/learnR/week3liats"> library(xlsx)Loading > required package: rJavaError : .onLoad failed in loadNamespace() for 'rJava', > details: call: fun(libname, pkgname) error: JAVA_HOME can

[R] obtain mean trait values by haplotype in haplo.stats package

2014-01-21 Thread ylwgto
Hello, I am using the haplo.stats package to calculate haplotype frequencies and test for associations of haplotype with a continuous phenotype (in this case BMI) in my population. My analysis is rather simple, as only 2 SNPs are included. I have a few questions related to the package: -How exa

Re: [R] [datatable-help] Error in structure(ordered, dim = ns) : dims [product 1] do not match the length of object [0]

2014-01-21 Thread arun
Hi, Couldn't reproduce the error after running your code:  d <- dcast(d, date ~ id, value.var="simple_return")  dim(d) #[1] 356   9  sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-unknown-linux-gnu (64-bit) locale:  [1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C   [3] LC_TIM

Re: [R] PCA factominer package, question about changing labels in individuals factor map

2014-01-21 Thread David Carlson
Try rownames(dat) <- dat[,1] before running PCA. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

Re: [R] repeated measures ANOVA using Anova in car library

2014-01-21 Thread John Fox
Dear Rudiger, See the following paper in the R Journal, which, among other things, shows how to set up a repeated-measures ANOVA or MANOVA using Anova(): . I hope this helps, John --

Re: [R] how do I extract all possible combinations of rows from a column

2014-01-21 Thread Bert Gunter
... or combn() in utils. which was the first hit when I googled on "finding combinations in R." So moral: Use search engines before you post. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is cer

Re: [R] how do I extract all possible combinations of rows from a column

2014-01-21 Thread arun
Hi, May be this helps: library(gtools) as.data.frame(t(combinations(5,3,1:5))) #  V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 #1  1  1  1  1  1  1  2  2  2   3 #2  2  2  2  3  3  4  3  3  4   4 #3  3  4  5  4  5  5  4  5  5   5 A.K. For a column of data, I need to extract all possible unique combinations

[R] PCA factominer package, question about changing labels in individuals factor map

2014-01-21 Thread Andy.P
I am looking to do a PCA with the factominer package on a dataset of mine, named dat. The individuals in my dataset have character names, represented in the first column of my dataset, but since they aren't quantitative I can't include that column in my PCA analysis. Leading to the command > res.pc

[R] Strange gcfit output in R package Grofit

2014-01-21 Thread Lucy Rayner
Hi all, I'm trying to use the R growth curve analysis package Grofit. I've used it successfully before but the protocol which previously worked for me is now not giving me the expected output. Entering my data and time info and running Test<-grofit(time,data,FALSE) gives me the expected growth cu

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread peter dalgaard
On 21 Jan 2014, at 15:58 , Jeff Newmiller wrote: > You are mis-using factors. Would you pretend that women do not exist just > because your sample happens to include only men? > > If you really need to ignore those other levels, convert your factor to > character and summarize those values.

Re: [R] repeated measures ANOVA using Anova in car library

2014-01-21 Thread Bert Gunter
You should post this instead on r-sig-mixed-models, rather than here. They are specifically concerned with such statistical issues; here the concern is primarily R programming. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is no

Re: [R] how to replace values

2014-01-21 Thread John Kane
I'm pretty sure that what you have is not what you think you have. Do a str(Elder1) on the data set and you will see that age is a factor not a numerical variable. Bascally you have a mangled data set from the look of it. Why would you want to change NA's to 0's? John Kane Kingston ON Canada

[R] repeated measures ANOVA using Anova in car library

2014-01-21 Thread Rüdiger Wolf
Dear all, I am trying to do a repeated-measures ANOVA using Anova of the car package. I have a quite basic design with 24 subjects and only 2 within-subject factors (condition (2 levels: legal an illegal) and day (1,2,3)). I found the Examples (see https://stat.ethz.ch/pipermail/r-help/2008-Dece

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread Jeff Newmiller
You are mis-using factors. Would you pretend that women do not exist just because your sample happens to include only men? If you really need to ignore those other levels, convert your factor to character and summarize those values. ---

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread 张以春
Dear Jun Yi, Thank you very much for your help. But, the link you attached can not resolve my question. What I want is to get the numbers of factor levels for every subsets of a vector. When I do this, it always gives me the total numbers of levels for the whole vector. It really makes me co

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread 张以春
Dear Pikal, Thank you very much for your answer. I think your example is just the problem I have. In the following example you gave to me, > > ff<-factor(letters[1:5]) > > levels(ff[1:2]) > [1] "a" "b" "c" "d" "e" > > fff<-ff[1:2] > > nlevels(fff) > [1] 5 > > > fff > [1] a b > Levels: a

Re: [R] lattice

2014-01-21 Thread David Winsemius
On Jan 21, 2014, at 2:02 AM, Said Filahi wrote: hello If I have a a program trend <- read.table("txx.csv", header=T, sep=",") library(lattice) trellis.par.set(theme = canonical.theme("postscript", col=FALSE)) trellis.par.set(list(fontsize=list(text=8), par.xlab.text=list(cex

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread PIKAL Petr
Hi It is rather difficult to understand what problem you have. post some data e.g. by dput(head(bigmatrix)) Maybe your problem is in a factor feature that it preserves also empty levels until you specifically drop them. > ff<-factor(letters[1:5]) > levels(ff[1:2]) [1] "a" "b" "c" "d" "e" > ff

Re: [R] My problem with R

2014-01-21 Thread PIKAL Petr
Hi see in line > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Lee Marine > Sent: Tuesday, January 21, 2014 7:17 AM > To: r-help@r-project.org > Subject: [R] My problem with R > > Hi, I am a student in trouble with R. > pleas

Re: [R] how to replace values

2014-01-21 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of kingsly > Sent: Tuesday, January 21, 2014 7:22 AM > To: r-help@r-project.org > Subject: Re: [R] how to replace values > > First of all I thank all the friends. > > Though I

[R] (no subject)

2014-01-21 Thread Mariacarla Memeo
Hello to everyone! I'm a new to R and I don't succed in updating a variable (SR) in a for loop. The script created is the following one: path=c("C:/Users/memeo/Documents/Dottorato/soggetti visus danneggiato/") subjects=list.files(path) # subjects=subjects[c(1:35,37)] n_gradini=rep(c(1,2,4),lengt

Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread Liu , Jun Yi
Dear YZ, I guess this is what you want: 1. http://stackoverflow.com/questions/3418128/how-to-convert-a-factor-to-an-integer-numeric-without-a-loss-of-information 2.  http://stackoverflow.com/questions/6979625/arithmetic-operations-on-r-factors/6980780#6980780 3.  http://toddjobe.blogspot.jp/201

[R] lattice

2014-01-21 Thread Said Filahi
hello If I have a a program trend <- read.table("txx.csv", header=T, sep=",") library(lattice) trellis.par.set(theme = canonical.theme("postscript", col=FALSE)) trellis.par.set(list(fontsize=list(text=8), par.xlab.text=list(cex=1.5), add.text=list(cex=3.5)

Re: [R] how to replace values

2014-01-21 Thread kingsly
First of all I thank all the friends. Though I  have written zero to replace NA in  previous email, I will replace with extreme value (9). On Tuesday, 21 January 2014 7:05 AM, jwd [via R] wrote: On Sun, 19 Jan 2014 11:39:43 -0800 (PST) kingsly <[hidden email]> wrote: _

[R] My problem with R

2014-01-21 Thread Lee Marine
Hi, I am a student in trouble with R. please help me! I have a 16 huge data(.csv). data1<-read.csv(D://data1.csv, header=FALSE) . . . data16<-read.csv(D://data16.csv, header=FALSE) and then, I tried to seperated data w/ column. a1<-cbind(data1[1:36568,1]) b1<-cbind(data1[1:36568,2]) . . . ac16<

[R] how to get the numbers of factors in a matrix

2014-01-21 Thread 张以春
Dear friends, I have a question do not know how to resolve. I have a big matrix composed of different columns (I use N here). A column is "species" and another one is "latitudes". Now, I want to know how I can get the number of different "latitudes" for every "species". I have tried to split