[R] install rJava in linux

2010-03-05 Thread Grześ

Hi 
I'm a problem with installing rJava in Linux

I have got in my system : java-sun, java-sun-tools, java-sun-jre 
but if I wont install rJava I got a problem like this:

  install.packages(rJava, dependencies = TRUE)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://cran.mirroring.de/src/contrib/rJava_0.8-2.tar.gz'
Content type 'application/x-gzip' length 471971 bytes (460 Kb)
opened URL
==
downloaded 460 Kb

* installing *source* package ‘rJava’ ...
checking for gcc... i686-pld-linux-gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-pld-linux-gcc -std=gnu99 accepts -g... yes
checking for i686-pld-linux-gcc -std=gnu99 option to accept ISO C89... none
needed
checking how to run the C preprocessor... i686-pld-linux-gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether i686-pld-linux-gcc -std=gnu99 supports static
inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: ''
header prep.: ''
cpp flags   : '~autodetect~'
java libs   : '-L/usr/lib/jvm/java-sun-1.6.0.18/jre/lib/i386/server
-L/usr/lib/jvm/java-sun-1.6.0.18/jre/lib/i386
-L/usr/lib/jvm/java-sun-1.6.0.18/jre/../lib/i386 -L
-L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
configure: error: Java Development Kit (JDK) is missing or not registered in
R
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/lib/R/library/rJava’

The downloaded packages are in
‘/root/tmp/RtmpA0Qvcf/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(rJava, dependencies = TRUE) :
  installation of package 'rJava' had non-zero exit status
 
 What is wrong?
-- 
View this message in context: 
http://n4.nabble.com/install-rJava-in-linux-tp1579395p1579395.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] I can't find rpart help (linux)

2010-03-05 Thread Grześ

Hi
I have installed rpart in my Linux (PLD) but I don't know how I may find
help conect this package?

Here is my instalaction: 

  install.packages(rpart,dependencies=TRUE)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://r.meteo.uni.wroc.pl/src/contrib/rpart_3.1-46.tar.gz'
Content type 'application/x-gzip' length 136572 bytes (133 Kb)
opened URL
==
downloaded 133 Kb

* installing *source* package #8216;rpart#8217; ...
** libs
i686-pld-linux-gcc -std=gnu99 -I/usr/lib/R/include  -D_FORTIFY_SOURCE=2
-fpic  -O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4
-gdwarf-2 -g2  -c anova.c -o anova.o
i686-pld-linux-gcc -std=gnu99 -I/usr/lib/R/include  -D_FORTIFY_SOURCE=2
-fpic  -O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4
-gdwarf-2 -g2  -c anovapred.c -o anovapred.o
.
.
.
usersplit.o xval.o -L/usr/lib/R/lib -lR
** R
** data
**  moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
* DONE (rpart)

The downloaded packages are in
#8216;/root/tmp/RtmpxWZkKu/downloaded_packages#8217;
Updating HTML index of packages in '.Library' 


next I do:
 library(rpart)

and as result I get:

 help(rpart)
/usr/lib/R/bin/pager[11]: /usr/bin/less: not found 

Could somebody help me, please?


-- 
View this message in context: 
http://n4.nabble.com/I-can-t-find-rpart-help-linux-tp1579403p1579403.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] install rJava in linux

2010-03-05 Thread Grześ

Thank you vary much! =^D
-- 
View this message in context: 
http://n4.nabble.com/install-rJava-in-linux-tp1579395p1579852.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] I can't find rpart help (linux)

2010-03-05 Thread Grześ

Thank you very much! :)
-- 
View this message in context: 
http://n4.nabble.com/I-can-t-find-rpart-help-linux-tp1579403p1579846.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] math function - MDS method

2010-01-06 Thread Grześ

Hi,

I need math function which is used in: isoMDS, Sammon and metaMDS method.
Anybody know where I may find it? Any manual or webside?

I would be very happy

Thanks a lot !
 
-- 
View this message in context: 
http://n4.nabble.com/math-function-MDS-method-tp1008294p1008294.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] math function - MDS method

2010-01-06 Thread Grześ

Yes I know but I need math function. Every method has a little bit different
math function. My question is: How look this function like?


