Re: [R] R-error

2023-04-14 Thread Ivan Krylov
Please keep R-help in the "Copy" list.

Please compose your messages in plain text, not HTML.

On Thu, 13 Apr 2023 15:59:49 +0800 (GMT+08:00)
"Dezhi Wang"  wrote:

> This is my config.log

Please don't send any more screenshots. They are needlessly large and
impossible to copy text from. You could have fit more than forty two
thousand ASCII symbols in the space occupied by that 17 lines, and it
would have been easier to work with.

I cannot help you further without at least the backtrace, but it looks
like you have a defect in your NSS installation. You need help from a
CentOS expert or an NSS expert; there's nothing that can be fixed in R
to make it work, short of getting a custom build of a different TLS
library and a custom build of libcurl linked against said library, then
linking your custom R build against this libcurl. (But then you're on
the hook for updating both libraries when the inevitable security fixes
start rolling in.)

For RedHat-related problems, try r-sig-fed...@r-project.org, but if you
don't give them enough information, they won't help you either.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-error

2023-04-13 Thread Ivan Krylov
On Thu, 13 Apr 2023 14:53:14 +0800 (GMT+08:00)
"Dezhi Wang"  wrote:

> [New Thread 0x7fffe660a700 (LWP 3791)]
> [Thread 0x7fffe660a700 (LWP 3791) exited]
> Program received signal SIGSEGV, Segmentation fault.
> 0x7fffe50c0fe5 in intel_aes_gcmAAD () from
> /lib64/libfreeblpriv3.so

You didn't post the backtrace, so I don't have the full picture, but
the crash seems to be happening in your TLS implementation (NSS), most
likely because the AES GCM context pointer somehow turned out to be
NULL. Is there a way to install a libcurl build linked with a different
TLS back-end (e.g. OpenSSL)?

How exactly did you install R?

Please keep the Cc: r-help@R-project.org header in your e-mails (in
order to let others find their solutions through the publicly available
R-help archive).

Please post in plain text, not HTML:
https://www.r-project.org/mail.html#general-instructions

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-error

2023-04-12 Thread Ivan Krylov
On Wed, 12 Apr 2023 16:04:55 +0800 (GMT+08:00)
"Dezhi Wang"  wrote:

> I run R 4.2.2 on CentOS-7.6.

Thank you for this useful information. Could you tell us how this build
of R was installed on this machine?

> > install.packages('sf')  
> --- Please select a CRAN mirror for use in this session ---
>  *** caught segfault ***
> address 0x60, cause 'memory not mapped'
> Traceback:
>  1: download.file(url, destfile = f, quiet = TRUE)

The text error is fine, there's no need for an additional screenshot.

Can you install the R development files (in particular, I'm interested
in the debugging symbols, which must live in the R-debuginfo package,
assuming you have installed R from a package) and the GNU debugger (gdb)
on this machine? Once you have done that, run R using the command 
R -d gdb, start R using the "r" command, reproduce the crash and then
post the backtrace that results from the "bt" command.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R] Error message "cs_lu(A) failed: near-singular A (or out of memory)"

2017-06-05 Thread Jeff Newmiller
This appears to be a case of insufficient understanding of statistics, which is 
not on topic for r-help. Look at how well the per-firm models would work... my 
guess is that some of the firms have insufficient data for useful analysis. If 
that is not it, consider providing a more concrete example on 
stats.stackexchange.com.
-- 
Sent from my phone. Please excuse my brevity.

On June 5, 2017 3:14:59 AM PDT, "Keilhacker, Michael" 
 wrote:
