Low Pass Filter in R

I am trying to run a low pass filter on 1000Hz sampled data to 100Hz. Currently data is saved in csv file with a name of data on first row (Time, Measured value etc).

I have imported this data in R studio to variable name "data1"

I would like to run low pass filter and I have done some search on this. I have found several packages and tried to use "butterworth" function. However, I am having an issue on variable of function. Is there any way to run low pass filter by using csv file itself? (Instead of modifying csv file in R studio?)

The csv file must first be imported into R and converted to a class that R can deal with; the original csv file is unaffected unless purposefully overwritten.

This S/O thread has useful resources.

To operate directly on the csv file outside of R requires some other program.

Thanks

Based on my search I found that csv file imported to R studio has type of data frame and I need to change this data frame to numeric type. Any idea on this?

The data frame is a class of object that contains vectors that may be type numeric or type character of both. A matrix can have only one or the other.

Post

str(YOUR DATA)

and I will show how to subset on the numeric.

They are in csv file.

1st row are name of data (time, value1, value2 etc)
starting from row 2, they are all numbers

when I run class(data2), I get an output of "spec_tbl_df" "tbl_df" "tbl" "data.frame"

That is as it should be, so there is no need to subset the data. The next step is to examine the function, f used to see if it will take a data frame as the argument. Use help(name_of_function)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.