stephen sefick wrote:
 
 isoMDS
 Sammon
 metaMDS
 
 and there associated help files are a good place to start
 hth
 
 Stephen
 
 On Wed, Jan 6, 2010 at 1:30 PM, Grześ gregori...@gmail.com wrote:

 Hi,

 I need math function which is used in: isoMDS, Sammon and metaMDS method.
 Anybody know where I may find it? Any manual or webside?

 I would be very happy

 Thanks a lot !

 --
 View this message in context:
 http://n4.nabble.com/math-function-MDS-method-tp1008294p1008294.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.

 
 
 
 -- 
 Stephen Sefick
 
 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.
 
   -K. Mullis
 
 __
 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.
 
 

-- 
View this message in context: 
http://n4.nabble.com/math-function-MDS-method-tp1008294p1008364.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] write result in matrix using loop

2009-08-14 Thread Grześ

Hello,
I want call my function (use my database) and write every result in matrix
wynik but I always get an error: Error in wynik[, i] - dodawanie(wzorzec,
wzorzec1) : 
  number of items to replace is not a multiple of replacement length

I'll be very happy if sb help me

 
dodawanie- function ( wzorzec, wzorzec1){ 
wynik1-wzorzec + wzorzec1 
wynik2-wzorzec * wzorzec1 
wynik - c(wynik1,wynik2) 
return (wynik) 
} 

df=data.frame(a=c(1,2,3),b=c(9,9,9),c=c(4,3,2)) # This is my database ;) 

wynik=matrix(0,nrow=10,ncol=2) 

# and my loop 
for(i in 1:ncol(df)){ 
procent_graniczny - 10 
wzorzec=df[,i] 
wzorzec1=ifelse(df$a==3,1,ifelse(df$c==4,2,3)) 
wynik[,i] - dodawanie ( wzorzec, wzorzec1)#  -  Here is my problem
!!! I want in wynik have got result from my function (one by one)
} 


-- 
View this message in context: 
http://www.nabble.com/write-result-in-matrix-using-loop-tp24958820p24958820.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] I can't load my database

2009-07-04 Thread Grześ

Hi,
I have a problem in R -  I can't load my database. When I use Gentoo
everything is ok but in Ubuntu I get a message:
Error in make.names(col.names, unique = TRUE) : 
  invalid multibyte string 5
-- 
View this message in context: 
http://www.nabble.com/I-can%27t-load-my-database-tp24337284p24337284.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] ifelse(is.na), with function inside

2009-06-19 Thread Grześ


:) Thank you very much! I have already found solution. I have always problem
with connect logical value and vector :/  You know... everybody helped me a
little. Thanks very much again!

Grzesiek