>Dear Arne,
>
>
>thank you very much upfront for your time that you invest in answering
>my question.
>
>
>I'm using your systemfit R package to analyze if companies risk
>appetite has a relationship to their performance and how it evolves
>over time. We collected data for ca. 80 companies, from 6 segments over
>15 years that gives us a final data set with 1,312 firm-year
>observations. We have set up 3 equations (based on existing SEM from
>literature) and experience the following:
>
>- The systemfit package performs well when using no dummy variables
>(e.g. for year, segment, firm)
>
>- When adding dummy variables (year / segment) the systemfit package
>still provides results; however, if we remove the segment dummy
>variable and add a firm dummy variable we experience the error message:
>"cs_lu(A) failed: near-singular A (or out of memory)"
>
>- We also tested the systemfit package with firm and year dummy
>variable using a sub-sample of our data (ca. 10 companies) and the
>package worked without any error messages
>
>- Afterwards we tested the systemfit package using a server (64 gb ram,
>16 core,...) by applying the systemfit package again on the final data
>set. However, we experienced again the same error message.
>
>
>We use R 3.3.2 and the systemfit package 1.1-20.
>
>
>I would be very grateful if you could support us anyhow and give us a
>hint how we could solve the situation.
>
>
>Thanks again for your help.
>
>
>Warm Regards from Munich,
>
>Michael
>___
>
>Michael Keilhacker, MBA, M.A.
>Logistics and Supply Chain Management
>Technische Universit�t M�nchen � TUM School of Management
>Arcisstra�e 21 � 80333 M�nchen �
>+49-163-5454918 �
>michael.keilhac...@tum.de
>www.log.wi.tum.de
>
>   [[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] R error

2015-08-06 Thread andymac
Hi,

I had a similar problem running the 32-bit version of 3.2.0 on Windows 8.1.
For me the problem was user permissions. I re-ran the R program as an
administrator rather than a user and it now installs packages just fine. 

Cheers,
Andy




--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-tp4710696p4710847.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.


Re: [R] R error

2015-08-03 Thread peter dalgaard

 On 03 Aug 2015, at 18:00 , Hood, Kyle (CDC/OCOO/OCIO/ITSO) (CTR) 
 y...@cdc.gov wrote:
 
 Good afternoon,
 
 I recently received a ticket from a customer to upgrade from 3.1.1. to 3.2.1. 
  After the upgrade, when he tries to install a package he receives the error 
 below.  Could you please advise as to what is wrong?  Thank you.

It's not too easy to tell given the number of ways large networked installs can 
be configured, but the logic is that if the R installation directory is write 
protected (which is usually a good thing), the packages go into a subdirectory 
of the user's home dir. The output suggests that R believes that this is 
\\cdc.gov\private\M328\ygv7, but apparently that doesn't exist since it tries 
to create \\cdc.gov\private which it can't.

Apart from that, try digging around in 

https://cran.r-project.org/bin/windows/base/rw-FAQ.html

-pd

 
 Kyle
 
 --- Please select a CRAN mirror for use in this session ---
 Warning in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = 
 type) :
  'lib = C:/Program Files/R/R-3.2.1/library' is not writable
 Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = 
 type) :
  unable to create '\\cdc.gov\private\M328\ygv7/R/win-library/3.2'
 In addition: Warning message:
 In dir.create(userdir, recursive = TRUE) :
  cannot create dir '\\cdc.gov\private', reason 'Permission denied'
 
   [[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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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.


Re: [R] R Error: wrong result size (...), expected ... or 1 (minimal example provided)

2015-05-02 Thread William Dunlap
  # invoke user defined function
  myFunc (  newdata=nmpr_nmproid,
  oridata=xanloid_set,
  cohort=xanloid_set$cohort_type,
  value= NMPR_Cohort,
  xdate_to_int_time=anl_to_int_time,
  xflag=xanloid_set$anlflag,
  idate=xanloid_set$intdate,
  xdate=xanloid_set$anldate,
  xdate_to_int_time_cat=xanloid_set$anl_to_int_time_cat,
  year=xanloid_set$xyear
  )

Note that some of your arguments are NULL because xanloid_set
does not contain components by the given name.  E.g., xanloid_set$anlflag
is NULL because there is no column called 'anlflag' in xanloid_set.
The NULL's will cause various problems downstream.

You can avoid this problem by using the syntax
   xanloid_set[ , anlflag]
which will give an error if the requested column does not exist.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, May 1, 2015 at 9:13 PM, Muhuri, Pradip (SAMHSA/CBHSQ) 
pradip.muh...@samhsa.hhs.gov wrote:

 Hello,

 I am reposting my question with a reproducible example/minimal dataset (6
 rows) this time.

 I have written a user-defined function (myFunc below) with ten arguments.
 When calling the function, I get the following message: “Error: wrong
 result size (0), expected 2 or 1”.
 I am not getting the desired output dataset that will have 2 rows. How
 would I resolve the issue?   Any hints would be appreciated.


 These results are from the following code chunk  outside myFunc:

 addmargins(table(xanloid_set$cohort_type))



 NMPR_Cohort  OID_Cohort   Other Sum
   2   1   3   6

 .

 Thanks,

 Pradip Muhuri





 # myFunc_rev.R
 setwd (H:/R/cis_data)
 library(dplyr)
 rm(list = ls())
 # data object - description
 temp - id  intdate anldate oiddate herdate cohort_type
 1 2004-11-04 2002-07-18 2001-07-07 2003-11-03  NMPR_Cohort
 2 2004-10-24 NA 2002-10-13 NA  OID_Cohort
 3 2004-10-10 NA NA NA  Other
 4 2004-09-01 1999-08-10 NA 2002-11-04  NMPR_Cohort
 5 2004-09-04 1997-10-05 NA NA  Other
 6 2004-10-25 NA NA 2011-11-04  Other
 # read the data object
 xanloid_set - read.table(textConnection(temp),
colClasses=c(character, Date, Date,
 Date, Date, character),
header=TRUE, as.is=TRUE
 )
 # print the data object
 xanloid_set
 # Define user-defined function
 myFunc - function (newdata,
 oridata,
 cohort,
 value,
 xdate_to_int_time,
 xflag,
 idate,
 xdate,
 xdate_to_int_time_cat,
 year) {

 newdata  -filter (oridata, cohort== value ) %%
mutate(xdate_to_int_time =
 ifelse(xflag==1, (idate-xdate)/365.25, NA),
xdate_to_int_time_cat =
 cut(xdate_to_int_time, breaks=c(0,1,2,3,4,5,6,7),

  include.lowest=TRUE, stringsAsFactors = FALSE) )
 addmargins(with(newdata, table(year,
 xdate_to_int_time_cat, na.rm=TRUE)))
 }
 # invoke user defined function
 myFunc (  newdata=nmpr_nmproid,
 oridata=xanloid_set,
 cohort=xanloid_set$cohort_type,
 value= NMPR_Cohort,
 xdate_to_int_time=anl_to_int_time,
 xflag=xanloid_set$anlflag,
 idate=xanloid_set$intdate,
 xdate=xanloid_set$anldate,
 xdate_to_int_time_cat=xanloid_set$anl_to_int_time_cat,
 year=xanloid_set$xyear
 )
 # tabulate cohort_type
   addmargins(table(xanloid_set$cohort_type))



 [[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] R ERROR- Error in file(file, rt) : cannot open the connection

2014-08-28 Thread Sarah Goslee
Hi,

You don't show us your code, and you really should, but most likely
you did not put the file where you thought you did, or there's a typo
in the name.

Using file.choose() may help.

Also, I think it's bad practice to put user files in the R library
directory. You should make a working directory in your own workspace.

Sarah


On Thu, Aug 28, 2014 at 1:41 AM, Girija Kalyani smileismys...@gmail.com wrote:
 Dear R Group,

 I have an species occurence file stored in dismo/ex/abc.csv.
 When i read the file, it shows error.
 Error in file(file, rt) : cannot open the connection
 In addition: Warning message:
 In file(file, rt) :  cannot open file
 'G:/Software/R-3.1.1/library/dismo/ex/occurence.csv': No such file or
 directory
 What could b the reason, it shows no such file in directory, but i saved my
 file in the place where i have mentioned in d code.
 Can someone help me out with this?
 Thanx in advanvce

-- 
Sarah Gosle
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

__
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 ERROR- Error in file(file, rt) : cannot open the connection

2014-08-28 Thread Jeff Newmiller
Such problems usually come from not understanding where files really are, 
though sometimes odd file permissions can be the culprit. Understanding how 
backslashes work in R strings also sometimes causes problems, though you seem 
to be using forward slashes so that may not apply here.

You may find that reading the help files could provide more accurate picture 
about the file system from R's point of view than you currently have in your 
mind.

?list.files
list.files()
?getwd
getwd()
list.files(G:/Software/R-3.1.1/library/dismo/ex)

You should not have to use setwd() to successfully read a file, but it can be 
convenient.

If you confirm the directory is there but you only see a subset of files that 
you expect, then you may have a permissions problem. My advice is to stay away 
from changing permissions if at all possible... it usually only occurs because 
you were doing something As Administrator when you shouldn't have been, and 
fixing that is a pit of despair and off topic here.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On August 27, 2014 10:41:23 PM PDT, Girija Kalyani smileismys...@gmail.com 
wrote:
Dear R Group,

I have an species occurence file stored in dismo/ex/abc.csv.
When i read the file, it shows error.
Error in file(file, rt) : cannot open the connection
In addition: Warning message:
In file(file, rt) :  cannot open file
'G:/Software/R-3.1.1/library/dismo/ex/occurence.csv': No such file or
directory
What could b the reason, it shows no such file in directory, but i
saved my
file in the place where i have mentioned in d code.
Can someone help me out with this?
Thanx in advanvce

   [[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] R Error, very odd....

2013-06-21 Thread thomas.k
I received the same error message. With me, the problem was that I had the
cells in my CSV file in Excel formatted as percentages. R read them as
factors and not as numeric values. After changing the cell format from
percentage to general in Excel, the problem was solved.



--
View this message in context: 
http://r.789695.n4.nabble.com/R-Error-very-odd-tp887545p4670026.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.


Re: [R] R error: system is computationally singular when building GMM model

2013-01-13 Thread Uwe Ligges



On 13.01.2013 15:08, zoe chan wrote:


Dear,
I built the generalized method of moments model to estimate the sales rank
in the bookstore using plm package in R.

The equation is:

data1.gmm - pgmm(dynformula(lnsales_rank ~ ln_price + avg_ham_rate +
avg_spam_rate + num_of_ham+ num_of_spam + ship_code2 +ship_code3
+ship_code4+ ship_code5+ ship_code6 + ship_ code7, lag = list(0, 0, 0,
0,0,0,0,0,0,0,0,0), log =FALSE), data=data, effect = individual, model =
twosteps, transformation = ld,gmm.inst = ~ ln_price, lag.gmm =2)

However, error message: Error in solve.default(Reduce(+, A1)) :
   system is computationally singular: reciprocal condition number =
6.36689e-23 shown.

I found that skipping one of the ship_code variables (dummy variable) can
generate result. But don't know the reason.

I found some books about using R, but no one can answer me.


The error message says quite a lot: The code tries solve() and fails 
since the matrix is numerically singular.
Now go ahead and find out why that happens. Not enough data for all 
combinations of your categorical variables in a way that you can still 
estimate all the coefficients, I believe,


Uwe Ligges





Please help. Thanks much.

Zoe 
[[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] ./R: error while loading shared libraries

2013-01-10 Thread R. Michael Weylandt
I'd move this to the R-SIG-Fedora list and, in doing so, give more
info about your install process: built yourself, package manager, etc.

MW

On Wed, Jan 9, 2013 at 7:31 PM, Adam Dahman adamo...@yahoo.ca wrote:
 Hi,

 I have installed R on linux using a non root account.

 I am getting this error when trying to use it :
 ./R: error while loading shared libraries: libRblas.so: cannot open shared 
 object file: No such file or directory


 Linux version I am using :
 Linux version 2.6.32-131.17.1.el6.x86_64 
 (mockbu...@x86-007.build.bos.redhat.com) (gcc version 4.4.5 20110214 (Red Hat 
 4.4.5-6) (GCC) ) #1 SMP Thu Sep 29 10:24:25 EDT 2011


 Can someone help ?

 Regards,
 Adam
 [[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] R Error, very odd....

2012-06-06 Thread Nane
I had the exact same error message, and figured out that the problem was
coming from one of my cell being filled with a Na instead of a NA. 

--
View this message in context: 
http://r.789695.n4.nabble.com/R-Error-very-odd-tp887545p4632492.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.


Re: [R] R Error: System is computationally singular

2012-05-24 Thread David Winsemius


On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:


Greetings,

I am trying to fit a zero-inflated Poisson model using zeroinfl()  
from the

pscl library. I have 5 covariates (4 continuous, 1 categorical); the
categorical variable has 7 levels.  I have had success fitting  
models that
contain only the continuous covariates; however, when I add the  
categorical
variable to any of the models (or if I run it by itself) I get the  
following

error:

Error in solve.default(as.matrix(fit$hessian)) :

 system is computationally singular: reciprocal condition number =
3.46934e-20

The code I am using is:

library(pscl)
f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE +
D_GRASS)
ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)

There is no correlation between my covariates. Also, I tried  
reducing my
categorical covariate to 3 levels and still receive the same error.  
Can
anyone suggest why I may be getting this error when I add the  
categorical

covariate?



What does this show:

with( FAWNS, table(LOCS, LCOVER) )

--
David Winsemius, MD
West Hartford, CT

__
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 Error: System is computationally singular

2012-05-24 Thread Nathan Svoboda
Thank you for your quick reply! 
 
When I run the code you provide I get this output:
 
LCOVER
LOCS  1  2  3  4  5  6  7  9
   0 214507  79939  69803 778359  22932  32391  99630   8082
   1 15  7  1 32  0  0  0  0
   2  2  1  0  0  0  0  0  0
   3  0  0  0  1  0  0  0  0
 
Nate
 
 
 



From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thu 5/24/2012 1:54 PM
To: Nathan Svoboda
Cc: r-help@r-project.org
Subject: Re: [R] R Error: System is computationally singular




On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:

 Greetings,

 I am trying to fit a zero-inflated Poisson model using zeroinfl() 
 from the
 pscl library. I have 5 covariates (4 continuous, 1 categorical); the
 categorical variable has 7 levels.  I have had success fitting 
 models that
 contain only the continuous covariates; however, when I add the 
 categorical
 variable to any of the models (or if I run it by itself) I get the 
 following
 error:

 Error in solve.default(as.matrix(fit$hessian)) :

  system is computationally singular: reciprocal condition number =
 3.46934e-20

 The code I am using is:

 library(pscl)
 f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE +
 D_GRASS)
 ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)

 There is no correlation between my covariates. Also, I tried 
 reducing my
 categorical covariate to 3 levels and still receive the same error. 
 Can
 anyone suggest why I may be getting this error when I add the 
 categorical
 covariate?


What does this show:

with( FAWNS, table(LOCS, LCOVER) )

--
David Winsemius, MD
West Hartford, CT




[[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] R Error: System is computationally singular

2012-05-24 Thread Nathan Svoboda
Thank you for your quick reply, 

When I run the code you provide I get this output:

LCOVER
LOCS  1  2  3  4  5  6  7  9
   0 214507  79939  69803 778359  22932  32391  99630   8082
   1 15  7  1 32  0  0  0  0
   2  2  1  0  0  0  0  0  0
   3  0  0  0  1  0  0  0  0

Nate



--
View this message in context: 
http://r.789695.n4.nabble.com/R-Error-System-is-computationally-singular-tp4631242p4631251.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.


Re: [R] R Error: System is computationally singular

2012-05-24 Thread Nathan Svoboda
Hi David,
 
My apologies, I am not sure if this makes a big difference in your assessment 
of the problem, but the results I just sent were only from a portion (1/15) of 
the data. The dataset is rather large and the computer I am currently using to 
set up the models is limited in its capabilities to analyze large datasets. 
When I run the code you provided on a larger portion of the data (1/2) this is 
the output I receive:
 
 LCOVER
LOCS   1   2   3   4   5   6   7   9
   0 1692196  630659  550623 6140352  180896  255512  785929   63756
   1 141  30  48 279   9  14  36   1
   2  17   4   5  14   3   3   4   1
   3   0   0   0   3   0   0   1   0
   5   2   0   0   0   0   0   0   0
 
Thanks again for your time and assistance,
 
Nate
 
Nathan Svoboda
Graduate Research Assistant
Mississippi State University
 
 


From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thu 5/24/2012 1:54 PM
To: Nathan Svoboda
Cc: r-help@r-project.org
Subject: Re: [R] R Error: System is computationally singular




On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:

 Greetings,

 I am trying to fit a zero-inflated Poisson model using zeroinfl() 
 from the
 pscl library. I have 5 covariates (4 continuous, 1 categorical); the
 categorical variable has 7 levels.  I have had success fitting 
 models that
 contain only the continuous covariates; however, when I add the 
 categorical
 variable to any of the models (or if I run it by itself) I get the 
 following
 error:

 Error in solve.default(as.matrix(fit$hessian)) :

  system is computationally singular: reciprocal condition number =
 3.46934e-20

 The code I am using is:

 library(pscl)
 f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE +
 D_GRASS)
 ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)

 There is no correlation between my covariates. Also, I tried 
 reducing my
 categorical covariate to 3 levels and still receive the same error. 
 Can
 anyone suggest why I may be getting this error when I add the 
 categorical
 covariate?


What does this show:

with( FAWNS, table(LOCS, LCOVER) )

--
David Winsemius, MD
West Hartford, CT




[[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] R Error: System is computationally singular

2012-05-24 Thread Marc Schwartz
Nathan,

This does help, as in the first cut you provided, there was no variability in 
LOCS for LCOVER = 5 and you have very few values of LOCS  0 (you still do, 
relative to the scale of the total).

Have you tried using a zero inflated negative binomial model (dist = negbin) 
rather than poisson? I am not sure that the assumption of a zero inflated 
poisson distribution is reasonable with your data. Also, at least in this cut 
of the data, you have no 4's in LOCS and no 8's in LCOVER (same as before).

If my math is correct only 0.006% of your LOCS values are  0. I am also not 
convinced that you have enough data to differentiate between 1 and =1 of 
whatever it is you are counting in LOCS.

If that is the case, you might want to consider using logistic regression with 
a dichotomous response variable of LOCS == 0 versus LOCS = 1. You seem to be 
in the general realm of very rare events given the distribution of LOCS in your 
data. 

Regards,

Marc Schwartz


On May 24, 2012, at 2:41 PM, Nathan Svoboda wrote:

 Hi David,
 
 My apologies, I am not sure if this makes a big difference in your assessment 
 of the problem, but the results I just sent were only from a portion (1/15) 
 of the data. The dataset is rather large and the computer I am currently 
 using to set up the models is limited in its capabilities to analyze large 
 datasets. When I run the code you provided on a larger portion of the data 
 (1/2) this is the output I receive:
 
 LCOVER
 LOCS   1   2   3   4   5   6   7   9
   0 1692196  630659  550623 6140352  180896  255512  785929   63756
   1 141  30  48 279   9  14  36   1
   2  17   4   5  14   3   3   4   1
   3   0   0   0   3   0   0   1   0
   5   2   0   0   0   0   0   0   0
 
 Thanks again for your time and assistance,
 
 Nate
 
 Nathan Svoboda
 Graduate Research Assistant
 Mississippi State University
 
 
 On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:
 
 Greetings,
 
 I am trying to fit a zero-inflated Poisson model using zeroinfl() 
 from the
 pscl library. I have 5 covariates (4 continuous, 1 categorical); the
 categorical variable has 7 levels.  I have had success fitting 
 models that
 contain only the continuous covariates; however, when I add the 
 categorical
 variable to any of the models (or if I run it by itself) I get the 
 following
 error:
 
 Error in solve.default(as.matrix(fit$hessian)) :
 
 system is computationally singular: reciprocal condition number =
 3.46934e-20
 
 The code I am using is:
 
 library(pscl)
 f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE +
 D_GRASS)
 ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)
 
 There is no correlation between my covariates. Also, I tried 
 reducing my
 categorical covariate to 3 levels and still receive the same error. 
 Can
 anyone suggest why I may be getting this error when I add the 
 categorical
 covariate?
 
 
 What does this show:
 
 with( FAWNS, table(LOCS, LCOVER) )
 
 --
 David Winsemius, MD
 West Hartford, CT

