Re: [R] Display data by condition

2017-03-16 Thread Juan Ceccarelli Arias
Thanks, but I already solved it as you wrote it.
I was a missing comma.

On Thu, Mar 16, 2017 at 5:19 PM, jim holtman  wrote:

> you are probably missing a comma:
>
> View(data[data$fact > 5000, ])
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Thu, Mar 16, 2017 at 11:16 AM, Juan Ceccarelli Arias  > wrote:
>
>> Hello,
>> I need to show the observations of a data set only if the earn more than
>> $5000 (fact is its name in the date set). I use this:
>>
>> View(data[data$fact>5000])
>>
>> The code above shows nothing. No error or message at all.
>> What am i doing wrong?
>> Thanks for your help and time.
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

[[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] Display data by condition

2017-03-16 Thread Juan Ceccarelli Arias
Thank you both.
The issue was I didn't declare the database as a data frame and I also
forgot the comma...

ene=as.data.frame(data)
attach(ene)
View(ene[ene$fact>5000,])

The code listed did the trick I desired.
Again, thanks I can say the problem is solved.




On Thu, Mar 16, 2017 at 3:32 PM, Jeff Newmiller 
wrote:

> Presuming "data" is a data frame because you have not provided a minimal
> reproducible example as requested in the Posting Guide... note also that
> "data" is the name of a function in base R, so that is a potentially
> troublesome variable name.
>
>  A data frame is a list of vectors. It can be indexed either as a
> one-dimensional object of length equal to the number of columns, or as a
> two-dimensional object. You are doing the former but giving a logical index
> appropriate for the number of rows in your data frame. Go re-read the
> Introduction to R document section on indexing to figure out where the
> comma goes.
> --
> Sent from my phone. Please excuse my brevity.
>
> On March 16, 2017 8:16:29 AM PDT, Juan Ceccarelli Arias 
> wrote:
> >Hello,
> >I need to show the observations of a data set only if the earn more
> >than
> >$5000 (fact is its name in the date set). I use this:
> >
> >View(data[data$fact>5000])
> >
> >The code above shows nothing. No error or message at all.
> >What am i doing wrong?
> >Thanks for your help and time.
> >
> >   [[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] Display data by condition

2017-03-16 Thread jim holtman
you are probably missing a comma:

View(data[data$fact > 5000, ])


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Thu, Mar 16, 2017 at 11:16 AM, Juan Ceccarelli Arias 
wrote:

> Hello,
> I need to show the observations of a data set only if the earn more than
> $5000 (fact is its name in the date set). I use this:
>
> View(data[data$fact>5000])
>
> The code above shows nothing. No error or message at all.
> What am i doing wrong?
> Thanks for your help and time.
>
> [[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] Display data by condition

2017-03-16 Thread Jeff Newmiller
Presuming "data" is a data frame because you have not provided a minimal 
reproducible example as requested in the Posting Guide... note also that "data" 
is the name of a function in base R, so that is a potentially troublesome 
variable name. 

 A data frame is a list of vectors. It can be indexed either as a 
one-dimensional object of length equal to the number of columns, or as a 
two-dimensional object. You are doing the former but giving a logical index 
appropriate for the number of rows in your data frame. Go re-read the 
Introduction to R document section on indexing to figure out where the comma 
goes.
-- 
Sent from my phone. Please excuse my brevity.

On March 16, 2017 8:16:29 AM PDT, Juan Ceccarelli Arias  
wrote:
>Hello,
>I need to show the observations of a data set only if the earn more
>than
>$5000 (fact is its name in the date set). I use this:
>
>View(data[data$fact>5000])
>
>The code above shows nothing. No error or message at all.
>What am i doing wrong?
>Thanks for your help and time.
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Display data by condition

2017-03-16 Thread Rui Barradas

Hello,

Maybe you're missing a comma. (I'm assuming your dataset is a data.frame 
or a matrix.)

Try

View(data[data$fact>5000, ])

To give you a better answer you need to show us the output of

str(data)

And don't name your data 'data', it already is the name of an R function.
And post in plain text, not HTML.

Hope this helps,

Rui Barradas

Em 16-03-2017 15:16, Juan Ceccarelli Arias escreveu:

Hello,
I need to show the observations of a data set only if the earn more than
$5000 (fact is its name in the date set). I use this:

View(data[data$fact>5000])

The code above shows nothing. No error or message at all.
What am i doing wrong?
Thanks for your help and time.

[[alternative HTML version deleted]]

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



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


[R] Display data by condition

2017-03-16 Thread Juan Ceccarelli Arias
Hello,
I need to show the observations of a data set only if the earn more than
$5000 (fact is its name in the date set). I use this:

View(data[data$fact>5000])

The code above shows nothing. No error or message at all.
What am i doing wrong?
Thanks for your help and time.

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