Petr Pikal wrote:
 
 Hi
 
 r-help-boun...@r-project.org napsal dne 17.06.2009 14:59:35:
 
 
 This is my function:
 
 zywnoscCalosc - function( zywnosc, sklepik, sklslodycze) { 
 
 b=as.vector(sklslodycze)
 
 fun=function(a,b){
 a=2+b
 }
 zywnosc=ifelse(is.na(sklepik),NA,fun(a,b))#Here I have a problem 
 !
 }
 
 I always get: Error in 2 + b : non-numeric argument to binary operator
 I think problem is in my vector b. What I should do to get restult my
 function fun(a,b) inside zywnosc? 
 
 It is REALLY difficult to understand what you want to achieve.
 
 There is no problem in your function (I do not get any error when I copy 
 it to R) but it is a mystery how you would like to use it, there is no 
 output from the function.
 
 I am also almost sure that a or b is not defined for function 
 zywnoscCalosc. (Try to search nested function in help archive.
 
 A wild guess is that
 
 zywnosc=ifelse(is.na(sklepik),NA,sklslodycze+2)
 
 is what you want, however without working example and/or explanation what 
 you REALLY want it is just a guess.
 
 Regards
 Petr
 
 
 
 
 
 
 
 
 
 joscani wrote:
  
  Try:
  
  b- ifelse(is.na(a),1,2)
  
  
  Grześ wrote:
  
  2 - is.na(a)  - it's superb! but I need call a function:  wy[i]-
  ifelse(((is.na(a))), call_fun1(x), call_fun2(x)
  
  
  
  Gabor Grothendieck wrote:
  
  Try:
  
  2 - is.na(a)
  
  
  On Tue, Jun 16, 2009 at 5:46 PM, Grześgregori...@gmail.com wrote:
 
  Hi,
  I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use
  is.na(a)
  function to get a vector like this:
  wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on
  value in
  vector a
 
  This is my short code but something is wrong and I don't know 
 what...
 
  for (i in 1:7){
   a=c( NA, 3, 4, 4, NA, NA, 3)
   fun1=function(x){
   x=1
   print(x)
   }
   fun2=function(x){
   x=2
   print(x)
   }
   wy[i]- ifelse(((is.na(a))), fun1(x), fun2(x))
   }
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  [1] 1
  [1] 2
  and I get a lots of warnings:
  Warning messages:
  1: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
   number of items to replace is not a multiple of replacement length
  2: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
   number of items to replace is not a multiple of replacement 
 length...
 
  and as an result I get a vector only with 1
  wy
  [1] 1 1 1 1 1 1 1
 
  I'll be very happy if someone help me
 
  --
  View this message in context:
  http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-
 tp24063455p24063455.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.
  
  
  
  
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/ifelse%28is.na%29%2C-with-
 function-inside-tp24063455p24073158.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.
 
 

-- 
View this message in context: 
http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24118560.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] ifelse(is.na), with function inside

2009-06-17 Thread Grześ

2 - is.na(a)  - it's superb! but I need call a function:  wy[i]-
ifelse(((is.na(a))), call_fun1(x), call_fun2(x)



Gabor Grothendieck wrote:
 
 Try:
 
 2 - is.na(a)
 
 
 On Tue, Jun 16, 2009 at 5:46 PM, Grześgregori...@gmail.com wrote:

 Hi,
 I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use
 is.na(a)
 function to get a vector like this:
 wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on value
 in
 vector a

 This is my short code but something is wrong and I don't know what...

 for (i in 1:7){
  a=c( NA, 3, 4, 4, NA, NA, 3)
  fun1=function(x){
  x=1
  print(x)
  }
  fun2=function(x){
  x=2
  print(x)
  }
  wy[i]- ifelse(((is.na(a))), fun1(x), fun2(x))
  }
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 and I get a lots of warnings:
 Warning messages:
 1: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length
 2: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length...

 and as an result I get a vector only with 1
 wy
 [1] 1 1 1 1 1 1 1

 I'll be very happy if someone help me

 --
 View this message in context:
 http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24063455.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.
 
 

-- 
View this message in context: 
http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24067395.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] ifelse(is.na), with function inside

2009-06-17 Thread Grześ

This is my function:

zywnoscCalosc - function( zywnosc, sklepik, sklslodycze) { 

b=as.vector(sklslodycze)

fun=function(a,b){
a=2+b
}
zywnosc=ifelse(is.na(sklepik),NA,fun(a,b))#Here I have a problem !
}

I always get: Error in 2 + b : non-numeric argument to binary operator
I think problem is in my vector b. What I should do to get restult my
function fun(a,b) inside zywnosc?  






joscani wrote:
 
 Try:
 
 b- ifelse(is.na(a),1,2)
 
 
 Grześ wrote:
 
 2 - is.na(a)  - it's superb! but I need call a function:  wy[i]-
 ifelse(((is.na(a))), call_fun1(x), call_fun2(x)
 
 
 
 Gabor Grothendieck wrote:
 
 Try:
 
 2 - is.na(a)
 
 
 On Tue, Jun 16, 2009 at 5:46 PM, Grześgregori...@gmail.com wrote:

 Hi,
 I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use
 is.na(a)
 function to get a vector like this:
 wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on
 value in
 vector a

 This is my short code but something is wrong and I don't know what...

 for (i in 1:7){
  a=c( NA, 3, 4, 4, NA, NA, 3)
  fun1=function(x){
  x=1
  print(x)
  }
  fun2=function(x){
  x=2
  print(x)
  }
  wy[i]- ifelse(((is.na(a))), fun1(x), fun2(x))
  }
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 [1] 1
 [1] 2
 and I get a lots of warnings:
 Warning messages:
 1: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length
 2: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length...

 and as an result I get a vector only with 1
 wy
 [1] 1 1 1 1 1 1 1

 I'll be very happy if someone help me

 --
 View this message in context:
 http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24063455.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.
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24073158.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] ifelse(is.na), with function inside

2009-06-16 Thread Grześ

Hi,
I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use is.na(a)
function to get a vector like this:
wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on value in
vector a
   
This is my short code but something is wrong and I don't know what...

for (i in 1:7){
 a=c( NA, 3, 4, 4, NA, NA, 3) 
 fun1=function(x){
 x=1
 print(x)
 }
 fun2=function(x){
 x=2
 print(x)
 }
 wy[i]- ifelse(((is.na(a))), fun1(x), fun2(x))
 }
[1] 1
[1] 2
[1] 1
[1] 2
[1] 1
[1] 2
[1] 1
[1] 2
[1] 1
[1] 2
[1] 1
[1] 2
[1] 1
[1] 2
and I get a lots of warnings:
Warning messages:
1: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length
2: In wy[i] - ifelse(((is.na(a))), fun1(x), fun2(x)) :
  number of items to replace is not a multiple of replacement length...

and as an result I get a vector only with 1
 wy
[1] 1 1 1 1 1 1 1
 
I'll be very happy if someone help me 

-- 
View this message in context: 
http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24063455.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] if + is.na