__
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 Error: System is computationally singular

2012-05-24 Thread David Winsemius


On May 24, 2012, at 3:41 PM, Nathan Svoboda wrote:


Re: [R] R Error: System is computationally singular
Hi David,

My apologies, I am not sure if this makes a big difference in your  
assessment of the problem, but the results I just sent were only  
from a portion (1/15) of the data. The dataset is rather large and  
the computer I am currently using to set up the models is limited in  
its capabilities to analyze large datasets. When I run the code you  
provided on a larger portion of the data (1/2) this is the output I  
receive:


 LCOVER
LOCS   1   2   3   4   5   6   7   9
   0 1692196  630659  550623 6140352  180896  255512  785929   63756
   1 141  30  48 279   9  14  36   1
   2  17   4   5  14   3   3   4   1
   3   0   0   0   3   0   0   1   0
   5   2   0   0   0   0   0   0   0


I do not see linear dependence (aka computational singularity) in that  
data, but if there are no LOCS values of 4, an missing levels has been  
reported as a show-stopper with zinf models with pscl in the past.  
There could also easily emerge linear dependence if you tabulated the  
entire data set. If level 4 had 3 at level 4 of LCOVER or 1 at level 7  
then there would be linear dependence.


Marc Schwartz, a smarter guy than I,  has already suggested to you  
that your Poisson error structure might not be a good description of  
the data.





Thanks again for your time and assistance,

Nate

Nathan Svoboda
Graduate Research Assistant
Mississippi State University


From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Thu 5/24/2012 1:54 PM
To: Nathan Svoboda
Cc: r-help@r-project.org
Subject: Re: [R] R Error: System is computationally singular


On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:

 Greetings,

 I am trying to fit a zero-inflated Poisson model using zeroinfl()
 from the
 pscl library. I have 5 covariates (4 continuous, 1 categorical); the
 categorical variable has 7 levels.  I have had success fitting
 models that
 contain only the continuous covariates; however, when I add the
 categorical
 variable to any of the models (or if I run it by itself) I get the
 following
 error:

 Error in solve.default(as.matrix(fit$hessian)) :

  system is computationally singular: reciprocal condition number =
 3.46934e-20

 The code I am using is:

 library(pscl)
 f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER +  
D_EDGE +

 D_GRASS)
 ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)

 There is no correlation between my covariates. Also, I tried
 reducing my
 categorical covariate to 3 levels and still receive the same error.
 Can
 anyone suggest why I may be getting this error when I add the
 categorical
 covariate?


What does this show:

with( FAWNS, table(LOCS, LCOVER) )

--
David Winsemius, MD
West Hartford, CT




David Winsemius, MD
West Hartford, CT

__
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 Error: System is computationally singular

2012-05-24 Thread Nathan Svoboda
Thank you both, 
 
I will try using a zero inflated negative binomial as suggested. I had success 
with negative binomial on previous runs but only when I had fewer covariates 
and only ran a portion (10%) of the data. 
 
I may also try to reduce the number of covariates in the model (i.e., combine 
some of my landcover [LCOVER] classifications). 
 
I have considered using logistic regression and may end up trying that.   
 
I appreciate both of your input and will let you know (i.e., post) the results 
of these suggestions and what ends up working for the benefit of you and others.
 
Thank you for your time and quick responses!!
 
Nate
 
 
Nathan Svoboda
Graduate Research Assistant
Carnivore Ecology Lab
Mississippi State University
 



From: Marc Schwartz [mailto:marc_schwa...@me.com]
Sent: Thu 5/24/2012 3:09 PM
To: Nathan Svoboda
Cc: David Winsemius; r-help@r-project.org
Subject: Re: [R] R Error: System is computationally singular



Nathan,

This does help, as in the first cut you provided, there was no variability in 
LOCS for LCOVER = 5 and you have very few values of LOCS  0 (you still do, 
relative to the scale of the total).

Have you tried using a zero inflated negative binomial model (dist = negbin) 
rather than poisson? I am not sure that the assumption of a zero inflated 
poisson distribution is reasonable with your data. Also, at least in this cut 
of the data, you have no 4's in LOCS and no 8's in LCOVER (same as before).

If my math is correct only 0.006% of your LOCS values are  0. I am also not 
convinced that you have enough data to differentiate between 1 and =1 of 
whatever it is you are counting in LOCS.

If that is the case, you might want to consider using logistic regression with 
a dichotomous response variable of LOCS == 0 versus LOCS = 1. You seem to be 
in the general realm of very rare events given the distribution of LOCS in your 
data.

Regards,

Marc Schwartz


On May 24, 2012, at 2:41 PM, Nathan Svoboda wrote:

 Hi David,

 My apologies, I am not sure if this makes a big difference in your assessment 
 of the problem, but the results I just sent were only from a portion (1/15) 
 of the data. The dataset is rather large and the computer I am currently 
 using to set up the models is limited in its capabilities to analyze large 
 datasets. When I run the code you provided on a larger portion of the data 
 (1/2) this is the output I receive:

 LCOVER
 LOCS   1   2   3   4   5   6   7   9
   0 1692196  630659  550623 6140352  180896  255512  785929   63756
   1 141  30  48 279   9  14  36   1
   2  17   4   5  14   3   3   4   1
   3   0   0   0   3   0   0   1   0
   5   2   0   0   0   0   0   0   0

 Thanks again for your time and assistance,

 Nate

 Nathan Svoboda
 Graduate Research Assistant
 Mississippi State University


 On May 24, 2012, at 1:57 PM, Nathan Svoboda wrote:

 Greetings,

 I am trying to fit a zero-inflated Poisson model using zeroinfl()
 from the
 pscl library. I have 5 covariates (4 continuous, 1 categorical); the
 categorical variable has 7 levels.  I have had success fitting
 models that
 contain only the continuous covariates; however, when I add the
 categorical
 variable to any of the models (or if I run it by itself) I get the
 following
 error:

 Error in solve.default(as.matrix(fit$hessian)) :

 system is computationally singular: reciprocal condition number =
 3.46934e-20

 The code I am using is:

 library(pscl)
 f1 - formula(LOCS ~ as.factor(LCOVER) + D_ROADS + D_WATER + D_EDGE +
 D_GRASS)
 ZIP1 - zeroinfl(f1, dist=poisson, link = logit, data = FAWNS)

 There is no correlation between my covariates. Also, I tried
 reducing my
 categorical covariate to 3 levels and still receive the same error.
 Can
 anyone suggest why I may be getting this error when I add the
 categorical
 covariate?


 What does this show:

 with( FAWNS, table(LOCS, LCOVER) )

 --
 David Winsemius, MD
 West Hartford, CT




[[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] R error- more columns than column names

2012-04-14 Thread andronikos1990
Hi all, I had the same problem and I was trying to solve with several ways.
However it was the most simple thing. While I was extracting the file from
Excel to a csv file I was using , instead of . inside my numbers (for
example 9,28 instead of 9.28) and each column was seperated with a ;
instead of ,. General rule: open your csv file first and see if everything
is in position first. Then try mess with R! :-)
Hope my silly mistake helps others to save some time.

--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p4556655.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.


Re: [R] R Error/Warning Messages with library(MASS) using glm.

2012-04-14 Thread Ben Bolker
LNadler lauren.e.nadler at gmail.com writes:

 
 Hi there,
 
 I have been having trouble running negative binomial regression (glm.nb)
 using library MASS in R v2.15.0 on Mac OSX.  
 
 I am running multiple models on the variables influencing the group size of
 damselfish in coral reefs (count data).  For total group size and two of my
 species, glm.nb is working great to deal with overdispersion in my count
 data.  For two of my species, I am getting a mixture of warning and error
 messages.  These species are different from the others in that they have
 slightly smaller group sample size (so there are more 0s) and the group size
 varies more widely (from 1 to 45 fish versus 1 to 11 fish for the other
 species for which the model is working).  Here is a sample of my output and
 the error messages:

 
 model1-glm.nb(X...of.C..viridis~PC1+Average.Branch.Diameter+
  Average.Branch.Spacing+PC1*Average.Branch.Diameter+
 Average.Branch.Diameter*Average.Branch.Spacing+PC1*Average.Branch.Spacing)

 By the way, this model specification is equivalent to
 
X...of.C..viridis~(PC1+Average.Branch.Diameter+Average.Branch.Spacing)^2

 (i.e. main effects plus all pairwise interactions); also,
