[R] please help me for svm plot question

2006-12-07 Thread Aimin Yan
I run the following code, all other is ok,
but plot(m.svm,p5.new,As~Cur) is not ok

Anyone know why?

install.packages(e1071)
library(e1071)
library(MASS)
p5 - read.csv(http://www.public.iastate.edu/~aiminy/data/p_5_2.csv;)
p5.new-subset(p5,select=-Ms)
p5.new$Y-factor(p5.new$Y)
levels(p5.new$Y) - list(Out=c(1), In=c(0))
attach(p5.new)
m.svm-svm(Y~P+Aa+As+Cur,data=p5.new)
summary(m.svm)
plot(m.svm,p5.new,As~Cur)

Here is output:

  install.packages(e1071)
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://rh-mirror.linux.iastate.edu/CRAN/bin/windows/contrib/2.4/e1071_1.5-16.zip'
Content type 'application/zip' length 592258 bytes
opened URL
downloaded 578Kb

package 'e1071' successfully unpacked and MD5 sums checked

The downloaded packages are in
 C:\Documents and Settings\aiminy\Local 
Settings\Temp\RtmpY0B2qb\downloaded_packages
updating HTML package descriptions
  library(e1071)
Loading required package: class
  library(MASS)
  p5 - read.csv(http://www.public.iastate.edu/~aiminy/data/p_5_2.csv;)
  p5.new-subset(p5,select=-Ms)
  p5.new$Y-factor(p5.new$Y)
  levels(p5.new$Y) - list(Out=c(1), In=c(0))
  attach(p5.new)
  m.svm-svm(Y~P+Aa+As+Cur,data=p5.new)
  summary(m.svm)

Call:
svm(formula = Y ~ P + Aa + As + Cur, data = p5.new)


Parameters:
SVM-Type:  C-classification
  SVM-Kernel:  radial
cost:  1
   gamma:  0.04

Number of Support Vectors:  758

  ( 382 376 )


Number of Classes:  2

Levels:
  Out In



  plot(m.svm,p5.new,As~Cur)
Error in scale(newdata[, object$scaled, drop = FALSE], center = 
object$x.scale$scaled:center,  :
 (subscript) logical subscript too long
 
 

__
R-help@stat.math.ethz.ch 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] please help me for svm plot question

2006-12-07 Thread Aimin Yan
I run the following code, all other is ok,
but plot(m.svm,p5.new,As~Cur) is not ok

Anyone know why?

install.packages(e1071)
library(e1071)
library(MASS)
p5 - read.csv(http://www.public.iastate.edu/~aiminy/data/p_5_2.csv;)
p5.new-subset(p5,select=-Ms)
p5.new$Y-factor(p5.new$Y)
levels(p5.new$Y) - list(Out=c(1), In=c(0))
attach(p5.new)
m.svm-svm(Y~P+Aa+As+Cur,data=p5.new)
summary(m.svm)
plot(m.svm,p5.new,As~Cur)

Here is output:

  install.packages(e1071)
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://rh-mirror.linux.iastate.edu/CRAN/bin/windows/contrib/2.4/e1071_1.5-16.zip'
Content type 'application/zip' length 592258 bytes
opened URL
downloaded 578Kb

package 'e1071' successfully unpacked and MD5 sums checked

The downloaded packages are in
 C:\Documents and Settings\aiminy\Local 
Settings\Temp\RtmpY0B2qb\downloaded_packages
updating HTML package descriptions
  library(e1071)
Loading required package: class
  library(MASS)
  p5 - read.csv(http://www.public.iastate.edu/~aiminy/data/p_5_2.csv;)
  p5.new-subset(p5,select=-Ms)
  p5.new$Y-factor(p5.new$Y)
  levels(p5.new$Y) - list(Out=c(1), In=c(0))
  attach(p5.new)
  m.svm-svm(Y~P+Aa+As+Cur,data=p5.new)
  summary(m.svm)

Call:
svm(formula = Y ~ P + Aa + As + Cur, data = p5.new)


Parameters:
SVM-Type:  C-classification
  SVM-Kernel:  radial
cost:  1
   gamma:  0.04

Number of Support Vectors:  758

  ( 382 376 )


Number of Classes:  2

Levels:
  Out In



  plot(m.svm,p5.new,As~Cur)
Error in scale(newdata[, object$scaled, drop = FALSE], center = 
object$x.scale$scaled:center,  :
 (subscript) logical subscript too long
 
 

__
R-help@stat.math.ethz.ch 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] Please help me to combine two datasets.

2006-05-11 Thread Arun Kumar Saha
Dear r-users,

Suppose I have two data sets

data set-1

Date  height

1/11/2005 10
2/11/2005 23
3/11/2005 54
4/11/2005 21
5/11/2005 22

data set-2

weight

32
45
11


Now I want to combine this two data sets. i.e. i want to see:


Date height   weight
---
3/11/2005 54   32
4/11/2005 21   45
5/11/2005 22   11

Can any one give me the required r-code to perform this?

Thanks and regards,
Arun

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Please help me to combine two datasets.

2006-05-11 Thread ronggui

?merge maybe is what you want.

2006/5/11, Arun Kumar Saha [EMAIL PROTECTED]:

Dear r-users,

Suppose I have two data sets

data set-1

Date  height

1/11/2005 10
2/11/2005 23
3/11/2005 54
4/11/2005 21
5/11/2005 22

data set-2

weight

32
45
11


Now I want to combine this two data sets. i.e. i want to see:


Date height   weight
---
3/11/2005 54   32
4/11/2005 21   45
5/11/2005 22   11

Can any one give me the required r-code to perform this?

Thanks and regards,
Arun

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




--
黄荣贵
Deparment of Sociology
Fudan University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Please help me to combine two datasets.

2006-05-11 Thread Sean O'Riordain
merge(data.set.1, data.set.2)

but how do I know which rows to drop in ds1?

if data.set.2 had dates, you could say

merge(data.set.1, data.set.2, by.x=Date, by.y=Date, all=T)

or do you just want to drop the first
length(data.set.1)-length(data.set.2) from data.set.1?

do you have NA values?

cheers,
Sean

On 11/05/06, Arun Kumar Saha [EMAIL PROTECTED] wrote:
 Dear r-users,

 Suppose I have two data sets

 data set-1

 Date  height
 
 1/11/2005 10
 2/11/2005 23
 3/11/2005 54
 4/11/2005 21
 5/11/2005 22

 data set-2

 weight
 
 32
 45
 11


 Now I want to combine this two data sets. i.e. i want to see:


 Date height   weight
 ---
 3/11/2005 54   32
 4/11/2005 21   45
 5/11/2005 22   11

 Can any one give me the required r-code to perform this?

 Thanks and regards,
 Arun

 [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Please help me to combine two datasets.

2006-05-11 Thread Sean O'Riordain
Hi Arun,

so to clarify: you want to drop the first
  length(data.set.1)-length(data.set.2)
rows...  so you might say...
  new.ds1 - data.set.1[(-(length(data.set.1)-length(data.set.2)),]
and then add a new column...
  new.ds.combined - cbind(new.ds1, data.set.2)

cheers,
Sean


On 11/05/06, Arun Kumar Saha [EMAIL PROTECTED] wrote:

 Dear Sean,

 Thanks for this reply. But my problem is not solved. Actually I want to drop
 first two rows from dataset-1 and then combine them. Can you give me any
 idea?

 Thanks and regards,
 Arun



 On 5/11/06, Sean O'Riordain [EMAIL PROTECTED] wrote:
  merge(data.set.1, data.set.2)
 
  but how do I know which rows to drop in ds1?
 
  if data.set.2 had dates, you could say
 
  merge(data.set.1, data.set.2, by.x=Date, by.y=Date, all=T)
 
  or do you just want to drop the first
  length(data.set.1)-length(data.set.2) from data.set.1?
 
  do you have NA values?
 
  cheers,
  Sean
 
  On 11/05/06, Arun Kumar Saha [EMAIL PROTECTED] wrote:
   Dear r-users,
  
   Suppose I have two data sets
  
   data set-1
  
   Date  height
   
   1/11/2005 10
   2/11/2005 23
   3/11/2005 54
   4/11/2005 21
   5/11/2005 22
  
   data set-2
  
   weight
   
   32
   45
   11
  
  
   Now I want to combine this two data sets. i.e. i want to see:
  
  
   Date height   weight
   ---
   3/11/2005 54   32
   4/11/2005 21   45
   5/11/2005 22   11
  
   Can any one give me the required r-code to perform this?
  
   Thanks and regards,
   Arun
  
   [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
  
 



 --
 Arun Kumar Saha, M.Sc.[C.U.]
 S T A T I S T I C I A N[Analyst]
 RISK  MANAGEMENT  DIVISION
 Transgraph Consulting [ www.transgraph.com]
 Hyderabad, INDIA
 Contact #  Home: (91-033) 25558038
 Office: (91-040) 30685012 Ext. 17
   FAX: (91-040) 55755003
Mobile: 919849957010
  E-Mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Please help me.....

2005-07-13 Thread Uwe Ligges
Fernando Espíndola wrote:

 Hi user R,
 
 I am try to calculate the spectrum function in two time series. But when plot 
 a single serie, the labels in axes x is in the range 0.1 to 0.6 (frequency), 
 but when calculate de spectrum with ts.union function, the labels x is in the 
 range 1 to 6. I not understand why change the labels, and not know that is 
 ralationship. Samebody can hel me in this analysis.


Not so for me.
As the posting guide asks you to do: Can you specify a reproducible 
example, please.

Uwe Ligges


 Thank for all
 
 fdo
 
 Fernando Espindola R.
 Division Investigacion Pesquera
 Instituto de Fomento Pesquero
 Blanco 839
 Valparaiso - CHILE
 fono: 32 - 322442
 [EMAIL PROTECTED]
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Please help me.....

2005-07-13 Thread Francisco J. Zagmutt

Dear Fernando

Please read the posting guide. If you want to get an answer to your question 
you need to be specific about your analysis, and provide examples of the 
data structure and code that you tried and didn't work.



Francisco

--
Español

Estimado Fernando

Por favor lee la guía de publicación de preguntas en el foro.  Si quieres 
recibir una respuesta tienes que especificar los análisis que utilizaste y 
dar ejemplos con la estructura de tus datos y el código que no funcionó.


Francisco


From: Fernando Espíndola [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Please help me.
Date: Tue, 12 Jul 2005 18:42:14 -0400

Hi user R,

I am try to calculate the spectrum function in two time series. But when 
plot a single serie, the labels in axes x is in the range 0.1 to 0.6 
(frequency), but when calculate de spectrum with ts.union function, the 
labels x is in the range 1 to 6. I not understand why change the labels, 
and not know that is ralationship. Samebody can hel me in this 
analysis.


Thank for all

fdo

Fernando Espindola R.
Division Investigacion Pesquera
Instituto de Fomento Pesquero
Blanco 839
Valparaiso - CHILE
fono: 32 - 322442
[EMAIL PROTECTED]


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Please help me.....

2005-07-12 Thread Fernando Espíndola
Hi user R,

I am try to calculate the spectrum function in two time series. But when plot a 
single serie, the labels in axes x is in the range 0.1 to 0.6 (frequency), but 
when calculate de spectrum with ts.union function, the labels x is in the range 
1 to 6. I not understand why change the labels, and not know that is 
ralationship. Samebody can hel me in this analysis.

Thank for all

fdo

Fernando Espindola R.
Division Investigacion Pesquera
Instituto de Fomento Pesquero
Blanco 839
Valparaiso - CHILE
fono: 32 - 322442
[EMAIL PROTECTED]


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Please help me update my address book on Ringo

2005-05-31 Thread Jean-Luc Allard
undefined

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] please help me!

2004-01-29 Thread mpalmier
hello there, 
   I'm a new user to R and I am having difficulty reading a file into the 
program.  Here's the error I keep getting, I bet there's a simple solution, 
but I cant find any...

Error in file(file, r) : unable to open connection
In addition: Warning message: 
cannot open file `c:MikeWeather2.txt' 

I have made sure that my working directory is the same as the place where the 
file is.  I have also tried using the full path name of the file.  read.table, 
read.delim, read.csv, and scan have all been attempted with no result.  What 
causes this message, and how can I fix it.  Thanks in advance for your help,

Mike

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] please help me!

2004-01-29 Thread Ko-Kang Kevin Wang

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 [EMAIL PROTECTED]
 Sent: Friday, January 30, 2004 5:19 AM
 To: [EMAIL PROTECTED]
 Subject: [R] please help me!
 
 
 hello there, 
I'm a new user to R and I am having difficulty reading a 
 file into the 
 program.  Here's the error I keep getting, I bet there's a 
 simple solution, 
 but I cant find any...
 
 Error in file(file, r) : unable to open connection
 In addition: Warning message: 
 cannot open file `c:MikeWeather2.txt' 
 

How did you get this error message?  It would help if you put your codes
here.

But I'm guessing it is because you typed something like:
  foo = read.table(C:\MikeWeather2.txt)

Try to use C:/MikeWeather2.txt or C:\\MikeWeather2.txt.

HTH.

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
Statistics Workshops Co-ordinator
Student Learning Centre
University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: file names under Windows [was: [R] please help me!]

2004-01-29 Thread Douglas Bates
If I may make a suggestion, it helps if you use informative subject
lines in your email to a high-traffic list like this.

[EMAIL PROTECTED] writes:

 hello there, 
I'm a new user to R and I am having difficulty reading a file into the 
 program.  Here's the error I keep getting, I bet there's a simple solution, 
 but I cant find any...
 
 Error in file(file, r) : unable to open connection
 In addition: Warning message: 
 cannot open file `c:MikeWeather2.txt' 
 
 I have made sure that my working directory is the same as the place where the 
 file is.  I have also tried using the full path name of the file.  read.table, 
 read.delim, read.csv, and scan have all been attempted with no result.  What 
 causes this message, and how can I fix it.  Thanks in advance for your help,

I always find it tedious to remember how to write file names in
Windows (there are rules about '\' and '/' characters) so I use the
file.choose() function, which brings up a chooser panel.  Although you
haven't said what you want to do with the file, let's assume you are
going to source some R code in the file.  Then you could use

source(file.choose())

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] please help me!

2004-01-29 Thread Seth Falcon
If your working directory contains a file you want to read then the
following should work:

  dat - read.table(filename.txt)

If you want to use absolute paths, you have to be careful with the '\'
because that is an escape character... so try:

  dat - read.table(c:/some/path/notice/forward/slashes/data.txt)
  # or
  dat - read.table(c:\\double\\back\\should\\work\\data.txt)


On Thu, Jan 29, 2004 at 09:19:23AM -0700, [EMAIL PROTECTED] wrote:
 hello there, 
I'm a new user to R and I am having difficulty reading a file into the 
 program.  Here's the error I keep getting, I bet there's a simple solution, 
 but I cant find any...
 
 Error in file(file, r) : unable to open connection
 In addition: Warning message: 
 cannot open file `c:MikeWeather2.txt' 
 
 I have made sure that my working directory is the same as the place where the 
 file is.  I have also tried using the full path name of the file.  read.table, 
 read.delim, read.csv, and scan have all been attempted with no result.  What 
 causes this message, and how can I fix it.  Thanks in advance for your help,
 
 Mike
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] please help me!

2004-01-29 Thread Prof Brian Ripley
See the rw-FAQ Q2.14 R can't find my file, but I know it is there!

I'd be interested to know why you didn't find that -- the posting guide 
does ask you to read the rw-FAQ, so I presume there is connection that is 
not obvious to you.


On Thu, 29 Jan 2004 [EMAIL PROTECTED] wrote:

 hello there, 
I'm a new user to R and I am having difficulty reading a file into the 
 program.  Here's the error I keep getting, I bet there's a simple solution, 
 but I cant find any...
 
 Error in file(file, r) : unable to open connection
 In addition: Warning message: 
 cannot open file `c:MikeWeather2.txt' 

I guess a \ is missing there, as addressed in Q2.14.

 I have made sure that my working directory is the same as the place
 where the file is.

In that case you don't need c:, do you?

 I have also tried using the full path name of the file.  read.table,
 read.delim, read.csv, and scan have all been attempted with no result.  
 What causes this message, and how can I fix it.  Thanks in advance for
 your help,

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: file names under Windows [was: [R] please help me!]

2004-01-29 Thread Duncan Murdoch
On 29 Jan 2004 14:20:26 -0600, you wrote:

I always find it tedious to remember how to write file names in
Windows (there are rules about '\' and '/' characters) so I use the
file.choose() function, which brings up a chooser panel.  Although you
haven't said what you want to do with the file, let's assume you are
going to source some R code in the file.  Then you could use

source(file.choose())

I've occasionally thought that file = file.choose() would be better
than no default in a lot of functions that take filenames as
arguments, e.g. file, the read* and write* functions, the bitmap
device, Sweave, etc.

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] please help me on this problem

2003-10-05 Thread Yong Wang
Dear all:
I am totally new to R, actually, statistics software.I get two very
simple, even stupid question:
1) where I should put the data file in order to use it , I tried to build
a
work dir in library( package:base) and save the text file (data) there,
then, I use read.table(filename), not work; I tried the full path, still
not work. I must have done something wrong.
2) is it possible to create a data file in R instead of put data in a txt
file and then save the file under R?
I tried to find answer from the introduction, failed.
I really appreciate your help, thank you very much.
best

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] please help me on this problem

2003-10-05 Thread Jason Turner
Yong Wang wrote:

Dear all:
I am totally new to R, actually, statistics software.I get two very
simple, even stupid question:
1) where I should put the data file in order to use it , I tried to build
a
work dir in library( package:base) and save the text file (data) there,
I'm not sure where such a work directory might be, but it sounds like 
you need to show a TA what you did.

It sounds like you need to carefully read the FAQ.

help.start()

the follow the Frequently Asked Questions link, and (if you're using R 
on windows) the FAQ for Windows Port

then, I use read.table(filename), not work; I tried the full path, still
not work. I must have done something wrong.
Quite likely.  But without more details, there's no way to say more. 
There isn't only one way to make a mistake, so there isn't one answer to 
it didn't work.

Read the FAQ.  It really does help.  Read it carefully, and not in a 
frame of mind where you're saying to yourself I'll never understand 
this, this can't possibly help.  You will, it can.

2) is it possible to create a data file in R instead of put data in a txt
file and then save the file under R?
Yes, after you've got a grip on the above.  *After* the above is clear, 
read the help pages for save and load.

Read the FAQ.

I tried to find answer from the introduction, failed.
But not the FAQ, presumably.

I really appreciate your help, thank you very much.
No problem.  By the way, read the FAQ.

Cheers

Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] please help me on this problem

2003-10-05 Thread Jonathan Baron
See the section called Basic method in
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html

On 10/05/03 05:00, Yong Wang wrote:
Dear all:
I am totally new to R, actually, statistics software.I get two very
simple, even stupid question:
1) where I should put the data file in order to use it , I tried to build
a
work dir in library( package:base) and save the text file (data) there,
then, I use read.table(filename), not work; I tried the full path, still
not work. I must have done something wrong.

I'm surprised that it didn't work with the full path.  I assume
the error message indicated that it could not find the file, as
opposed to some other sort of error.  Relative paths work too.

You don't say what operating system you are using, and it
probably matters.  But on Linux/Unix I usually start R from the
directory where the data files are, and I have several of these
for different projects.  (Actually I use ESS, so I start R from
within (X)emacs.  When I say alt-x, R, I'm asked for a directory,
and, if I'm not already in that directory, I enter it using a
relative path name.)

In sum, at least in Unix/Linux, you can put your data anywhere,
and either you start R from where the data are or you use a
relative or full path name.

2) is it possible to create a data file in R instead of put data in a txt
file and then save the file under R?

Yes, but this isn't the best way to do things unless the data
file is pretty small.  You can use c().  It is sometimes helpful
to use matrix() with the argument horiz=T as in Example 2 in
Advanced analysis of variance examples in
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html

See also scan() - that is, look at the help for it.

And you can also use edit().  For example:
m1 - matrix(0,5,5)
m2 - edit(m1)

To save the object you've created, use write(), write.table(),
write.matrix(), dput(), or save().  These differ in formatting
and in how you read it back in.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:http://www.sas.upenn.edu/~baron
R page:   http://finzi.psych.upenn.edu/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] please help me on this problem

2003-10-05 Thread Uwe Ligges
Yong Wang wrote:
 
 Dear all:
 I am totally new to R, actually, statistics software.I get two very
 simple, even stupid question:

But you are not new to e-mails. So, please don't specify a stupid
subject line, but a sensible one. (OK, the rest of this message's body
is unspecific as well, hence the subject might be quite sensible in a
way, tough.)


 1) where I should put the data file in order to use it , I tried to build
 a work dir in library( package:base) and save the text file (data) there,
 then, I use read.table(filename), not work; I tried the full path, still
 not work. I must have done something wrong.

The working directory is the one you are starting R in, or what you have
set with setwd(). It's not a good idea to create a working directory
within the library section. Specifying the full path should always work.

What you did wrong is:
- not reading the manual An Introduction to R carefully
- not reading the manual R Data Import/Export
- beeing to unspecific. After having read the manuals and help pages,
you may ask a specific question, but including error messages and code
you used (we cannot help if we cannot look at your mistakes).


 2) is it possible to create a data file in R instead of put data in a txt
 file and then save the file under R?

Yes. Exporting Data (including ASCII formats) is also covered in the R
Data Import/Export manual.

Uwe Ligges

 I tried to find answer from the introduction, failed.
 I really appreciate your help, thank you very much.
 best
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help