2009-06-15 Thread Grześ

Thank you very much ;)

Jeremiah Rounds wrote:
 
 
 Your error message is because if wants a single value and you are giving
 it a vector.  
 
  
 
 Typically you want to use functions all or any to correct this error
 message (look them up ?all ?any) and eg if(any(is.na(...)))   But in this
 case to accomplish the task you're after I don't even think you want to
 use an if.  I am not going to give you precise code because I wasn't able
 to decipher exactly what you were trying to do but something like:
 
  
 
 b[is.na(a)] = 43
 
  
 
 might be helpful.  This line would put a 43 in b in the corresponding
 entry that was na in a.
 
  
 
 Good luck!.
 
  
 
 
  
 Date: Sun, 14 Jun 2009 12:48:58 -0700
 From: gregori...@gmail.com
 To: r-help@r-project.org
 Subject: [R] if + is.na
 
 
 Hello!
 I wont to use a function is.na() 
 
 I have two vectors:
  a=c(1,NA,3,3,3)
  b=c(0,0,0,0,0)
 and when I use is.na function it's ok:
  is.na(a)
 [1] FALSE TRUE FALSE FALSE FALSE
 
 but I would create sth like this:
 
 for i in 1:length(a){
 if (wsp[i] == is.na(a)) {b=43}
 }
 or like this 
 
 if(is.na(a)) b=3 else a
 [1] 1 NA 3 3 3
 
 but I always get an error:
 the condition has length  1 and only the first element will be used
 
 Could you help me how I may avoid this problem and use function is.na
 inside
 function if - else
 Please
 
 
 -- 
 View this message in context:
 http://www.nabble.com/if-%2B-is.na-tp24025136p24025136.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.
 
 _
 Lauren found her dream laptop. Find the PC that’s right for you.
 
   [[alternative HTML version deleted]]
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/if-%2B-is.na-tp24025136p24034678.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] function inside ifelse

2009-06-15 Thread Grześ

Hi,

Could you tell me, if it's possible to create ifelse and put function
inside, for example:

code{
ifelse ((is.na(vek)), call_fun_1(arguments), call_fun_2(arguments))

call_fun_1 - function(arguments)
{ sth...
}
}
-- 
View this message in context: 
http://www.nabble.com/function-inside-ifelse-tp24035739p24035739.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] function inside ifelse

2009-06-15 Thread Grześ


Grześ wrote:
 
 Hi,
 
 Could you tell me, if it's possible to create ifelse and put function
 inside, for example:
 
 code{
 ifelse ((is.na(vek)), call_fun_1(arguments), call_fun_2(arguments))
 
 call_fun_1 - function(arguments)
 { sth...
 }
 }
 

Ok, I found answer alone! This is possible, thanks for everybody !!! ;)
-- 
View this message in context: 
http://www.nabble.com/function-inside-ifelse-tp24035739p24036034.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] if + is.na

2009-06-14 Thread Grześ

Hello!
I wont to use a function is.na() 

I have  two vectors:
  a=c(1,NA,3,3,3)
  b=c(0,0,0,0,0)
and when I use is.na function it's ok:
 is.na(a)
[1] FALSE  TRUE FALSE FALSE FALSE

but I would create sth like this:

 for i in 1:length(a){
 if (wsp[i] == is.na(a)) {b=43}
  }
or like this 

 if(is.na(a)) b=3 else a
[1]  1 NA  3  3  3

but I always get an error:
  the condition has length  1 and only the first element will be used
 
Could you help me how I may avoid this problem and use function is.na inside
function if - else
Please
 

-- 
View this message in context: 
http://www.nabble.com/if-%2B-is.na-tp24025136p24025136.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] seq(...) strange logical value

2009-06-08 Thread Grześ

Do you heve any idea why I get after this instruction everywhere false?
 seq (0, 1, by=0.1) == 0.3
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