A*B stands for interactions plus all main effects (A + B+ A:B)
so your formula is slightly (harmlessly) redundant


 There were 50 or more warnings (use warnings() to see the first 50)
  warnings()
 Warning messages:
 1: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
 control$trace   ... :
   iteration limit reached
 2: In sqrt(1/i) : NaNs produced
 3: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace =
 control$trace   ... :
   iteration limit reached (ETC...CONTINUES ON THE SAME FOR 50 WARNINGS)

 
 (Dispersion parameter for Negative Binomial(61302.24) family taken to be 1)

  This estimated dispersion parameter is ridiculously large ... either your
data are effectively Poisson, or the the theta estimate is questionable.

 Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L,  : 
   invalid 'nsmall' argument

  This error actually derives not from the model fitting itself, but
from R's attempt to print the summary -- the print.summary method is
trying to use the standard error of theta to determine the format,
but that's NA (or NaN, I forget) in this case.

Here's a reproducible example I came up with several years ago that shows
a similar pathology; I was able to get around it using
bbmle::mle2 ...

#
library(MASS)

tadT - c(0,0,0,450,0,0,0,315,233,0,200,300)
Distance - rep(c(10,100,500),rep(4,3))

d - data.frame(tadT,Distance)
plot(tadT)
plot(Distance,jitter(tadT))
library(ggplot2)
ggplot(d,aes(Distance,tadT))+stat_sum(aes(size=factor(..n..)))+
theme_bw()+geom_smooth(method=glm,family=quasipoisson)

## constant model
tad.con - glm.nb(tadT ~ 1, control=glm.control(trace=10))
log(mean(tadT))  ## OK, it got the mean right at least ...
tad.con$theta

ss - summary(tad.con)

print(ss)
## error
## Error in prettNum(...) invalid 'nsmall' argument
## debug(MASS:::print.summary.negbin)

## x$SE.theta is NaN so dp is NaN so format(...,nsmall=dp)
##  gives an error

## given more iterations to get where it's going, it goes
## out of control (and crashes)
glm.nb(tadT ~ 1, control=glm.control(trace=10,maxit=100))

## doesn't help to make an identity link
glm.nb(tadT ~ 1,link=identity, control=glm.control(trace=10))
glm.nb(tadT ~ 1,link=identity, control=glm.control(trace=10,maxit=100))


library(bbmle)
## can also use starting values of 0,0, but get warnings
m1 - mle2(tadT~dnbinom(mu=exp(logmu),size=exp(logk)),
 data=d,
 start=list(logmu=4,logk=-1))
confint(m1)  ## works OK

p1 - profile(m1)
plot(p1)
## also try as a function of distance
tad.dist - glm.nb(tadT ~ Distance)
## with trace/maxit set
glm.nb(tadT ~ Distance,control=glm.control(trace=10,maxit=100))
## does setting init.theta 1 help?
glm.nb(tadT ~ Distance,init.theta=1e-6,control=glm.control(trace=10,maxit=100))
glm.nb(tadT ~ Distance,init.theta=1e-1,control=glm.control(trace=10,maxit=100))

m2 - mle2(tadT~dnbinom(mu=exp(logmu),size=exp(logk)),
   data=d,
   parameters=list(logmu~Distance),
   start=list(logmu=4,logk=-1))
summary(m2)
p2 - profile(m2)
plot(p2)
confint(p2)

anova(m1,m2)

## setting all zeros to 1 gives reasonable answers but???
tadT1 - tadT
tadT1[tadT1==0] - 1
glm.nb(tadT1 ~ Distance,control=glm.control(trace=10,maxit=100))

## quasipoisson does work ... but no likelihood/AIC available
glm.q1 - glm(tadT ~ 1,family=quasipoisson())
glm.qd - glm(tadT ~ Distance,family=quasipoisson())

__
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 error message

2012-04-12 Thread mlell08
Hi,
 The code I have used is

 summary(prefdata)
 prefdata[prefdata5]=NA
 summary(prefdata)
 prefdata2=as.matrix(prefdata[3:22])
 stats=paf(prefdata2)
 [1] One of your variables is a constant. Constants are disallowed as
 part of
could you provide some data / sample data you used for prefdata and code
that is fully reproducible?

Regards!

__
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 Error : DATA to MATRIX

2012-03-26 Thread David Winsemius


On Mar 25, 2012, at 2:43 PM, ritwi...@isical.ac.in wrote:


Thanks David, your suggestion works fine.btw I have another
question..If I set (n,m) little bit large, say (n=20,m=10), R  
cannot
handle the large data frame generated through expand.grid.Is  
there
any way to increase R-memory so that I can tackle large data.frame  
in R

?


Please read the Posting Guide. After doing so, you may understand why  
you have gotten no responses.


--
David.


regards
ritwik



On Mar 23, 2012, at 2:53 AM, ritwi...@isical.ac.in wrote:


Dear Sir/Madam,

I'm getting a problem with a R-code which converts a data frame to a
matrix.

It first generate a (m^(n-m) * m) matrix A and then regenerate  
another

matrix B having less dimension than A which satisfy some condition.
Now I
wish to assign each row of B to a vector as individual.

My problem is when I set any choice of (n,m) except m=1 it works
fine but
setting m=1 I got the error : Error in B[i, ] : incorrect number of
dimensions.

Moreover if (n,m) is large (say, (20,8)) I got the error : Error:
cannot
allocate vector of size 3.0 Gb. I know this is due to large
dimension of
matrix A. How to solve this problem.

My code is given below:

**

n=5
m=3
R=numeric(0)
# Generate all possible m-tuple ( variables having range 0 to n  )
in a (
m^(n-m) * m ) matrix

r = expand.grid(rep(list(0:(n-m)), m))

write.table(r,file=test.txt,row.names=FALSE,col.names=FALSE)

a= read.table(file=test.txt,sep=,header=FALSE)

A= data.matrix(a)

#.

# Generate matrix whose rowsum = n-m

meet.crit = apply(A, 1, function(.row) any((sum(.row)) == n- 
m))  #

criteron for being rowsum = n

cbind(A,  
meet.crit)  #

Checking rowsum = n for each row
-m
B=A[meet.crit,]