But after different step it's ok:
 seq(0, 1, by=0.1) == 0.4
 [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE

-- 
View this message in context: 
http://www.nabble.com/seq%28...%29-strange-logical-value-tp23920374p23920374.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] add values inside vector

2009-06-01 Thread Grześ

I think it's easy problem but I can't find solution.

I have a vector:

vec - c (23.4, 3.0, 14.7, 7.7)

and I would like to add all values which are inside my vector to  each
other.

as a result a want to get one value  like sum all values from my vector- 
sth=(23.4 + 3.0 + 14.7 + 7.7) 

PS. I usually don't know how long is my vector in my function  
-- 
View this message in context: 
http://www.nabble.com/add-values-inside-vector-tp23812292p23812292.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] add values inside vector

2009-06-01 Thread Grześ

Yes it's sum. Thanks. I forgot about this function.
 

Henrique Dallazuanna wrote:
 
 Use sum:
 
 sum(vec)
 
 On Mon, Jun 1, 2009 at 7:15 AM, Grze¶ gregori...@gmail.com wrote:
 

 I think it's easy problem but I can't find solution.

 I have a vector:

 vec - c (23.4, 3.0, 14.7, 7.7)

 and I would like to add all values which are inside my vector to  each
 other.

 as a result a want to get one value  like sum all values from my vector-
 sth=(23.4 + 3.0 + 14.7 + 7.7)

 PS. I usually don't know how long is my vector in my function
 --
 View this message in context:
 http://www.nabble.com/add-values-inside-vector-tp23812292p23812292.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.

 
 
 
 -- 
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/add-values-inside-vector-tp23812292p23814313.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] logical vector as a matrix

2009-05-31 Thread Grześ

Thanks a lot! :)

Grześ wrote:
 
 I have a vector like this:
 h - c(4, 6, NA, 12) 
 and I create the secound logical vector like this:
 g - c(TRUE, TRUE, FALSE, TRUE) 
 
 And my problem is that I would like to get  a new m vector as a rasult
 h and g( as dot-matrix printer) but with missed NA value, for
 example:
 
 m = (4,6,12)
 Do you have any idea?
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23796738.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] logical vector as a matrix

2009-05-31 Thread Grześ

Thanks a lot! :)

Linlin Yan wrote:
 
 On Sat, May 30, 2009 at 2:48 AM, Grześ gregori...@gmail.com wrote:

 I have a vector like this:
 h - c(4, 6, NA, 12)
 and I create the secound logical vector like this:
 g - c(TRUE, TRUE, FALSE, TRUE)
 Why don't you create vector g like this:
 g - ! is.na(h)
 

 And my problem is that I would like to get  a new m vector as a rasult
 h
 and m but with missed NA value, for example:

 m = (4,6,12)
 Do you have any idea?
 As what you tried to do:
 m - h[g] # which got (4,6,12)
 you can directly use:
 m - h[ ! is.na(h) ]
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23796761.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] logical vector as a matrix

2009-05-31 Thread Grześ

Thanks Jorge Ivan Velez!
-- 
View this message in context: 
http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23796796.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] Error:non-numeric argument in my function

2009-05-31 Thread Grześ

Hello!
I have a function:

zywnoscCalosc- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) { 

ndf - data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf - data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){

wekt_n = ndf[i,]

wekt_n_ok = wekt_n[!is.na(wekt_n)]


dl_n = length(wekt_n_ok)
wynik = (1*wekt_n_ok)/(1*dl_n)
}
}

and I get an error like this:
Error in 1 * wekt_n_ok : non-numeric argument to binary operator

Anybody can help me?
-- 
View this message in context: 
http://www.nabble.com/Error%3Anon-numeric-argument-in-my-function-tp23807218p23807218.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] Error:non-numeric argument in my function

2009-05-31 Thread Grześ

Thanks jholtman!
But I'm not sure what and where I should change my code... :(
wekt_n = ndf[i,]
wekt_n_ok = wekt_n[!is.na(wekt_n)]
If before this line I should change wekt_n_ok  as numeric? but if I wrote 
as.numeric(wekt_n_ok) it's also not correct  

and  I also don't understand why wekt_n_ok is not numeric?

-- 
View this message in context: 
http://www.nabble.com/Error%3Anon-numeric-argument-in-my-function-tp23807218p23807873.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] logical vector as a matrix

2009-05-29 Thread Grześ

I have a vector like this:
h - c(4, 6, NA, 12) 
and I create the secound logical vector like this:
g - c(TRUE, TRUE, FALSE, TRUE) 

And my problem is that I would like to get  a new m vector as a rasult h
and m but with missed NA value, for example:

m = (4,6,12)
Do you have any idea?



-- 
View this message in context: 
http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23785253.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] I want to avioid unnecessary value

2009-05-14 Thread Grześ

I have a database like this:

kol1;kol2;kol3 ...
2;5;9
9;6;6
4;6;5...
 
I looking for a kod in R which let mi aviod in column unnecessary value, for
example number 9.

So, if I have:
 
Kol1
2
9
4
4...
 
after loop in R I would like to get my column like this:
Kol1
2
4
4...

If you have any idea I'll be grateful  to you for any idea
-- 
View this message in context: 
http://www.nabble.com/I-want-to-avioid-unnecessary-value-tp23542066p23542066.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] I can't install RWeka

2009-05-14 Thread Grześ

If I want to install RWeka I get an error:

 library(RWeka)
Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread 

Could you have any idea to help me?
-- 
View this message in context: 
http://www.nabble.com/I-can%27t-install-RWeka-tp23542141p23542141.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] library which convert dates

2009-04-29 Thread Grześ

I'm looking for library  which let mi convert dates

for example like this:
00-06-05 00:00
00-08-06 00:00
00-08-16 00:00
00-05-23 00:00
00-01-14 00:00
00-10-28 00:00

and as a result I want to get a 3 levels
-- 
View this message in context: 
http://www.nabble.com/library-which-convert-dates-tp23295853p23295853.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] I can't install dprep

2009-04-28 Thread Grześ

When I want to install dprep and I always get information:

 install.packages(dprep)
Warning in install.packages(dprep) :
  argument 'lib' is missing: using 'C:\Users\Documents/R/win-library/2.8'
--- Please select a CRAN mirror for use in this session ---
Warning message:
package ‘dprep’ is not available 

I have tried a lot of mirror... 
What I shoud do. I use Windows Vista. 

-- 
View this message in context: 
http://www.nabble.com/I-can%27t-install-dprep-tp23272265p23272265.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] Problem with create a tree

2009-04-26 Thread Grześ

I have a small database (file csv):

'District';'HouseType';'Income';'PreviousCustomer';'Outcome'
'Suburban';'Detached';'High';'No';'Nothing'
'Suburban';'Detached';'High';'Yes';'Nothing'
'Rural';'Detached';'High';'No';'Responded' ... itd.

After instruction str() as a result I get:

 str(zielone)
'data.frame': 14 obs. of 5 variables:
$ X.District. : Factor w/ 3 levels 'Rural','Suburban',..: 2 2 1 3 3 3 1
2 2 3 ...
$ X.HouseType. : Factor w/ 3 levels 'Detached','Semi-detached',..: 1 1 1
2 2 2 2 3 2 3 ...
$ X.Income. : Factor w/ 2 levels 'High','Low': 1 1 1 1 2 2 2 1 2 2 ...
$ X.PreviousCustomer.: Factor w/ 2 levels 'No','Yes': 1 2 1 1 1 2 2 1 1
1 ...
$ X.Outcome. : Factor w/ 2 levels 'Nothing','Responded': 1 1 2 2 2 1 2 1
2 2 ...

But when I try to built a tree I get an error. What's wrong in my file?

 t.zielone=rpart(zielone$X.District~.,zielone)
 plot(t.zielone)
Error in plot.rpart(t.zielone) : fit is not a tree, just a root

-- 
View this message in context: 
http://www.nabble.com/Problem-with-create-a-tree-tp23243589p23243589.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] data$ID - I always get a NULL

2009-04-20 Thread Grześ

This is my result:

 class(data)
[1] data.frame

 str(data)
'data.frame':   2193 obs. of  83 variables:
 $ X.ID.   : Factor w/ 2193 levels '18201',..:
1 2 3 4 5 6 7 8 9 10 ...
 $ X.kod.   : Factor w/ 20 levels '01','02',..: 1 1
1 1 1 1 1 1 1 1 ...
 $ X.wiel. : int  7 7 7 7 7 7 7 8 8 8 ...
 $ X.piech. : num  1 99.9 4 0.5 4 2 99.9 2 2 99.9 ...
 $ X.rodz.   : int  NA 2 4 NA 4 2 2 3 2 NA ...