At this point the default behavior of the [ function is to return a
vector rather than a matrix. You need to add drop=FALSE as an
additional argument. Read the help page for ?[.

 #

Generate matrix

#.


for(i in 1:choose(n-1,m-1)){
R=B[i,]
}

***

Can you please help me how to get rid of these errors. Thanking  
you in

advance.

Regards

Ritwik Bhattacharya


Senior Research Fellow
SQC  OR UNIT, KOLKATA
INDIAN STATISTICAL INSTITUTE


--

David Winsemius, MD
West Hartford, CT

This mail is scanned by Ironport





This mail is scanned by Ironport



David Winsemius, MD
West Hartford, CT

__
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 Error : DATA to MATRIX

2012-03-26 Thread Ashish Agarwal
On similar lines, how do I assign the position of the an occurence of a
value say 7 in a data vector to another data vector?

 nFields
 [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6
I need the output data vector showing occurence of 7 as:
[1] 7 8 12

I tried following but both has errors
xFields7 - NULL
for (i in 1:length(nFields)) {
 c(xFields7,ifelse(nFields[i] == 7,i,NULL)) - xFields7
}

xFields7 - NULL
for (i in 1:length(nFields)) {
 if nFields[i] == 7 then c(xFields7,i) - xFields7
}

[[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] R Error : DATA to MATRIX

2012-03-26 Thread Berend Hasselman

On 26-03-2012, at 11:34, Ashish Agarwal wrote:

 On similar lines, how do I assign the position of the an occurence of a
 value say 7 in a data vector to another data vector?
 
 nFields
 [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6
 I need the output data vector showing occurence of 7 as:
 [1] 7 8 12
 
 I tried following but both has errors
 xFields7 - NULL
 for (i in 1:length(nFields)) {
 c(xFields7,ifelse(nFields[i] == 7,i,NULL)) - xFields7
 }
 
 xFields7 - NULL
 for (i in 1:length(nFields)) {
 if nFields[i] == 7 then c(xFields7,i) - xFields7
 }


?which

Berend

__
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 Error : DATA to MATRIX

2012-03-26 Thread Petr PIKAL
 
 On similar lines, how do I assign the position of the an occurence of a 
 value say 7 in a data vector to another data vector?
  
  nFields
  [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6
 I need the output data vector showing occurence of 7 as:
 [1] 7 8 12

which(nFields==7)

Regards
Petr


  
 I tried following but both has errors
 xFields7 - NULL
 for (i in 1:length(nFields)) {
  c(xFields7,ifelse(nFields[i] == 7,i,NULL)) - xFields7 
 }
  
 xFields7 - NULL
 for (i in 1:length(nFields)) {
  if nFields[i] == 7 then c(xFields7,i) - xFields7 
 }
 


__
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 Error : DATA to MATRIX

2012-03-25 Thread ritwik_r
Thanks David, your suggestion works fine.btw I have another
question..If I set (n,m) little bit large, say (n=20,m=10), R cannot
handle the large data frame generated through expand.grid.Is there
any way to increase R-memory so that I can tackle large data.frame in R
?

regards
ritwik


 On Mar 23, 2012, at 2:53 AM, ritwi...@isical.ac.in wrote:

 Dear Sir/Madam,

 I'm getting a problem with a R-code which converts a data frame to a
 matrix.

 It first generate a (m^(n-m) * m) matrix A and then regenerate another
 matrix B having less dimension than A which satisfy some condition.
 Now I
 wish to assign each row of B to a vector as individual.

 My problem is when I set any choice of (n,m) except m=1 it works
 fine but
 setting m=1 I got the error : Error in B[i, ] : incorrect number of
 dimensions.

 Moreover if (n,m) is large (say, (20,8)) I got the error : Error:
 cannot
 allocate vector of size 3.0 Gb. I know this is due to large
 dimension of
 matrix A. How to solve this problem.

 My code is given below:

 **

 n=5
 m=3
 R=numeric(0)
 # Generate all possible m-tuple ( variables having range 0 to n  )
 in a (
 m^(n-m) * m ) matrix

 r = expand.grid(rep(list(0:(n-m)), m))

 write.table(r,file=test.txt,row.names=FALSE,col.names=FALSE)

 a= read.table(file=test.txt,sep=,header=FALSE)

 A= data.matrix(a)

 #.

 # Generate matrix whose rowsum = n-m

 meet.crit = apply(A, 1, function(.row) any((sum(.row)) == n-m))  #
 criteron for being rowsum = n

 cbind(A, meet.crit)  #
 Checking rowsum = n for each row
 -m
 B=A[meet.crit,]

 At this point the default behavior of the [ function is to return a
 vector rather than a matrix. You need to add drop=FALSE as an
 additional argument. Read the help page for ?[.

   #
 Generate matrix

 #.


 for(i in 1:choose(n-1,m-1)){
 R=B[i,]
 }

 ***

 Can you please help me how to get rid of these errors. Thanking you in
 advance.

 Regards

 Ritwik Bhattacharya


 Senior Research Fellow
 SQC  OR UNIT, KOLKATA
 INDIAN STATISTICAL INSTITUTE

 --

 David Winsemius, MD
 West Hartford, CT

 This mail is scanned by Ironport




This mail is scanned by Ironport

__
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 Error : DATA to MATRIX

2012-03-23 Thread Petr PIKAL
Hi

See in text.
 
 Dear Sir/Madam,
 
 I'm getting a problem with a R-code which converts a data frame to a 
matrix.
 
 It first generate a (m^(n-m) * m) matrix A and then regenerate another
 matrix B having less dimension than A which satisfy some condition. Now 
I
 wish to assign each row of B to a vector as individual.
 
 My problem is when I set any choice of (n,m) except m=1 it works fine 
but
 setting m=1 I got the error : Error in B[i, ] : incorrect number of
 dimensions.
 
 Moreover if (n,m) is large (say, (20,8)) I got the error : Error: cannot
 allocate vector of size 3.0 Gb. I know this is due to large dimension of
 matrix A. How to solve this problem.
 
 My code is given below:
 
 **
 
 n=5
 m=3
 R=numeric(0)
 # Generate all possible m-tuple ( variables having range 0 to n  ) in a 
(
 m^(n-m) * m ) matrix
 
 r = expand.grid(rep(list(0:(n-m)), m))
 
 write.table(r,file=test.txt,row.names=FALSE,col.names=FALSE)
 
 a= read.table(file=test.txt,sep=,header=FALSE)

Above lines do not do any sensible things. r shall be same as a.

 
 A= data.matrix(a)
 
 
#.
 
 # Generate matrix whose rowsum = n-m
 
 meet.crit = apply(A, 1, function(.row) any((sum(.row)) == n-m))  # 
 criteron for being rowsum = n

No error

 
 cbind(A, meet.crit)  # 
 Checking rowsum = n for each row
 -m
 B=A[meet.crit,]  # 

No error

 Generate matrix
 
 
#.
 
 
 for(i in 1:choose(n-1,m-1)){
 R=B[i,]
 }

No error. However in each cycle only ith row is added to R and therefore 
only last row (in this case B[6,]) is added and stays in R. Either you 
need to use

R - c(R, B[i,])

in your construction or better as B is matrix

 class(B)
[1] matrix

you can transform it to vector easily by stripping dimensions.

 R-t(B)
 dim(R) -NULL
 R
 [1] 2 0 0 1 1 0 0 2 0 1 0 1 0 1 1 0 0 2

Regards
Petr


 
 
***
 
 Can you please help me how to get rid of these errors. Thanking you in
 advance.
 
 Regards
 
 Ritwik Bhattacharya
 
 
 Senior Research Fellow
 SQC  OR UNIT, KOLKATA
 INDIAN STATISTICAL INSTITUTE
 
 Voice : +91 9051253944
 
 This mail is scanned by Ironport
 
 __
 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] R Error : DATA to MATRIX

2012-03-23 Thread David Winsemius


On Mar 23, 2012, at 2:53 AM, ritwi...@isical.ac.in wrote:


Dear Sir/Madam,

I'm getting a problem with a R-code which converts a data frame to a  
matrix.


It first generate a (m^(n-m) * m) matrix A and then regenerate another
matrix B having less dimension than A which satisfy some condition.  
Now I

wish to assign each row of B to a vector as individual.

My problem is when I set any choice of (n,m) except m=1 it works  
fine but

setting m=1 I got the error : Error in B[i, ] : incorrect number of
dimensions.

Moreover if (n,m) is large (say, (20,8)) I got the error : Error:  
cannot
allocate vector of size 3.0 Gb. I know this is due to large  
dimension of

matrix A. How to solve this problem.

My code is given below:

**

n=5
m=3
R=numeric(0)
# Generate all possible m-tuple ( variables having range 0 to n  )  
in a (

m^(n-m) * m ) matrix

r = expand.grid(rep(list(0:(n-m)), m))

write.table(r,file=test.txt,row.names=FALSE,col.names=FALSE)

a= read.table(file=test.txt,sep=,header=FALSE)

A= data.matrix(a)

#.

# Generate matrix whose rowsum = n-m

meet.crit = apply(A, 1, function(.row) any((sum(.row)) == n-m))  #
criteron for being rowsum = n

cbind(A, meet.crit)  #
Checking rowsum = n for each row
-m
B=A[meet.crit,]


At this point the default behavior of the [ function is to return a  
vector rather than a matrix. You need to add drop=FALSE as an  
additional argument. Read the help page for ?[.


 #

Generate matrix

#.


for(i in 1:choose(n-1,m-1)){
R=B[i,]
}

***

Can you please help me how to get rid of these errors. Thanking you in
advance.

Regards

Ritwik Bhattacharya


Senior Research Fellow
SQC  OR UNIT, KOLKATA
INDIAN STATISTICAL INSTITUTE


--

David Winsemius, MD
West Hartford, CT

__
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 error in make check

2012-01-11 Thread Prof Brian Ripley
You should ask this on R-devel, and tell them exactly what compilers you 
used.  See the posting guide: this falls under


'Questions likely to prompt discussion unintelligible to non-programmers 
should go to to R-devel.'


But yes, it is something to worry about and it looks as if your compiler 
generated incorrect code.  The 'R Installation and Administration Guide' 
has things to say about what that compiler appears to be, and you seem 
not to have followed its advice.


On 11/01/2012 20:41, Anirban Jana wrote:

Hi,
After building R 2.14.1 on a Linux system (SUSE Linux Enterprise Server
11 (x86_64) ), I ran make check but it halted with the foll error:
Testing examples for package âbaseâ
Error: testing 'base' failed
Execution halted

I looked in build dir/test/Examples/base-Ex.Rout.fail and found the foll:

***EXCERPT *
...
  ### --- Pickyness Flags : -
...
  ## Don't show:
  m0 - m - structure(cbind(I=1, a=1:3), foo = bar, class = matrix)
  attributes(m0) - rev(attributes(m))
  names(attributes(m0)) # 'dim' remains first, interestingly...
[1] dim class foo dimnames
 
  stopifnot(identical(0, -0), !identical(0, -0, num.eq=FALSE),
+ identical(NaN, -NaN), !identical(NaN, -NaN, single.NA=FALSE),
+ identical(m, m0), !identical(m, m0, attrib.as.set=FALSE) )
Error: !identical(0, -0, num.eq = FALSE) is not TRUE
Execution halted
**END OF EXCERPT**

I configured the R build with
./configure --prefix=/usr/local/packages/R/builds/2.14.1
--with-blas=-mkl=sequential --with-lapack=-mkl=sequential CC=icc
CFLAGS=-O3 -mkl=sequential F77=ifort FFLAGS=-O3 -mkl=sequential
CXX=icpc CXXFLAGS=-O3 -mkl=sequential FC=ifort FCFLAGS=-O3
-mkl=sequential LDFLAGS=-O3 -mkl=sequential

I also tried building with O2 intead of O3, it gave the same error on
running make check.

I had previously built R 2.11.1 similarly on the same system, and that
build passed all tests.

Is this error sth to be concerned with? If yes, how to fix it?

Many thanks in advance for the help
Anirban




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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

2011-12-17 Thread Uwe Ligges



On 15.12.2011 16:42, verse123 wrote:

Hi guys,

I am new to R and I am bascially trying to load a library that I installed
and use external data that I have. When trying to use an R package called
cummeRbund (http://compbio.mit.edu/cummeRbund/), I am doing:


library(cummeRbund)

Loading required package: RSQLite
Loading required package: DBI
Loading required package: reshape
Loading required package: plyr

cuff- readCufflinks(system.file(cds.diff, package=cummeRbund))


I get this error message:

Creating database /cuffData.db
Error in sqliteNewConnection(drv, ...) :
   RS-DBI driver: (could not connect to dbname:
unable to open database file

Any ideas why?



At least according to the documentation the first argument for that 
function should be a Directory in which all CuffDiff output files can 
be located.


Uwe Ligges







--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-tp4200447p4200447.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] R error function (NOT erf)

2011-11-16 Thread Rolf Turner

On 17/11/11 18:54, Sachin Abeywardana wrote:

Hi all,

I was wondering if it was possible to get R to throw an error if a 
certain condition was reached. For example:


if dim(A)[2]=1
error(Need a matrix not a vector)


?stop

cheers,

Rolf Turner

__
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 error- more columns than column names

2011-09-25 Thread boris
Hi there ... I see you had this problem last year, hope you solved it ... 
I had that same problem over and over again, it was due to my separator was
, but .
it means my keybord was set up on croatian instead of english, now works
normaly ...
cheers

--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p3841415.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.


Re: [R] R error using Survr function with gcmrec

2010-11-15 Thread Emily C
I've solved the condition problem, but have come across another one with the
gcmrec function and was wondering if anyone could point me in the right
direction again? After running the code below, I get this error message:

Error in gcmrec(Survr(id, time, event) ~ var, data = dataOK, s = 1096) :
  NA/NaN/Inf in foreign function call (arg 14)

I've looked into the code of the function and believe it has something to do
with the line call - match.call() but I'm not sure how it works. Thanks
for any input!


# dataset

id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))


start=c(1996-01-01,1997-01-01,1998-01-01,1998-03-15,1996-01-01,
1996-04-15,1997-01-01,1998-01-01,1996-01-01,1997-01-01,
1998-01-01,1998-09-30,1996-01-01,1997-01-01,1997-12-15,
1998-01-01,1998-06-14)


stop=c(1997-01-01,1998-01-01,1998-03-15,1999-01-01,1996-04-15,
1997-01-01,1998-01-01,1999-01-01,1997-01-01,1998-01-01,
1998-09-30,1999-01-01,1997-01-01,1997-12-15,1998-01-01,
1998-06-14,1999-01-01)


time=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)


event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)


enum=c(rep(seq(1,4,1),4),5)


var=c(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,
135692,11686,11976,11976,12251,12251)


data=data.frame(id,start,stop,time,event,enum,var)


# modify Survr function

Survr = function (id, time, event)

{

if (length(unique(id)) = length(event[event == 0])) {

stop(Data doesn't match. Every subject must have a censored time)

}

if (length(unique(event))  2 | max(event) != 1 | min(event) !=

0) {

stop(event must be 0-1)

}

ans - cbind(id, time, event)

oldClass(ans) - Survr

invisible(ans)

}


# model

dataOK=addCenTime(data)

m-gcmrec(Survr(id,time,event)~var, data=dataOK, s=1096)








On Thu, Nov 11, 2010 at 3:50 PM, Emily C lia.bede...@gmail.com wrote:

 Sorry for the lack of context - I found a forum (
 http://r.789695.n4.nabble.com/R-help-f789696.html) that I thought was
 easier to navigate and was using it for the first time. Hit the reply
 button, but forgot that the mailing list recipients would not see previous
 message in the thread. I've pasted it at the bottom for reference.

 I actually need my data as single year entries as I am assessing the effect
 of a time-varying covariate (var) that is measured (and changes) on an
 annual basis. However, my events are assessed on a daily basis. But thank
 you for pointing out the condition in Survr(). To correct the problem, I
 believe it would still be valid to change the condition to:

 if (length(unique(id)) = length(event[event == 0])) {
   stop(Data doesn't match. Every subject must have a censored time)

 Thank you for the reply!


 On Thu, Nov 11, 2010 at 2:54 PM, David Winsemius 
 dwinsem...@comcast.netwrote:


 On Nov 11, 2010, at 2:50 PM, David Winsemius wrote:


 On Nov 11, 2010, at 2:09 PM, Emily wrote:


 I'm having the same problem


 (???: from a three year-old posting for which you didn't copy any
 context.)

  and was wondering whether you ever found a
 solution? It gives me the error Error in Survr(id, time, event) : Data
 doesn't match. Every subject must have a censored time even though all
 my
 subjects are right-censored, and to be sure, I've even used the
 addCenTime
 function. Any input appreciated!


 Your data has a lot of 0 events at the end of calendar years. That does
 not


  seem to be the expected format for the Survr records. It appears to
 define an


  invalid record as one where the only censoring event is at the time of
 the

 ^valid^

  last observation. Here's the first line in Survr that is throwing the
 error:

 if (length(unique(id)) != length(event[event == 0])) {
   stop(Data doesn't match. Every subject must have a censored time)

 I suspect you need to collapse your single-year entries with 0 events
 into multiple year entries with an event.

 --
 David.


 Here's my sample data:

 id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))


 start=c(1996-01-01,1997-01-01,1998-01-01,1998-03-15,1996-01-01,1996-04-15,1997-01-01,1998-01-01,1996-01-01,1997-01-01,1998-01-01,1998-09-30,1996-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14)


 stop=c(1997-01-01,1998-01-01,1998-03-15,1999-01-01,1996-04-15,1997-01-01,1998-01-01,1999-01-01,1997-01-01,1998-01-01,1998-09-30,1999-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14,1999-01-01)

 time=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)

 event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)

 enum=c(rep(seq(1,4,1),4),5)


 var=c(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,135692,11686,11976,11976,12251,12251)

 data=data.frame(id,start,stop,time,event,enum,var)

 dataOK=addCenTime(data)
 m-gcmrec(Survr(id,time,event)~var, data=dataOK)
 --
 View this message in context:
 http://r.789695.n4.nabble.com/R-error-using-Survr-function-with-gcmrec-tp858931p3038374.html
 Sent from the R help mailing list archive at Nabble.com.

 __

Re: [R] R error using Survr function with gcmrec

2010-11-11 Thread Emily

I'm having the same problem and was wondering whether you ever found a
solution? It gives me the error Error in Survr(id, time, event) : Data
doesn't match. Every subject must have a censored time even though all my
subjects are right-censored, and to be sure, I've even used the addCenTime
function. Any input appreciated!

Here's my sample data:

id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))

start=c(1996-01-01,1997-01-01,1998-01-01,1998-03-15,1996-01-01,1996-04-15,1997-01-01,1998-01-01,1996-01-01,1997-01-01,1998-01-01,1998-09-30,1996-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14)

stop=c(1997-01-01,1998-01-01,1998-03-15,1999-01-01,1996-04-15,1997-01-01,1998-01-01,1999-01-01,1997-01-01,1998-01-01,1998-09-30,1999-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14,1999-01-01)

time=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)

event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)

enum=c(rep(seq(1,4,1),4),5)

var=c(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,135692,11686,11976,11976,12251,12251)

data=data.frame(id,start,stop,time,event,enum,var)

dataOK=addCenTime(data)
m-gcmrec(Survr(id,time,event)~var, data=dataOK)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-error-using-Survr-function-with-gcmrec-tp858931p3038374.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.


Re: [R] R error using Survr function with gcmrec

2010-11-11 Thread David Winsemius


On Nov 11, 2010, at 2:09 PM, Emily wrote:



I'm having the same problem


(???: from a three year-old posting for which you didn't copy any  
context.)



and was wondering whether you ever found a
solution? It gives me the error Error in Survr(id, time, event) :  
Data
doesn't match. Every subject must have a censored time even though  
all my
subjects are right-censored, and to be sure, I've even used the  
addCenTime

function. Any input appreciated!


Your data has a lot of 0 events at the end of calendar years. That  
does not seem to be the expected format for the Survr records. It  
appears to define an invalid record as one where the only censoring  
event is at the time of the last observation. Here's the first line in  
Survr that is throwing the error:


 if (length(unique(id)) != length(event[event == 0])) {
stop(Data doesn't match. Every subject must have a censored  
time)


I suspect you need to collapse your single-year entries with 0 events  
into multiple year entries with an event.


--
David.



Here's my sample data:

id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))

start 
= 
c 
(1996 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-03 
-15 
,1996 
-01 
-01 
,1996 
-04 
-15 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1996 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-09 
-30,1996-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14)


stop 
= 
c 
(1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-03 
-15 
,1999 
-01 
-01 
,1996 
-04 
-15 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1999 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-09 
-30 
,1999 
-01 
-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14,1999-01-01)


time 
=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)


event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)

enum=c(rep(seq(1,4,1),4),5)

var 
= 
c 
(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,135692,11686,11976,11976,12251,12251 
)


data=data.frame(id,start,stop,time,event,enum,var)

dataOK=addCenTime(data)
m-gcmrec(Survr(id,time,event)~var, data=dataOK)
--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-using-Survr-function-with-gcmrec-tp858931p3038374.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.


David Winsemius, MD
West Hartford, CT

__
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 error using Survr function with gcmrec

2010-11-11 Thread David Winsemius


On Nov 11, 2010, at 2:50 PM, David Winsemius wrote:



On Nov 11, 2010, at 2:09 PM, Emily wrote:



I'm having the same problem


(???: from a three year-old posting for which you didn't copy any  
context.)



and was wondering whether you ever found a
solution? It gives me the error Error in Survr(id, time, event) :  
Data
doesn't match. Every subject must have a censored time even though  
all my
subjects are right-censored, and to be sure, I've even used the  
addCenTime

function. Any input appreciated!


Your data has a lot of 0 events at the end of calendar years. That  
does not


seem to be the expected format for the Survr records. It appears to  
define an


invalid record as one where the only censoring event is at the time  
of the

^valid^
last observation. Here's the first line in Survr that is throwing  
the error:


if (length(unique(id)) != length(event[event == 0])) {
   stop(Data doesn't match. Every subject must have a censored  
time)


I suspect you need to collapse your single-year entries with 0  
events into multiple year entries with an event.


--
David.



Here's my sample data:

id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))

start 
= 
c 
(1996 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-03 
-15 
,1996 
-01 
-01 
,1996 
-04 
-15 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1996 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-09 
-30 
,1996-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14)


stop 
= 
c 
(1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-03 
-15 
,1999 
-01 
-01 
,1996 
-04 
-15 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1999 
-01 
-01 
,1997 
-01 
-01 
,1998 
-01 
-01 
,1998 
-09 
-30 
,1999 
-01 
-01 
,1997-01-01,1997-12-15,1998-01-01,1998-06-14,1999-01-01)


time 
=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)


event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)

enum=c(rep(seq(1,4,1),4),5)

var 
= 
c 
(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,135692,11686,11976,11976,12251,12251 
)


data=data.frame(id,start,stop,time,event,enum,var)

dataOK=addCenTime(data)
m-gcmrec(Survr(id,time,event)~var, data=dataOK)
--
View this message in context: 
http://r.789695.n4.nabble.com/R-error-using-Survr-function-with-gcmrec-tp858931p3038374.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.


David Winsemius, MD
West Hartford, CT

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


David Winsemius, MD
West Hartford, CT

__
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 error using Survr function with gcmrec

2010-11-11 Thread Emily C
Sorry for the lack of context - I found a forum (
http://r.789695.n4.nabble.com/R-help-f789696.html) that I thought was easier
to navigate and was using it for the first time. Hit the reply button, but
forgot that the mailing list recipients would not see previous message in
the thread. I've pasted it at the bottom for reference.

I actually need my data as single year entries as I am assessing the effect
of a time-varying covariate (var) that is measured (and changes) on an
annual basis. However, my events are assessed on a daily basis. But thank
you for pointing out the condition in Survr(). To correct the problem, I
believe it would still be valid to change the condition to:

if (length(unique(id)) = length(event[event == 0])) {
  stop(Data doesn't match. Every subject must have a censored time)

Thank you for the reply!


On Thu, Nov 11, 2010 at 2:54 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Nov 11, 2010, at 2:50 PM, David Winsemius wrote:


 On Nov 11, 2010, at 2:09 PM, Emily wrote:


 I'm having the same problem


 (???: from a three year-old posting for which you didn't copy any
 context.)

  and was wondering whether you ever found a
 solution? It gives me the error Error in Survr(id, time, event) : Data
 doesn't match. Every subject must have a censored time even though all
 my
 subjects are right-censored, and to be sure, I've even used the
 addCenTime
 function. Any input appreciated!


 Your data has a lot of 0 events at the end of calendar years. That does
 not


  seem to be the expected format for the Survr records. It appears to define
 an


  invalid record as one where the only censoring event is at the time of the

 ^valid^

  last observation. Here's the first line in Survr that is throwing the
 error:

 if (length(unique(id)) != length(event[event == 0])) {
   stop(Data doesn't match. Every subject must have a censored time)

 I suspect you need to collapse your single-year entries with 0 events into
 multiple year entries with an event.

 --
 David.


 Here's my sample data:

 id=c(rep(1,4),rep(2,4),rep(3,4),rep(4,5))


 start=c(1996-01-01,1997-01-01,1998-01-01,1998-03-15,1996-01-01,1996-04-15,1997-01-01,1998-01-01,1996-01-01,1997-01-01,1998-01-01,1998-09-30,1996-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14)


 stop=c(1997-01-01,1998-01-01,1998-03-15,1999-01-01,1996-04-15,1997-01-01,1998-01-01,1999-01-01,1997-01-01,1998-01-01,1998-09-30,1999-01-01,1997-01-01,1997-12-15,1998-01-01,1998-06-14,1999-01-01)

 time=c(366,365,73,292,105,261,365,365,366,365,272,93,366,348,17,164,201)

 event=c(0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0)

 enum=c(rep(seq(1,4,1),4),5)


 var=c(21312,21869,22441,22441,3105,3105,3086,3075,130610,133147,135692,135692,11686,11976,11976,12251,12251)

 data=data.frame(id,start,stop,time,event,enum,var)

 dataOK=addCenTime(data)
 m-gcmrec(Survr(id,time,event)~var, data=dataOK)
 --
 View this message in context:
 http://r.789695.n4.nabble.com/R-error-using-Survr-function-with-gcmrec-tp858931p3038374.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.


 David Winsemius, MD
 West Hartford, CT

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


 David Winsemius, MD
 West Hartford, CT


Original message in thread:

Would someone be able to help with this question?  I'm using the
Gcmrec, Survrec, and Design packages to do a power analysis on
simulated data.  I'm receiving an error after using the Survr function
that all data must have a censoring time even after using the gcmrec
function:  newdata-addCenTime(olddata).  My program is below.  I'd
greatly appreciate any help!

id-c(seq(1,288,by=1),seq(1,79,by=1),seq(1,11,by=1))
x-c(rep(0,5),rep(1,6),rep(0,45),rep(1,23),rep(0,124),rep(1,85),
  +rep(0,4),rep(1,1),rep(0,1),rep(1,5),rep(0,31),rep(1,14),rep(0,5),
  +rep(1,18),rep(0,8),rep(1,3))
myrates-((1-x)*0.0639 + (x)*0.0320)
y-c(rexp(378,rate=myrates))
cen-c(rexp(378,0.0385))
time-pmin(y,cen)
event-as.numeric(y=cen)
x2-(x-1)*(-1)
bvdata-data.frame(id,event,time,x2)
bvdata2-addCenTime(bvdata)
fit-cph(Survr(id,event,time)~x2,data=bvdata2)

[[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] R error- more columns than column names

2010-02-24 Thread Tal Galili
I usually found this problem to be connected to spaces in the column names.
Or, a wrong sep argument (for example , instead of \t and the like)

Let us know if it helped.

Cheers,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, Feb 24, 2010 at 11:14 PM, Euphoria yeshapate...@gmail.com wrote:


 Hi all! I am desperately trying to figure out the solution to this error,
 but
 nothing as of yet is working.

 As noted in an earlier post I am using GenABEL.  In an attempt to read in
 the phenotype file, in the format .dat, R keeps giving me the error more
 columns than column names

 I have tried to read in the data without the headers; I have also tried to
 trim the data to remove any trailing tabs or spaces but it doesn't solve
 the
 problem.  All missing values have been replaced with NA, and all data
 seems to have matching corresponding header value - each column has a
 matching column name.

 What could be the possible underlying problem? I have tried to
 problem-solve
 but clearly I am at a loss. Thanks for your help!

 Code:
  mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen =
 pedmap-0.raw, force = T)
 --
 View this message in context:
 http://n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p1568052.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.


[[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] R error- more columns than column names

2010-02-24 Thread Don MacQueen

From the help page for the read.delim() function, under See Also, suggests:

 'count.fields' can be useful to determine problems with reading
 files which result in reports of incorrect record lengths.

This is sometimes helpful.

-Don

At 1:14 PM -0800 2/24/10, Euphoria wrote:

Hi all! I am desperately trying to figure out the solution to this error, but
nothing as of yet is working. 


As noted in an earlier post I am using GenABEL.  In an attempt to read in
the phenotype file, in the format .dat, R keeps giving me the error more
columns than column names

I have tried to read in the data without the headers; I have also tried to
trim the data to remove any trailing tabs or spaces but it doesn't solve the
problem.  All missing values have been replaced with NA, and all data
seems to have matching corresponding header value - each column has a
matching column name.

What could be the possible underlying problem? I have tried to problem-solve
but clearly I am at a loss. Thanks for your help!

Code:
 mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen =
pedmap-0.raw, force = T)
--
View this message in context: 
http://*n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p1568052.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.



--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

__
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 error- more columns than column names

2010-02-24 Thread Erik Iverson
I had a comment character # in my header names earlier today that 
threw this error.


Euphoria wrote:

Hi all! I am desperately trying to figure out the solution to this error, but
nothing as of yet is working.  


As noted in an earlier post I am using GenABEL.  In an attempt to read in
the phenotype file, in the format .dat, R keeps giving me the error more
columns than column names

I have tried to read in the data without the headers; I have also tried to
trim the data to remove any trailing tabs or spaces but it doesn't solve the
problem.  All missing values have been replaced with NA, and all data
seems to have matching corresponding header value - each column has a
matching column name.

What could be the possible underlying problem? I have tried to problem-solve
but clearly I am at a loss. Thanks for your help! 


Code:
 mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen =
pedmap-0.raw, force = T)


__
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 error- more columns than column names

2010-02-24 Thread Tal Galili
That makes me wonder, if one could devise a function to check for common
reasons for this error and report them.

What do you think Erik (and other R users) ?
I mean, just going through the R-help list in search of this error - could
yield many common reasons to check for...

Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Feb 25, 2010 at 12:13 AM, Erik Iverson er...@ccbr.umn.edu wrote:

 I had a comment character # in my header names earlier today that threw
 this error.


 Euphoria wrote:

 Hi all! I am desperately trying to figure out the solution to this error,
 but
 nothing as of yet is working.
 As noted in an earlier post I am using GenABEL.  In an attempt to read in
 the phenotype file, in the format .dat, R keeps giving me the error more
 columns than column names

 I have tried to read in the data without the headers; I have also tried to
 trim the data to remove any trailing tabs or spaces but it doesn't solve
 the
 problem.  All missing values have been replaced with NA, and all data
 seems to have matching corresponding header value - each column has a
 matching column name.

 What could be the possible underlying problem? I have tried to
 problem-solve
 but clearly I am at a loss. Thanks for your help!
 Code:
  mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen =
 pedmap-0.raw, force = T)


 __
 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] R error- more columns than column names

2010-02-24 Thread Euphoria

Thanks to all who posted. After trying all of the above-listed options - the
error is still popping up, but here is some progress:

1) I can read in the file just fine when I use the read.table statement and
specify it as a tab delimited file using the code:

two - read.table(Z:/CCFPhenotypesTAB.dat, head=TRUE, sep=\t)

But, my issue is with GenABEL and the load.gwaa.data statement - I need the
file to be read into load.gwaa.data - unless there is another way to read in
the phenotype file in GenABEL.

Code:
mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen  =
pedmap-0.raw)