David Winsemius wrote:
 
 
 On Apr 19, 2009, at 6:45 PM, Grześ wrote:
 

 I have database write as .csv file.
 
 The external sorage format is not likely to be relevant. What might be  
 informative would be to produce the code that reads this file.

 When I want to get sth from my database I get NULL, but I know that  
 there is
 sth!
 For example:

 data$ID
 NULL
 data$kod
 NULL

 but command like below is always recognize by R
 data[2,3]
 [1] '082'
 
 Tell is what happens when you enter:
 
 str(data)
 class(data)
 
 Perhaps the third column is not named ID or kod or the object is  
 not a data.frame, but is rather a matrix.
 
 -- 
 David Winsemius


 In my opinion this problem is also connect with my attempt to create  
 a tree.
 I always get errors.

 t.tree0=rpart(ID~.,t.train)
 Error in eval(expr, envir, enclos) : object ID not found

 t.tree0=rpart(kod~.,t.train)
 Error in eval(expr, envir, enclos) : object kod not found

 What I should do to create my simple trees?
 -- 
 View this message in context:
 http://www.nabble.com/data%24ID--%3E-I-always-get-a-NULL-tp23128214p23128214.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.
 
 

-- 
View this message in context: 
http://www.nabble.com/data%24ID--%3E-I-always-get-a-NULL-tp23128214p23132506.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] data$ID - I always get a NULL

2009-04-20 Thread Grześ

Now everything is clear for me. Thanks David! :)


David Winsemius wrote:
 
 
 On Apr 20, 2009, at 4:33 AM, Grześ wrote:
 

 This is my result:

 class(data)
 [1] data.frame

 str(data)
 'data.frame':2193 obs. of  83 variables:
 $ X.ID.   : Factor w/ 2193 levels  
 '18201',..:
 1 2 3 4 5 6 7 8 9 10 ...
 $ X.kod.   : Factor w/ 20 levels  
 '01','02',..: 1 1
 1 1 1 1 1 1 1 1 ...
 $ X.wiel. : int  7 7 7 7 7 7 7 8 8 8 ...
 $ X.piech. : num  1 99.9 4 0.5 4 2 99.9 2 2  
 99.9 ...
 $ X.rodz.   : int  NA 2 4 NA 4 2 2 3 2 NA ...

 David Winsemius wrote:


 On Apr 19, 2009, at 6:45 PM, Grześ wrote:


 I have database write as .csv file.

 The external sorage format is not likely to be relevant. What might  
 be
 informative would be to produce the code that reads this file.

 When I want to get sth from my database I get NULL, but I know that
 there is
 sth!
 For example:

 data$ID
 NULL
 data$kod
 NULL
 
 So the names of your columns are not ID and kod but rather X.ID.  
 and X.kod.
 
 Try instead:
   data$X.ID.
 #and:
   data$X.kkod. # you will need to use both the periods if your  
 column names end in periods.
 
 

 but command like below is always recognize by R
 data[2,3]
 [1] '082'
 
 
 That must have been a different version of data, since data[2,3] from  
 the dataframe above should have been   the number 7  number rather  
 than a string. I would also suggest that you start naming your  
 data.frames something other than data, since that is a reserved word  
 used by quite a few functions.
 
 


 Tell is what happens when you enter:

 str(data)
 class(data)

 Perhaps the third column is not named ID or kod or the object is
 not a data.frame, but is rather a matrix.

 -- 
 David Winsemius


 In my opinion this problem is also connect with my attempt to create
 a tree.
 I always get errors.

 t.tree0=rpart(ID~.,t.train)
 Error in eval(expr, envir, enclos) : object ID not found

 t.tree0=rpart(kod~.,t.train)
 Error in eval(expr, envir, enclos) : object kod not found

 What I should do to create my simple trees?

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

-- 
View this message in context: 
http://www.nabble.com/data%24ID--%3E-I-always-get-a-NULL-tp23128214p23139208.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] How use a matrix method?

2009-04-19 Thread Grześ

Why when I want to find my value from matrix I get: 2,3,4,1,2? I think that I
should get: 1,2,3,4,7,8.

 macierz=matrix(1:4,7,8)
 macierz[[2]]
[1] 2
 macierz[[3]]
[1] 3
 macierz[[4]]
[1] 4
 macierz[[5]]
[1] 1
 macierz[[6]]
[1] 2


This is a similar situation:
 macierz=matrix(9,8,7,6)
 macierz[[1]]
[1] 9
 macierz[[2]]
[1] 9
 macierz[[3]]
[1] 9

Why not: 9,8,7
-- 
View this message in context: 
http://www.nabble.com/How-use-a-matrix-method--tp23116974p23116974.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] Question about rpart(sth~.,database)

2009-04-19 Thread Grześ

I have a standard database - HouseVotes84 
For example:
   Class   V1 V2 V3   V4 V5 V6 V7 V8 V9 V10  V11 V12 V13 V14 V15  V16