2) Also, it might help if I explained how I came about the .dat file.  It
was originally created in excel as a .xlsx file, which I converted to a tab
delimited .txt file. I just changed the .txt extension to .dat for it to be
read in R for the GenABEL package.  

-- 
View this message in context: 
http://n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p1568313.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.


Re: [R] R error- more columns than column names

2010-02-24 Thread David Winsemius


On Feb 24, 2010, at 7:07 PM, Euphoria wrote:



Thanks to all who posted. After trying all of the above-listed  
options - the

error is still popping up, but here is some progress:

1) I can read in the file just fine when I use the read.table  
statement and

specify it as a tab delimited file using the code:

two - read.table(Z:/CCFPhenotypesTAB.dat, head=TRUE, sep=\t)

But, my issue is with GenABEL and the load.gwaa.data statement - I  
need the
file to be read into load.gwaa.data - unless there is another way to  
read in

the phenotype file in GenABEL.

Code:
mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen  =
pedmap-0.raw)


The first line of that function body is this:

dta - read.table(phenofile, header = TRUE, as.is = TRUE)

Notice that no provision was made for a supplied sep argument. Hack it  
so that it recognizes tab characters. Just changing hte extension  
designation will not allter the fact that iwas not designed to work  
with tab as a separator.


Perhaps this as a replacement:

dta - read.table(phenofile, header = TRUE, as.is = TRUE, sep=\t)

Or give the argument list a set of ellipses  , ...) and the above line  
some ellipses to receive the argument.



--
David.




2) Also, it might help if I explained how I came about the .dat  
file.  It
was originally created in excel as a .xlsx file, which I converted  
to a tab
delimited .txt file. I just changed the .txt extension to .dat for  
it to be

read in R for the GenABEL package.

--
View this message in context: 
http://n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p1568313.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.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 error- more columns than column names

2010-02-24 Thread Tal Galili
Euphoria,
Also just consider re-saving the file as a comma separated file (or another
one that fits)



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Feb 25, 2010 at 2:18 AM, David Winsemius dwinsem...@comcast.netwrote:


 On Feb 24, 2010, at 7:07 PM, Euphoria wrote:


 Thanks to all who posted. After trying all of the above-listed options -
 the
 error is still popping up, but here is some progress:

 1) I can read in the file just fine when I use the read.table statement
 and
 specify it as a tab delimited file using the code:

 two - read.table(Z:/CCFPhenotypesTAB.dat, head=TRUE, sep=\t)

 But, my issue is with GenABEL and the load.gwaa.data statement - I need
 the
 file to be read into load.gwaa.data - unless there is another way to read
 in
 the phenotype file in GenABEL.

 Code:
 mix - load.gwaa.data (phe = Z:/CCFPhenotypesTAB.dat, gen  =
 pedmap-0.raw)


 The first line of that function body is this:

 dta - read.table(phenofile, header = TRUE, as.is = TRUE)

 Notice that no provision was made for a supplied sep argument. Hack it so
 that it recognizes tab characters. Just changing hte extension designation
 will not allter the fact that iwas not designed to work with tab as a
 separator.

 Perhaps this as a replacement:

 dta - read.table(phenofile, header = TRUE, as.is = TRUE, sep=\t)

 Or give the argument list a set of ellipses  , ...) and the above line some
 ellipses to receive the argument.


 --
 David.




 2) Also, it might help if I explained how I came about the .dat file.  It
 was originally created in excel as a .xlsx file, which I converted to a
 tab
 delimited .txt file. I just changed the .txt extension to .dat for it to
 be
 read in R for the GenABEL package.

 --
 View this message in context:
 http://n4.nabble.com/R-error-more-columns-than-column-names-tp1568052p1568313.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.


 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT


 __
 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] R Error, very odd....

2009-05-11 Thread Dieter Menne



Katie2009 wrote:
 
 I'm trying to analyse some excel data in R.  The problem is that when i
 input the data with the first column as absolute values, everything works
 fine, can analyse as normal.  When I leave the first column unchanged to
 import negative numbers as well I get:
 
 Error in storage.mode(y) - double : 
   invalid to change the storage mode of a factor
 In addition: Warning message:
 In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored
 
 