1 republicann  y  ny  y  y  n  n  n   y NA   y   y   y   ny
2 republicann  y  ny  y  y  n  n  n   nn   y   y   y   n NA
3 democrat NA  y  y NA  y  y  n  n  n   ny   n   y   y   nn
 .
 .
 .
end I build a tree like this: 
 hv.tree1=rpart(Class~.,HouseVotes84)
everything is ok! My question is:
What exactly mean Class~.,? 

Why when I use Class~., - then I get the best solution but when I use as a
parameter like this:
 hv.tree2=rpart(V2~.,HouseVotes84)
I also get solution but not such good like before.  
-- 
View this message in context: 
http://www.nabble.com/Question-about-rpart%28sth%7E.%2Cdatabase%29-tp23117162p23117162.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] How use a matrix method?

2009-04-19 Thread Grześ


Peter Dalgaard wrote:
 
 Grześ wrote:
 Why when I want to find my value from matrix I get: 2,3,4,1,2? I think
 that I
 should get: 1,2,3,4,7,8.
 
 macierz=matrix(1:4,7,8)
 
 That's
 
 matrix(data=1:4, nrow=7, ncol=8)
 
 a 7x8 matrix with the numbers 1 to 4 repeated columnwise.
 
 You probably want something like matrix(c(1:4, 7, 8))
 
 -- 
 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
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907
 
 
 I understand. Thank you very much!
 __
 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.
 
 


-- 
View this message in context: 
http://www.nabble.com/How-use-a-matrix-method--tp23116974p23121213.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] Question about rpart(sth~.,database)

2009-04-19 Thread Grześ


Gavin Simpson wrote:
 
 Grześ wrote:
 I have a standard database - HouseVotes84 
 For example:
Class   V1 V2 V3   V4 V5 V6 V7 V8 V9 V10  V11 V12 V13 V14 V15  V16
 1 republicann  y  ny  y  y  n  n  n   y NA   y   y   y   ny
 2 republicann  y  ny  y  y  n  n  n   nn   y   y   y   n NA
 3 democrat NA  y  y NA  y  y  n  n  n   ny   n   y   y   nn
  .
  .
  .
 end I build a tree like this: 
 hv.tree1=rpart(Class~.,HouseVotes84)
 everything is ok! My question is:
 What exactly mean Class~.,? 
 
 It means include all remaining variables in HouseVotes84 on the rhs of 
 the formula, i.e. as variables that should be used to predict the Class 
 variable.
 
 
 Why when I use Class~., - then I get the best solution but when I use
 as a
 parameter like this:
 hv.tree2=rpart(V2~.,HouseVotes84)
 
 Why does this surprise you? You are now trying to predict the variable 
 V2 (y/n) from Class and all remaining variables.
 
 I also get solution but not such good like before.  
 
 They are solutions to two different problems.
 
 If you want to predict Class, then you need
 
 Class ~ ., data = HouseVotes84
 
 or, to specify exactly which variables to use as predictors of Class, 
 state them explicitly:
 
 Class ~ V1 + V3 + V4, data = HouseVotes84
 
 I think you should look at the documentation that comes with R (An 
 Introduction to R) or some of the contributed help documents on the R 
 Website to read up on model formulae and how to represent models using 
 this notation.
 
 HTH
 
 G
 
 __
 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.
 
 

Thank you very much!

-- 
View this message in context: 
http://www.nabble.com/Question-about-rpart%28sth%7E.%2Cdatabase%29-tp23117162p23128038.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] data$ID - I always get a NULL

2009-04-19 Thread Grześ

I have database write as .csv file.
When I want to get sth from my database I get NULL, but I know that there is
sth! 
For example:

 data$ID
NULL
 data$kod
NULL

but command like below is always recognize by R
 data[2,3]
[1] '082'

In my opinion this problem is also connect with my attempt to create a tree.
I always get errors.

 t.tree0=rpart(ID~.,t.train)
Error in eval(expr, envir, enclos) : object ID not found

 t.tree0=rpart(kod~.,t.train)
Error in eval(expr, envir, enclos) : object kod not found

What I should do to create my simple trees?
-- 
View this message in context: 
http://www.nabble.com/data%24ID--%3E-I-always-get-a-NULL-tp23128214p23128214.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] How may I add is.outer method

2009-04-12 Thread Grześ

Hello 
I have a problem like this:

 Glass$RI[is.outlier(Glass$RI)]
Error: could not find function is.outlier

Which commend I may add is.outer to my application?


-- 
View this message in context: 
http://www.nabble.com/How-may-I-add-%22is.outer%22-method-tp23006216p23006216.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.