You did not tell us anything how you got the data from Excel, so I have to
guess. Try to re-arrange your Excel row so that the first (3 ? check the
docs; which docs? your unknown function's) lines contain non-missing data.

Dieter
-- 
View this message in context: 
http://www.nabble.com/R-Error%2C-very-odd-tp23477195p23478090.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.


Re: [R] R Error, very odd....

2009-05-11 Thread Dieter Menne



Katie2009 wrote:
 
 hi dieter,
 
 the method i'm using is in excel, copying the data, then in r
 
 w-read.delim(clipboard)
 w-as.data.frame(w)
  
 i've been  doing a bit more fiddling, and have identified the 'class' of
 the column that i'm having trouble with, is classified as 'factor' whilst
 the rest are numeric.
 
 

read.delim internally uses the same function as read.table, so you might
consult that documentation:

The number of data columns is determined by looking at the first five lines
of input (or the whole file if it has less than five lines), or from the
length of col.names if it is specified and is longer. This could conceivably
be wrong if fill or blank.lines.skip are true, so specify col.names if
necessary.

So if the first lines are unusual, many things can happen. However, reading
from the clipboard
is not a very stable way to get Excel data; I would suggest to use
library(RODBC) instead,
or one of the other Excel readers. With RODBC, use named ranges, not
worksheet names
for a stable import.

Dieter





-- 
View this message in context: 
http://www.nabble.com/R-Error%2C-very-odd-tp23477195p23478576.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.


Re: [R] R Error, very odd....

2009-05-11 Thread Katie2009

hi dieter,

the method i'm using is in excel, copying the data, then in r

 w-read.delim(clipboard)
 w-as.data.frame(w)
 
i've been  doing a bit more fiddling, and have identified the 'class' of the
column that i'm having trouble with, is classified as 'factor' whilst the
rest are numeric.

if i just change that column to as.numeric of the column, this has appeared
to have solved the problem.  Has this changed that data at all though?

Thanks.


Dieter Menne wrote:
 
 
 
 Katie2009 wrote:
 
 I'm trying to analyse some excel data in R.  The problem is that when i
 input the data with the first column as absolute values, everything works
 fine, can analyse as normal.  When I leave the first column unchanged to
 import negative numbers as well I get:
 
 Error in storage.mode(y) - double : 
   invalid to change the storage mode of a factor
 In addition: Warning message:
 In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored
 
 
 
 You did not tell us anything how you got the data from Excel, so I have to
 guess. Try to re-arrange your Excel row so that the first (3 ? check the
 docs; which docs? your unknown function's) lines contain non-missing data.
 
 Dieter
 

-- 
View this message in context: 
http://www.nabble.com/R-Error%2C-very-odd-tp23477195p23478471.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.


Re: [R] R Error, very odd....

2009-05-11 Thread Don MacQueen


At 12:37 AM -0700 5/11/09, Katie2009 wrote:

hi dieter,

the method i'm using is in excel, copying the data, then in r


 w-read.delim(clipboard)
 w-as.data.frame(w)


i've been  doing a bit more fiddling, and have identified the 'class' of the
column that i'm having trouble with, is classified as 'factor' whilst the
rest are numeric.

if i just change that column to as.numeric of the column, this has appeared
to have solved the problem.  Has this changed that data at all though?


Well, you can look at the data to find out. Either just print it, or 
perhaps use simple exploration techniques, such as

  unique( column)
  table(column)
  summary(column)
compare before and after converting to numeric

In general, changing a factor to numeric can change the data relative 
to what you might think the data actually is.  Here is an example:



 tmp1 - c(-1,0,1)
 tmp2 - factor(tmp1)
 tmp3 - as.numeric(tmp2)

 tmp1

[1] -1  0  1

 tmp2

[1] -1 0  1
Levels: -1 0 1

 tmp3

[1] 1 2 3

tmp3 is  clearly not the same as tmp1.


 tmp4 - as.numeric(format(tmp2))
 tmp4

[1] -1  0  1


Evidently, R is creating a factor from a column that you think is 
numeric. Your job is to find out why. I would guess that you have, 
somewhere in the column, an entry that isn't a number. Perhaps a 
typographical error in the spreadsheet column. The effect of 
inputting as absolute values vs with negative numbers should give a 
clue to that.


Try
   tmp -  as.numeric(format( column ))
   any(is.na(tmp))
and if that is TRUE, then
   column[is.na(tmp)]

-Don



Thanks.


Dieter Menne wrote:




 Katie2009 wrote:


 I'm trying to analyse some excel data in R.  The problem is that when i
 input the data with the first column as absolute values, everything works
 fine, can analyse as normal.  When I leave the first column unchanged to
 import negative numbers as well I get:

 Error in storage.mode(y) - double :
   invalid to change the storage mode of a factor
 In addition: Warning message:
 In model.response(mf, numeric) :
   using type=numeric with a factor response will be ignored




 You did not tell us anything how you got the data from Excel, so I have to
 guess. Try to re-arrange your Excel row so that the first (3 ? check the
 docs; which docs? your unknown function's) lines contain non-missing data.

 Dieter



--
View this message in context: http:// www. 
nabble.com/R-Error%2C-very-odd-tp23477195p23478471.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.



--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

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

2008-11-21 Thread Peter Dalgaard

Rolf Turner wrote:


On 21/11/2008, at 10:13 AM, Steffy, Elizabeth A. wrote:

I got this error for this equation and i'm not sure what it means or 
how to fix it:


Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
  nothing to replace with

Does anyone know how to fix this?


No.

PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

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


Do you see the lines immediately above?

Many people on the R-help list are very clever.  ***None***
of them are telepathic.


No? I think she should ensure that index = 2, and that her R version is 
from before September 2008.


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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

2008-11-21 Thread Dieter Menne



 Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
   nothing to replace with


Peter Dalgaard wrote:
 ...that her R version is from before September 2008.

Just curious which item in NEWS this comment refers to. Something changed
in  [] ?

Dieter
-- 
View this message in context: 
http://www.nabble.com/R-Error-tp20613209p20618176.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.


Re: [R] R Error

2008-11-21 Thread Peter Dalgaard
Dieter Menne wrote:
 
 
 Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
   nothing to replace with

 
 Peter Dalgaard wrote:
 ...that her R version is from before September 2008.
 
 Just curious which item in NEWS this comment refers to. Something changed
 in  [] ?

No, it was just the error message, which now says that the replacement
has length zero. We don't usually make a NEWS entry for changes to docs
and messages. (Actually, September is not quite right. I was looking at
one of the translation files. The actual message was changed on August
28...)

 
 Dieter


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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

2008-11-20 Thread Rolf Turner


On 21/11/2008, at 10:13 AM, Steffy, Elizabeth A. wrote:

I got this error for this equation and i'm not sure what it means  
or how to fix it:


Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
  nothing to replace with

Does anyone know how to fix this?


No.

PLEASE do read the posting guide http://www.R-project.org/posting- 
guide.html

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


Do you see the lines immediately above?

Many people on the R-help list are very clever.  ***None***
of them are telepathic.

cheers,

Rolf Turner


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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 error: Not able to launch R 2.6.2

2008-03-10 Thread Petr PIKAL
Hi

Sometimes also helps to start R from elsewhere, load a package which was 
used in analysis and open .Rdata file.

[EMAIL PROTECTED] napsal dne 09.03.2008 17:45:06:

 Yes. I found one that says to change the extension to RData. Where is 
the
 folder located? I tried looking at the R folder but couldn't find it.

because it has a dot before Rdata. So the name is .Rdata and as such it is 
prevented by your setting of file explorer to show itself. Set it to 
unhide system files and you shall see it.

Regards
Petr

 
 On 3/9/08, Charilaos Skiadas [EMAIL PROTECTED] wrote:
 
  On Mar 9, 2008, at 12:12 PM, Keizer_71 wrote:
 
  
   Hi Everyone,
  
   I am having trouble using R. I am not sure what happen but when i
   start R, i
   am getting error message
  
   Fatal Error: Unable to restore saved data in .RData.
 
  Just google for unable to restore saved data in .RData. , and you
  are likely to find many posts discussing this.
 
   -I restarted my pc but still same error
   -I reinstall R but still same error
   -deleted the R folder and have a fresh re-install but still same
   issue.
  
   I am not sure what else i can do.
  
   any advice?
   --
   View this message in context: http://www.nabble.com/R-error%3A-Not-
   able-to-launch-R-2.6.2-tp15942837p15942837.html
   Sent from the R help mailing list archive at Nabble.com.
 
  Haris Skiadas
  Department of Mathematics and Computer Science
  Hanover College
 
 
 
 
 
 
 
 -- 
 Christophe Lo
 (078) 8275 7029
 [EMAIL PROTECTED]
 
[[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] R error: Not able to launch R 2.6.2

2008-03-09 Thread Charilaos Skiadas
On Mar 9, 2008, at 12:12 PM, Keizer_71 wrote:


 Hi Everyone,

 I am having trouble using R. I am not sure what happen but when i  
 start R, i
 am getting error message

 Fatal Error: Unable to restore saved data in .RData.

Just google for unable to restore saved data in .RData. , and you  
are likely to find many posts discussing this.

 -I restarted my pc but still same error
 -I reinstall R but still same error
 -deleted the R folder and have a fresh re-install but still same  
 issue.

 I am not sure what else i can do.

 any advice?
 -- 
 View this message in context: http://www.nabble.com/R-error%3A-Not- 
 able-to-launch-R-2.6.2-tp15942837p15942837.html
 Sent from the R help mailing list archive at Nabble.com.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
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 error: Not able to launch R 2.6.2

2008-03-09 Thread Duncan Murdoch
On 09/03/2008 12:12 PM, Keizer_71 wrote:
 Hi Everyone,
 
 I am having trouble using R. I am not sure what happen but when i start R, i
 am getting error message
 
 Fatal Error: Unable to restore saved data in .RData. 
 
 -I restarted my pc but still same error
 -I reinstall R but still same error
 -deleted the R folder and have a fresh re-install but still same issue.
 
 I am not sure what else i can do. 
 
 any advice?

The problem is with your .RData file, not with R.  You should delete it.

Duncan Murdoch

__
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 error: Not able to launch R 2.6.2

2008-03-09 Thread Christophe Lo
Yes. I found one that says to change the extension to RData. Where is the
folder located? I tried looking at the R folder but couldn't find it.

On 3/9/08, Charilaos Skiadas [EMAIL PROTECTED] wrote:

 On Mar 9, 2008, at 12:12 PM, Keizer_71 wrote:

 
  Hi Everyone,
 
  I am having trouble using R. I am not sure what happen but when i
  start R, i
  am getting error message
 
  Fatal Error: Unable to restore saved data in .RData.

 Just google for unable to restore saved data in .RData. , and you
 are likely to find many posts discussing this.

  -I restarted my pc but still same error
  -I reinstall R but still same error
  -deleted the R folder and have a fresh re-install but still same
  issue.
 
  I am not sure what else i can do.
 
  any advice?
  --
  View this message in context: http://www.nabble.com/R-error%3A-Not-
  able-to-launch-R-2.6.2-tp15942837p15942837.html
  Sent from the R help mailing list archive at Nabble.com.

 Haris Skiadas
 Department of Mathematics and Computer Science
 Hanover College







-- 
Christophe Lo
(078) 8275 7029
[EMAIL PROTECTED]

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